Search in sources :

Example 1 with DockerConfigMetaData

use of org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData in project jbosstools-openshift by jbosstools.

the class DeployImageWizardModel method lookupImageMetadata.

protected IDockerImageMetadata lookupImageMetadata() {
    if (StringUtils.isBlank(this.imageName)) {
        return null;
    }
    final DockerImageURI imageURI = new DockerImageURI(this.imageName);
    final String repo = imageURI.getUriWithoutTag();
    final String tag = StringUtils.defaultIfBlank(imageURI.getTag(), "latest");
    if (dockerConnection != null && DockerImageUtils.hasImage(dockerConnection, repo, tag)) {
        final IDockerImageInfo info = dockerConnection.getImageInfo(this.imageName);
        if (info == null) {
            return null;
        }
        return new DockerConfigMetaData(info);
    } else if (this.project != null) {
        return DockerImageUtils.lookupImageMetadata(project, imageURI);
    }
    return null;
}
Also used : DockerImageURI(com.openshift.restclient.images.DockerImageURI) IDockerImageInfo(org.eclipse.linuxtools.docker.core.IDockerImageInfo) DockerConfigMetaData(org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData)

Example 2 with DockerConfigMetaData

use of org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData in project jbosstools-openshift by jbosstools.

the class DockerConfigMetaDataTest method checkThatContainerConfigPortsAreReturnedWhenNoConfig.

@Test
public void checkThatContainerConfigPortsAreReturnedWhenNoConfig() {
    doReturn(createContainerConfig(Collections.singleton("8080"), null, null)).when(imageInfo).containerConfig();
    DockerConfigMetaData meta = new DockerConfigMetaData(imageInfo);
    assertThat(meta.exposedPorts()).isEqualTo(Collections.singleton("8080"));
}
Also used : DockerConfigMetaData(org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData) Test(org.junit.Test)

Example 3 with DockerConfigMetaData

use of org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData in project jbosstools-openshift by jbosstools.

the class DockerConfigMetaDataTest method checkThatContainerConfigPortsAreReturnedWhenEmptyConfig.

@Test
public void checkThatContainerConfigPortsAreReturnedWhenEmptyConfig() {
    doReturn(createContainerConfig(null, null, null)).when(imageInfo).config();
    doReturn(createContainerConfig(Collections.singleton("8080"), null, null)).when(imageInfo).containerConfig();
    DockerConfigMetaData meta = new DockerConfigMetaData(imageInfo);
    assertThat(meta.exposedPorts()).isEqualTo(Collections.singleton("8080"));
}
Also used : DockerConfigMetaData(org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData) Test(org.junit.Test)

Example 4 with DockerConfigMetaData

use of org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData in project jbosstools-openshift by jbosstools.

the class DockerConfigMetaDataTest method checkThatConfigPortsAreReturnedWhenConfig.

@Test
public void checkThatConfigPortsAreReturnedWhenConfig() {
    doReturn(createContainerConfig(Collections.singleton("8080"), null, null)).when(imageInfo).config();
    doReturn(createContainerConfig(Collections.singleton("8081"), null, null)).when(imageInfo).containerConfig();
    DockerConfigMetaData meta = new DockerConfigMetaData(imageInfo);
    assertThat(meta.exposedPorts()).isEqualTo(Collections.singleton("8080"));
}
Also used : DockerConfigMetaData(org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData) Test(org.junit.Test)

Example 5 with DockerConfigMetaData

use of org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData in project jbosstools-openshift by jbosstools.

the class DockerConfigMetaDataTest method checkThatConfigEnvAreReturnedWhenConfig.

@Test
public void checkThatConfigEnvAreReturnedWhenConfig() {
    doReturn(createContainerConfig(null, Collections.singletonList("PATH=a"), null)).when(imageInfo).config();
    doReturn(createContainerConfig(null, Collections.singletonList("PATH=b"), null)).when(imageInfo).containerConfig();
    DockerConfigMetaData meta = new DockerConfigMetaData(imageInfo);
    assertThat(meta.env()).isEqualTo(Collections.singletonList("PATH=a"));
}
Also used : DockerConfigMetaData(org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData) Test(org.junit.Test)

Aggregations

DockerConfigMetaData (org.jboss.tools.openshift.internal.core.docker.DockerConfigMetaData)10 Test (org.junit.Test)9 DockerImageURI (com.openshift.restclient.images.DockerImageURI)1 IDockerImageInfo (org.eclipse.linuxtools.docker.core.IDockerImageInfo)1