@Test public void testHandleFeatures() throws Exception { InstanceServiceImpl as = new InstanceServiceImpl(); File f = tempFolder.newFile(getName() + ".test"); Properties p = new Properties(); p.put("featuresBoot", "abc,def "); p.put("featuresRepositories", "somescheme: try (OutputStream os = new FileOutputStream(f)) { p.store(os, "Test comment"); } InstanceSettings s = new InstanceSettings(8122, 1122, 44444, null, null, null, Collections.singletonList("test")); as.addFeaturesFromSettings(f, s); Properties p2 = new Properties(); try (InputStream is = new FileInputStream(f)) { p2.load(is); } assertEquals(2, p2.size()); assertEquals("abc,def,test", p2.get("featuresBoot")); assertEquals("somescheme: }
void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws IOException { FileLockUtils.execute(featuresCfg, properties -> { appendToPropList(properties, "featuresBoot", settings.getFeatures()); appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs()); }, true); }
InstanceServiceImpl implements InstanceService { void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws IOException { FileLockUtils.execute(featuresCfg, properties -> { appendToPropList(properties, "featuresBoot", settings.getFeatures()); appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs()); }, true); } }
InstanceServiceImpl implements InstanceService { void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws IOException { FileLockUtils.execute(featuresCfg, properties -> { appendToPropList(properties, "featuresBoot", settings.getFeatures()); appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs()); }, true); } InstanceServiceImpl(); }
InstanceServiceImpl implements InstanceService { void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws IOException { FileLockUtils.execute(featuresCfg, properties -> { appendToPropList(properties, "featuresBoot", settings.getFeatures()); appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs()); }, true); } InstanceServiceImpl(); File getStorageLocation(); void setStorageLocation(File storage); long getStopTimeout(); void setStopTimeout(long stopTimeout); synchronized Instance createInstance(final String name, final InstanceSettings settings, final boolean printOutput); Instance[] getInstances(); Instance getInstance(final String name); void startInstance(final String name, final String javaOpts); void restartInstance(final String name, final String javaOpts); void stopInstance(final String name); void destroyInstance(final String name); void renameInstance(final String oldName, final String newName, final boolean printOutput); synchronized Instance cloneInstance(final String name, final String cloneName, final InstanceSettings settings, final boolean printOutput); void changeInstanceSshHost(String name, String host); }
InstanceServiceImpl implements InstanceService { void addFeaturesFromSettings(File featuresCfg, final InstanceSettings settings) throws IOException { FileLockUtils.execute(featuresCfg, properties -> { appendToPropList(properties, "featuresBoot", settings.getFeatures()); appendToPropList(properties, "featuresRepositories", settings.getFeatureURLs()); }, true); } InstanceServiceImpl(); File getStorageLocation(); void setStorageLocation(File storage); long getStopTimeout(); void setStopTimeout(long stopTimeout); synchronized Instance createInstance(final String name, final InstanceSettings settings, final boolean printOutput); Instance[] getInstances(); Instance getInstance(final String name); void startInstance(final String name, final String javaOpts); void restartInstance(final String name, final String javaOpts); void stopInstance(final String name); void destroyInstance(final String name); void renameInstance(final String oldName, final String newName, final boolean printOutput); synchronized Instance cloneInstance(final String name, final String cloneName, final InstanceSettings settings, final boolean printOutput); void changeInstanceSshHost(String name, String host); static final String STORAGE_FILE; static final String BACKUP_EXTENSION; static final String DEFAULT_JAVA_OPTS; }