use of org.eclipse.che.plugin.docker.client.json.ExposedPort in project che by eclipse.
the class KubernetesServiceTest method shouldReturnServicePortListFromImageExposedPortList.
@Test
public void shouldReturnServicePortListFromImageExposedPortList() {
// Given
Map<String, ExposedPort> imageExposedPorts = new HashMap<>();
imageExposedPorts.put("8080/TCP", new ExposedPort());
// When
List<ServicePort> servicePorts = KubernetesService.getServicePortsFrom(imageExposedPorts.keySet());
// Then
List<String> portsAndProtocols = servicePorts.stream().map(p -> Integer.toString(p.getPort()) + "/" + p.getProtocol()).collect(Collectors.toList());
assertTrue(imageExposedPorts.keySet().stream().anyMatch(portsAndProtocols::contains));
}
use of org.eclipse.che.plugin.docker.client.json.ExposedPort in project che by eclipse.
the class KubernetesContainerTest method shouldReturnContainerPortListFromImageExposedPortList.
@Test
public void shouldReturnContainerPortListFromImageExposedPortList() {
// Given
Map<String, ExposedPort> imageExposedPorts = new HashMap<>();
imageExposedPorts.put("8080/tcp", new ExposedPort());
// When
List<ContainerPort> containerPorts = KubernetesContainer.getContainerPortsFrom(imageExposedPorts.keySet());
// Then
List<String> portsAndProtocols = containerPorts.stream().map(p -> Integer.toString(p.getContainerPort()) + "/" + p.getProtocol().toLowerCase()).collect(Collectors.toList());
assertTrue(imageExposedPorts.keySet().stream().anyMatch(portsAndProtocols::contains));
}
Aggregations