@Test(expected = IllegalArgumentException.class) public void should_throw_exception_with_resolve_two_bind_port_from_different_containers() { String content = "tomcat:\n" + " image: tutum/tomcat:8.0\n" + " portBindings: [8080/tcp]\n" + " links:\n" + " - ping\n" + "ping:\n" + " image: jonmorehouse/ping-pong\n" + " portBindings: [8081/tcp]\n" + "storage:\n" + " image: tutum/mongodb"; Map<String, String> parameters = new HashMap<String, String>(); parameters.put("dockerContainers", content); parameters.put("definitionFormat", DefinitionFormat.CUBE.name()); CubeDockerConfiguration cubeConfiguration = CubeDockerConfiguration.fromMap(parameters, null); final int bindPort = SinglePortBindResolver.resolveBindPort(cubeConfiguration); }
public static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort, String... excludedContainers) { final PortBindInfo portBinding = resolvePortBindPort(cubeDockerConfiguration, exposedPort, excludedContainers); if (portBinding == null) { return exposedPort; } return portBinding.getBindPort(); }
SinglePortBindResolver { public static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort, String... excludedContainers) { final PortBindInfo portBinding = resolvePortBindPort(cubeDockerConfiguration, exposedPort, excludedContainers); if (portBinding == null) { return exposedPort; } return portBinding.getBindPort(); } }
SinglePortBindResolver { public static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort, String... excludedContainers) { final PortBindInfo portBinding = resolvePortBindPort(cubeDockerConfiguration, exposedPort, excludedContainers); if (portBinding == null) { return exposedPort; } return portBinding.getBindPort(); } private  SinglePortBindResolver(); }
SinglePortBindResolver { public static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort, String... excludedContainers) { final PortBindInfo portBinding = resolvePortBindPort(cubeDockerConfiguration, exposedPort, excludedContainers); if (portBinding == null) { return exposedPort; } return portBinding.getBindPort(); } private  SinglePortBindResolver(); static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort,
        String... excludedContainers); static PortBindInfo resolvePortBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort,
        String... excludedContainers); static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, String... excludedContainers); static PortBindInfo resolvePortBindPort(CubeDockerConfiguration cubeDockerConfiguration,
        String... excludedContainers); }
SinglePortBindResolver { public static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort, String... excludedContainers) { final PortBindInfo portBinding = resolvePortBindPort(cubeDockerConfiguration, exposedPort, excludedContainers); if (portBinding == null) { return exposedPort; } return portBinding.getBindPort(); } private  SinglePortBindResolver(); static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort,
        String... excludedContainers); static PortBindInfo resolvePortBindPort(CubeDockerConfiguration cubeDockerConfiguration, int exposedPort,
        String... excludedContainers); static int resolveBindPort(CubeDockerConfiguration cubeDockerConfiguration, String... excludedContainers); static PortBindInfo resolvePortBindPort(CubeDockerConfiguration cubeDockerConfiguration,
        String... excludedContainers);  }