use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DeployImageWizardModelTest method shouldNotInitializeContainerInfoFromWrongPayload.
@Test
public void shouldNotInitializeContainerInfoFromWrongPayload() throws IOException {
// no Docker image on local
when(dockerConnection.hasImage(NON_EXISTANT_IMAGE, LATEST_TAG)).thenReturn(false);
final IImageStreamImportCapability cap = Mockito.mock(IImageStreamImportCapability.class);
when(project.supports(IImageStreamImportCapability.class)).thenReturn(true);
when(project.getCapability(IImageStreamImportCapability.class)).thenReturn(cap);
final IStatus status = Mockito.mock(IStatus.class);
final IImageStreamImport streamImport = Mockito.mock(IImageStreamImport.class);
final DockerImageURI dockerImageURI = new DockerImageURI(NON_EXISTANT_IMAGE_URI);
when(status.isSuccess()).thenReturn(false);
when(cap.importImageMetadata(dockerImageURI)).thenReturn(streamImport);
when(streamImport.getImageJsonFor(dockerImageURI.getTag())).thenReturn(getImageStreamImport("/resources/failed_ImageStreamImport.json"));
when(streamImport.getImageStatus()).thenReturn(Arrays.asList(status));
// when
model.setImageName(NON_EXISTANT_IMAGE_URI);
final boolean result = model.initializeContainerInfo();
// then
assertThat(result).isFalse();
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DockerImage2OpenshiftResourceConverterTest method testDoubleTrailingUnderscore.
@Test
public void testDoubleTrailingUnderscore() {
String resourceName = converter.convert(new DockerImageURI("image__"));
assertEquals("image", resourceName);
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DockerImage2OpenshiftResourceConverterTest method testDash.
@Test
public void testDash() {
String resourceName = converter.convert(new DockerImageURI("image-sub"));
assertEquals("image-sub", resourceName);
}
use of com.openshift.restclient.images.DockerImageURI in project jbosstools-openshift by jbosstools.
the class DockerImage2OpenshiftResourceConverterTest method testNonAllowed.
@Test
public void testNonAllowed() {
String resourceName = converter.convert(new DockerImageURI("image+sub"));
assertEquals("imagesub", resourceName);
}
Aggregations