Search in sources :

Example 1 with ServerSettingsWizardPageModel

use of org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldReturn1stProjectIfNoMatchesGitRemoteOfServiceModelWasInitializedWith.

@Test
public void shouldReturn1stProjectIfNoMatchesGitRemoteOfServiceModelWasInitializedWith() {
    // given
    ServerSettingsWizardPageModel model = createModel(ResourceMocks.PROJECT2_SERVICES[1], null, null, Arrays.asList(project1, project3, project4), connection);
    // when
    IProject project = model.getDeployProject();
    // then
    assertThat(project).isEqualTo(project1);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 2 with ServerSettingsWizardPageModel

use of org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldReturnProjectMatchingServiceByGitRemoteIfSettingUnavailableDeployProject.

@Test
public void shouldReturnProjectMatchingServiceByGitRemoteIfSettingUnavailableDeployProject() {
    // given
    ServerSettingsWizardPageModel model = createModel(ResourceMocks.PROJECT2_SERVICES[1], null, null, Arrays.asList(project2, project3, project4), connection);
    assertThat(model.getDeployProject()).isEqualTo(project2);
    // when
    model.setDeployProject(project1);
    // then
    // project2 matches ResourceMocks.PROJECT2_SERVICES[1] in git remote
    assertThat(model.getDeployProject()).isEqualTo(project2);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) Test(org.junit.Test)

Example 3 with ServerSettingsWizardPageModel

use of org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDebugPortKeyToFalseIfKeyIsPresent.

@Test
public void shouldInitializeUseImageDebugPortKeyToFalseIfKeyIsPresent() throws Exception {
    // given
    IServerWorkingCopy server = spy(OpenShiftServerTestUtils.createOpenshift3ServerWorkingCopy("aServer", null, null, null));
    doReturn("debugPortKey").when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_DEBUG_PORT_KEY), anyString());
    // when
    ServerSettingsWizardPageModel model = createModel(null, null, null, null, null, server);
    // then
    assertThat(model.isUseImageDebugPortKey()).isFalse();
}
Also used : IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) Test(org.junit.Test)

Example 4 with ServerSettingsWizardPageModel

use of org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldInitializeDevmodeKey.

@Test
public void shouldInitializeDevmodeKey() throws Exception {
    // given
    IServerWorkingCopy server = spy(OpenShiftServerTestUtils.createOpenshift3ServerWorkingCopy("aServer", null, null, null));
    doReturn("aDevmodeKey").when(server).getAttribute(eq(OpenShiftServerUtils.ATTR_DEVMODE_KEY), anyString());
    // when
    ServerSettingsWizardPageModel model = createModel(null, null, null, null, null, server);
    // then
    assertThat(model.getDevmodeKey()).isEqualTo("aDevmodeKey");
}
Also used : IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) Test(org.junit.Test)

Example 5 with ServerSettingsWizardPageModel

use of org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPageModelTest method shouldReturnServiceMatchingGitRemoteOfProjectModelWasInitializedWith.

@Test
public void shouldReturnServiceMatchingGitRemoteOfProjectModelWasInitializedWith() {
    // given
    // model initialized with project
    ServerSettingsWizardPageModel model = createModel(null, null, project2, Arrays.asList(project1, project2, project3, project4), connection);
    // when
    IResource resource = model.getResource();
    IProject deployProject = model.getDeployProject();
    // then
    assertThat(resource).isEqualTo(ResourceMocks.PROJECT2_SERVICES[1]);
    assertThat(deployProject).isEqualTo(project2);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) IResource(com.openshift.restclient.model.IResource) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Aggregations

ServerSettingsWizardPageModel (org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel)16 Test (org.junit.Test)15 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)10 IResource (com.openshift.restclient.model.IResource)3 IProject (org.eclipse.core.resources.IProject)3 IRoute (com.openshift.restclient.model.route.IRoute)2 IBuildConfig (com.openshift.restclient.model.IBuildConfig)1 IProject (com.openshift.restclient.model.IProject)1 IService (com.openshift.restclient.model.IService)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Collection (java.util.Collection)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Map (java.util.Map)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 Job (org.eclipse.core.runtime.jobs.Job)1