Search in sources :

Example 36 with DockerImageURI

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();
}
Also used : IStatus(com.openshift.restclient.model.IStatus) DockerImageURI(com.openshift.restclient.images.DockerImageURI) IImageStreamImport(com.openshift.restclient.model.image.IImageStreamImport) IImageStreamImportCapability(com.openshift.restclient.capability.resources.IImageStreamImportCapability) Test(org.junit.Test)

Example 37 with DockerImageURI

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);
}
Also used : DockerImageURI(com.openshift.restclient.images.DockerImageURI) Test(org.junit.Test)

Example 38 with DockerImageURI

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);
}
Also used : DockerImageURI(com.openshift.restclient.images.DockerImageURI) Test(org.junit.Test)

Example 39 with DockerImageURI

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);
}
Also used : DockerImageURI(com.openshift.restclient.images.DockerImageURI) Test(org.junit.Test)

Aggregations

DockerImageURI (com.openshift.restclient.images.DockerImageURI)39 Test (org.junit.Test)23 IDeploymentImageChangeTrigger (com.openshift.restclient.model.deploy.IDeploymentImageChangeTrigger)9 IDeploymentConfig (com.openshift.restclient.model.IDeploymentConfig)6 IImageStream (com.openshift.restclient.model.IImageStream)5 ISourceBuildStrategy (com.openshift.restclient.model.build.ISourceBuildStrategy)5 IImageStreamImportCapability (com.openshift.restclient.capability.resources.IImageStreamImportCapability)4 IResource (com.openshift.restclient.model.IResource)4 IImageStreamImport (com.openshift.restclient.model.image.IImageStreamImport)4 HashMap (java.util.HashMap)4 IResourceFactory (com.openshift.restclient.IResourceFactory)3 IBuildConfig (com.openshift.restclient.model.IBuildConfig)3 IProject (com.openshift.restclient.model.IProject)3 IStatus (com.openshift.restclient.model.IStatus)3 ICustomBuildStrategy (com.openshift.restclient.model.build.ICustomBuildStrategy)3 IDockerBuildStrategy (com.openshift.restclient.model.build.IDockerBuildStrategy)3 Collection (java.util.Collection)3 EnvironmentVariable (org.jboss.tools.openshift.internal.ui.wizard.common.EnvironmentVariable)3 ResourceKind (com.openshift.restclient.ResourceKind)2 IBuildStrategy (com.openshift.restclient.model.build.IBuildStrategy)2