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;
}
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"));
}
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"));
}
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"));
}
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"));
}
Aggregations