use of com.openshift.restclient.images.DockerImageURI 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"));
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method testImageRefForDeploymentImageChangeTrigger.
@Test
public void testImageRefForDeploymentImageChangeTrigger() {
assertEquals("", imageRef((IDeploymentImageChangeTrigger) null));
when(deployTrigger.getKind()).thenReturn("something");
assertEquals("", imageRef(deployTrigger));
DockerImageURI uri = new DockerImageURI(IMAGE_REF);
when(deployTrigger.getFrom()).thenReturn(uri);
when(deployTrigger.getKind()).thenReturn(ResourceKind.IMAGE_STREAM_TAG);
assertEquals(IMAGE_REF, imageRef(deployTrigger));
when(deployTrigger.getKind()).thenReturn(ResourceUtils.IMAGE_STREAM_IMAGE_KIND);
assertEquals(IMAGE_REF, imageRef(deployTrigger));
when(deployTrigger.getKind()).thenReturn(ResourceUtils.DOCKER_IMAGE_KIND);
assertEquals(IMAGE_REF, imageRef(deployTrigger));
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DockerImageLabels method importImageStream.
private String importImageStream(String imageRef, IProject project) {
IImageStreamImportCapability imageStreamImportCapability = project.getCapability(IImageStreamImportCapability.class);
DockerImageURI uri = new DockerImageURI(imageRef);
IImageStreamImport imageStreamImport = imageStreamImportCapability.importImageMetadata(uri);
if (!ResourceUtils.isSuccessful(imageStreamImport)) {
return null;
}
return imageStreamImport.getImageJsonFor(uri);
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DeployImageWizardModel method setImageName.
@Override
public void setImageName(final String imageName) {
if (StringUtils.isBlank(imageName)) {
return;
}
if (this.imageName != null && !this.imageName.equals(imageName) && this.imageMeta != null) {
// Clean container info loaded for old image name.
this.imageMeta = null;
setEnvironmentVariables(new ArrayList<>());
setPortSpecs(new ArrayList<>());
setVolumes(new ArrayList<>());
}
firePropertyChange(PROPERTY_IMAGE_NAME, this.imageName, this.imageName = imageName);
final DockerImageURI uri = new DockerImageURI(imageName);
setResourceName(dockerImage2OpenshiftResourceConverter.convert(uri));
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DockerImage2OpenshiftResourceConverterTest method testDoubleDash.
@Test
public void testDoubleDash() {
String resourceName = converter.convert(new DockerImageURI("image--sub"));
assertEquals("image-sub", resourceName);
}
Aggregations