ClusterPropertyLinker implements EntitiesLinker { @Override public void link(Bundle filteredBundle, Bundle bundle) { throw new UnsupportedOperationException(); }  @Override void link(Bundle filteredBundle, Bundle bundle); @Override void link(Bundle filteredBundle, Bundle bundle, File rootFolder); @Override void link(Set<Dependency> dependencies);  }
@Test void linkUnsupportedOperation() { assertThrows(UnsupportedOperationException.class, () -> clusterPropertyLinker.link(bundle, null)); }
@Test void linkNoStaticPropertiesFile(TemporaryFolder temporaryFolder) { clusterPropertyLinker.link(bundle, null, temporaryFolder.getRoot()); assertEquals(0, bundle.getEntities(ClusterProperty.class).size()); assertEquals(4, bundle.getEntities(GlobalEnvironmentProperty.class).size()); verifyEnvironmentProperties(); }
@Test void linkStaticPropertiesFile(TemporaryFolder temporaryFolder) throws IOException { File configFolder = temporaryFolder.createDirectory("config"); File propertiesFile = new File(configFolder, "static.properties"); Properties staticProps = new OrderedProperties(); staticProps.setProperty("my.name", "static value"); staticProps.setProperty("another", "another static value"); try (OutputStream outputStream = new StripFirstLineStream(new FileOutputStream(propertiesFile))) { staticProps.store(outputStream, null); } clusterPropertyLinker.link(bundle, null, temporaryFolder.getRoot()); assertEquals(2, bundle.getEntities(ClusterProperty.class).size()); assertEquals(2, bundle.getEntities(GlobalEnvironmentProperty.class).size()); assertEquals("my.name", bundle.getEntities(ClusterProperty.class).get("1").getName()); assertEquals("another", bundle.getEntities(ClusterProperty.class).get("3").getName()); assertEquals("my-value", bundle.getEntities(ClusterProperty.class).get("1").getValue()); assertEquals("my-value", bundle.getEntities(ClusterProperty.class).get("3").getValue()); verifyEnvironmentProperties(); }