use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceUniqueIdTest method should_return_correct_resource_by_uniqueId.
@Test
public void should_return_correct_resource_by_uniqueId() {
// given
IResource toBeFound = ResourceMocks.PROJECT2;
List<IResource> resources = Arrays.asList(ResourceMocks.PROJECT1, toBeFound, ResourceMocks.PROJECT3);
String uniqueId = OpenShiftResourceUniqueId.get(toBeFound);
// when
IResource found = OpenShiftResourceUniqueId.getByUniqueId(uniqueId, resources);
// then
assertThat(found).isSameAs(toBeFound);
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceUniqueIdTest method should_return_unique_uniqueId.
@Test
public void should_return_unique_uniqueId() {
// given
IResource resource1 = ResourceMocks.PROJECT1;
IResource resource2 = ResourceMocks.PROJECT2;
// when
String uniqueId1 = OpenShiftResourceUniqueId.get(resource1);
String uniqueId2 = OpenShiftResourceUniqueId.get(resource2);
// then
assertThat(uniqueId1).isNotEmpty();
assertThat(uniqueId2).isNotEmpty();
assertThat(uniqueId1).isNotEqualTo(uniqueId2);
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class OpenShiftResourceUniqueIdTest method should_return_correct_correct_resourcename.
@Test
public void should_return_correct_correct_resourcename() {
// given
IResource resource = ResourceMocks.PROJECT2_SERVICES[0];
String uniqueId = OpenShiftResourceUniqueId.get(resource);
// when
String resourceName = OpenShiftResourceUniqueId.getResourceName(uniqueId);
// then
assertThat(resourceName).isEqualTo(resource.getName());
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithDeploymentConfigTest method shouldReturnResourceIfResourcesAreLoaded.
@Test
public void shouldReturnResourceIfResourcesAreLoaded() {
// given
model.loadResources();
// when
IResource resource = model.getResource();
// then
assertThat(resource).isEqualTo(selectedDeploymentConfig);
}
use of com.openshift.restclient.model.IResource in project jbosstools-openshift by jbosstools.
the class DeployImageJobTest method shouldUpdateImageTagIfItDifferesFromExisting.
@Test
public void shouldUpdateImageTagIfItDifferesFromExisting() {
givenAConnection();
givenTheImageStreamExistsTo("myimagename");
givenTheDeploymentConfigExistFor("myimagename", "v0", NAMESPACE, ResourceKind.IMAGE_STREAM_TAG);
doReturn(DOCKER_NEW_TAG).when(job).getSourceImage();
IResource resource = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, project.getName(), parameters.getResourceName());
IDeploymentImageChangeTrigger trigger = (IDeploymentImageChangeTrigger) ((IDeploymentConfig) resource).getTriggers().toArray()[0];
assertThat(job.doRun(monitor)).isEqualTo(Status.OK_STATUS);
verify(trigger, times(1)).setFrom(new DockerImageURI(null, null, "myimagename", "v1"));
}
Aggregations