Search in sources :

Example 6 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDebugPortValueToTrueIfKeyIsNotPresent.

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

Example 7 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDevmodeKeyToTrueIfKeyIsNotPresent.

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

Example 8 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeDebugPortValue.

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

Example 9 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method should_return_valid_route_if_initialized_with_invalid_route.

@Test
public void should_return_valid_route_if_initialized_with_invalid_route() {
    // given
    ServerSettingsWizardPageModel model = createModel(ResourceMocks.PROJECT2_SERVICES[1], ResourceMocks.PROJECT3_ROUTES[0], null, Arrays.asList(project1, project3, project4), connection);
    // when
    IRoute route = model.getRoute();
    // then
    assertThat(route).isEqualTo(ResourceMocks.PROJECT2_ROUTES[1]);
}
Also used : IRoute(com.openshift.restclient.model.route.IRoute) ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) Test(org.junit.Test)

Example 10 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldReturn1stAvailableProjectIfModelInitializingProjectIsNotContainedInAvailableProjects.

@Test
public void shouldReturn1stAvailableProjectIfModelInitializingProjectIsNotContainedInAvailableProjects() {
    // given
    ServerSettingsWizardPageModel model = createModel(null, null, project2, Arrays.asList(project1, project3, project4), connection);
    // when
    IProject deployProject = model.getDeployProject();
    // then
    assertThat(deployProject).isEqualTo(project1);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) 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