Search in sources :

Example 11 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDevmodeKeyToFalseIfKeyIsPresent.

@Test
public void shouldInitializeUseImageDevmodeKeyToFalseIfKeyIsPresent() 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.isUseImageDevmodeKey()).isFalse();
}
Also used : IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) Test(org.junit.Test)

Example 12 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDebugPortKeyToTrueIfKeyIsNotPresent.

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

Example 13 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeUseImageDebugPortValueToFalseIfKeyIsPresent.

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

Example 14 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldInitializeDebugPortKey.

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

Example 15 with ServerSettingsWizardPageModel

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

the class ServerSettingsWizardPageModelTest method shouldReturn1stServiceIfNoServiceMatchesGitRemoteOfProjectModelWasInitializedWith.

@Test
public void shouldReturn1stServiceIfNoServiceMatchesGitRemoteOfProjectModelWasInitializedWith() {
    // given
    ServerSettingsWizardPageModel model = createModel(null, null, project1, Arrays.asList(project1, project2, project3, project4), connection);
    // when
    IResource resource = model.getResource();
    // then
    assertThat(resource).isEqualTo(ResourceMocks.PROJECT2_SERVICES[0]);
}
Also used : ServerSettingsWizardPageModel(org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPageModel) IResource(com.openshift.restclient.model.IResource) 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