use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceUniqueIdTest method should_return_correct_correct_projectname.
@Test
public void should_return_correct_correct_projectname() {
// given
IResource resource = ResourceMocks.PROJECT2_SERVICES[1];
String uniqueId = OpenShiftResourceUniqueId.get(resource);
// when
String projectName = OpenShiftResourceUniqueId.getProjectName(uniqueId);
// then
assertThat(projectName).isEqualTo(resource.getProject().getName());
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceUniqueIdTest method should_return_null_if_resource_has_no_name.
@Test
public void should_return_null_if_resource_has_no_name() {
// given
IResource resource = ResourceMocks.createProject(null);
// when
String uniqueId = OpenShiftResourceUniqueId.get(resource);
// then
assertThat(uniqueId).isNull();
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithServiceTest method shouldReturnResourceIfResourcesAreLoaded.
@Test
public void shouldReturnResourceIfResourcesAreLoaded() {
// given
model.loadResources();
// when
IResource resource = model.getResource();
// then
assertThat(resource).isEqualTo(selectedService);
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPageModelTest method should_set_server_service_when_updating_server.
@Test
public void should_set_server_service_when_updating_server() throws CoreException {
// given
model.setSelectDefaultRoute(true);
IResource resource = model.getResource();
assertThat(resource).isNotNull();
// when
model.updateServer();
// then
verify(server, atLeastOnce()).setAttribute(eq(OpenShiftServerUtils.ATTR_SERVICE), anyString());
verify(model, atLeastOnce()).updateServer(anyString(), eq(resource), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), any(org.eclipse.core.resources.IProject.class));
}
use of com.openshift.restclient.model.IResource 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]);
}
Aggregations