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);
}
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);
}
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();
}
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");
}
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);
}
Aggregations