@Test public void should_unset_cube_properties() { SystemPropertiesCubeSetter systemPropertiesCubeSetter = new SystemPropertiesCubeSetter(); System.setProperty("arq.cube.docker.image.ip", "192.168.99.100"); System.setProperty("arq.cube.docker.image.port.8080", "8080"); systemPropertiesCubeSetter.removeCubeSystemProperties(new AfterDestroy("image")); assertThat(System.getProperty("arq.cube.docker.image.ip")).isNull(); assertThat(System.getProperty("arq.cube.docker.image.port.8080")).isNull(); }
public void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy) { final Iterator<Map.Entry<Object, Object>> propertiesIterator = System.getProperties() .entrySet().iterator(); String cubePrefix = String.format("%s.%s", PREFIX, afterDestroy.getCubeId()); while (propertiesIterator.hasNext()) { if (propertiesIterator.next().getKey().toString().startsWith(cubePrefix)) { propertiesIterator.remove(); } } }
SystemPropertiesCubeSetter { public void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy) { final Iterator<Map.Entry<Object, Object>> propertiesIterator = System.getProperties() .entrySet().iterator(); String cubePrefix = String.format("%s.%s", PREFIX, afterDestroy.getCubeId()); while (propertiesIterator.hasNext()) { if (propertiesIterator.next().getKey().toString().startsWith(cubePrefix)) { propertiesIterator.remove(); } } } }
SystemPropertiesCubeSetter { public void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy) { final Iterator<Map.Entry<Object, Object>> propertiesIterator = System.getProperties() .entrySet().iterator(); String cubePrefix = String.format("%s.%s", PREFIX, afterDestroy.getCubeId()); while (propertiesIterator.hasNext()) { if (propertiesIterator.next().getKey().toString().startsWith(cubePrefix)) { propertiesIterator.remove(); } } }  }
SystemPropertiesCubeSetter { public void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy) { final Iterator<Map.Entry<Object, Object>> propertiesIterator = System.getProperties() .entrySet().iterator(); String cubePrefix = String.format("%s.%s", PREFIX, afterDestroy.getCubeId()); while (propertiesIterator.hasNext()) { if (propertiesIterator.next().getKey().toString().startsWith(cubePrefix)) { propertiesIterator.remove(); } } }  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 removeCubeSystemProperties(@Observes AfterDestroy afterDestroy) { final Iterator<Map.Entry<Object, Object>> propertiesIterator = System.getProperties() .entrySet().iterator(); String cubePrefix = String.format("%s.%s", PREFIX, afterDestroy.getCubeId()); while (propertiesIterator.hasNext()) { if (propertiesIterator.next().getKey().toString().startsWith(cubePrefix)) { propertiesIterator.remove(); } } }  void createDockerHostProperty(@Observes BeforeSuite beforeSuite, DockerClientExecutor dockerClientExecutor); void removeDockerHostProperty(@Observes AfterSuite afterSuite); void createCubeSystemProperties(@Observes AfterStart afterStart, CubeRegistry cubeRegistry); void removeCubeSystemProperties(@Observes AfterDestroy afterDestroy);  }