@Test public void should_set_cube_properties() { SystemPropertiesCubeSetter systemPropertiesCubeSetter = new SystemPropertiesCubeSetter(); systemPropertiesCubeSetter.createCubeSystemProperties(new AfterStart("image"), cubeRegistry); assertThat(System.getProperty("arq.cube.docker.image.ip")).isEqualTo("192.168.99.100"); assertThat(System.getProperty("arq.cube.docker.image.internal.ip")).isEqualTo("172.0.10.0"); assertThat(System.getProperty("arq.cube.docker.image.port.8080")).isEqualTo("8080"); }
public void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry) { String cubeId = afterStart.getCubeId(); final DockerCube cube = cubeRegistry.getCube(cubeId, DockerCube.class); final Binding bindings = cube.bindings(); final String cubePrefix = String.format("%s.%s", PREFIX, cubeId); final String ip = bindings.getIP(); final String internalIP = bindings.getInternalIP(); System.setProperty(String.format("%s.ip", cubePrefix), null != ip ? ip : ""); System.setProperty(String.format("%s.internal.ip", cubePrefix), null != internalIP ? internalIP : ""); for (Binding.PortBinding portBinding : bindings.getPortBindings()) { final int exposedPort = portBinding.getExposedPort(); final Integer boundPort = portBinding.getBindingPort(); System.setProperty(String.format("%s.port.%d", cubePrefix, exposedPort), boundPort.toString()); } }
SystemPropertiesCubeSetter { public void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry) { String cubeId = afterStart.getCubeId(); final DockerCube cube = cubeRegistry.getCube(cubeId, DockerCube.class); final Binding bindings = cube.bindings(); final String cubePrefix = String.format("%s.%s", PREFIX, cubeId); final String ip = bindings.getIP(); final String internalIP = bindings.getInternalIP(); System.setProperty(String.format("%s.ip", cubePrefix), null != ip ? ip : ""); System.setProperty(String.format("%s.internal.ip", cubePrefix), null != internalIP ? internalIP : ""); for (Binding.PortBinding portBinding : bindings.getPortBindings()) { final int exposedPort = portBinding.getExposedPort(); final Integer boundPort = portBinding.getBindingPort(); System.setProperty(String.format("%s.port.%d", cubePrefix, exposedPort), boundPort.toString()); } } }
SystemPropertiesCubeSetter { public void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry) { String cubeId = afterStart.getCubeId(); final DockerCube cube = cubeRegistry.getCube(cubeId, DockerCube.class); final Binding bindings = cube.bindings(); final String cubePrefix = String.format("%s.%s", PREFIX, cubeId); final String ip = bindings.getIP(); final String internalIP = bindings.getInternalIP(); System.setProperty(String.format("%s.ip", cubePrefix), null != ip ? ip : ""); System.setProperty(String.format("%s.internal.ip", cubePrefix), null != internalIP ? internalIP : ""); for (Binding.PortBinding portBinding : bindings.getPortBindings()) { final int exposedPort = portBinding.getExposedPort(); final Integer boundPort = portBinding.getBindingPort(); System.setProperty(String.format("%s.port.%d", cubePrefix, exposedPort), boundPort.toString()); } }  }
SystemPropertiesCubeSetter { public void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry) { String cubeId = afterStart.getCubeId(); final DockerCube cube = cubeRegistry.getCube(cubeId, DockerCube.class); final Binding bindings = cube.bindings(); final String cubePrefix = String.format("%s.%s", PREFIX, cubeId); final String ip = bindings.getIP(); final String internalIP = bindings.getInternalIP(); System.setProperty(String.format("%s.ip", cubePrefix), null != ip ? ip : ""); System.setProperty(String.format("%s.internal.ip", cubePrefix), null != internalIP ? internalIP : ""); for (Binding.PortBinding portBinding : bindings.getPortBindings()) { final int exposedPort = portBinding.getExposedPort(); final Integer boundPort = portBinding.getBindingPort(); System.setProperty(String.format("%s.port.%d", cubePrefix, exposedPort), boundPort.toString()); } }  void createDockerHostProperty(@Observes BeforeSuite beforeSuite, DockerClientExecutor dockerClientExecutor); void removeDockerHostProperty(@Observes AfterSuite afterSuite); void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry); void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy); }
SystemPropertiesCubeSetter { public void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry) { String cubeId = afterStart.getCubeId(); final DockerCube cube = cubeRegistry.getCube(cubeId, DockerCube.class); final Binding bindings = cube.bindings(); final String cubePrefix = String.format("%s.%s", PREFIX, cubeId); final String ip = bindings.getIP(); final String internalIP = bindings.getInternalIP(); System.setProperty(String.format("%s.ip", cubePrefix), null != ip ? ip : ""); System.setProperty(String.format("%s.internal.ip", cubePrefix), null != internalIP ? internalIP : ""); for (Binding.PortBinding portBinding : bindings.getPortBindings()) { final int exposedPort = portBinding.getExposedPort(); final Integer boundPort = portBinding.getBindingPort(); System.setProperty(String.format("%s.port.%d", cubePrefix, exposedPort), boundPort.toString()); } }  void createDockerHostProperty(@Observes BeforeSuite beforeSuite, DockerClientExecutor dockerClientExecutor); void removeDockerHostProperty(@Observes AfterSuite afterSuite); void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry); void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy);  }