@Test public void testActivateEmptyDirDisabled1() throws URISyntaxException { this.baseDir.delete(); assertEquals(false, this.baseDir.exists()); this.props.remove(InitialRegistrationImpl.PROP_SYNC_ONCE_TYPE); this.initialRegistration.activate(this.props); FileAssert.assertEquals(getResource("data3-config.properties"), this.generatedConfigFile); FileAssert.assertEquals(getResource("data1-filter.xml"), this.generatedFilterFile); verify(this.serviceSettings, times(1)).addSyncRoot(this.baseDir, 3000l); }
@Activate protected void activate(final Map<String, Object> props) throws ServiceException { logger.debug("activate(): props = {}", props); this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null); if (this.filterRoots == null) { throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!"); } final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null)); if (localDirValue == null) { throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!"); } this.localDir = new File(localDirValue); this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES), DEFAULT_OVERWRITE_CONFIG_FILES); this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED); generateFiles(); Long expectedSyncOnceTime = null; if (this.willSyncOnce) { expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME), DEFAULT_SYNC_ONCE_EXPECTED_TIME); } this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime); }
InitialRegistrationImpl { @Activate protected void activate(final Map<String, Object> props) throws ServiceException { logger.debug("activate(): props = {}", props); this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null); if (this.filterRoots == null) { throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!"); } final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null)); if (localDirValue == null) { throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!"); } this.localDir = new File(localDirValue); this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES), DEFAULT_OVERWRITE_CONFIG_FILES); this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED); generateFiles(); Long expectedSyncOnceTime = null; if (this.willSyncOnce) { expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME), DEFAULT_SYNC_ONCE_EXPECTED_TIME); } this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime); } }
InitialRegistrationImpl { @Activate protected void activate(final Map<String, Object> props) throws ServiceException { logger.debug("activate(): props = {}", props); this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null); if (this.filterRoots == null) { throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!"); } final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null)); if (localDirValue == null) { throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!"); } this.localDir = new File(localDirValue); this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES), DEFAULT_OVERWRITE_CONFIG_FILES); this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED); generateFiles(); Long expectedSyncOnceTime = null; if (this.willSyncOnce) { expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME), DEFAULT_SYNC_ONCE_EXPECTED_TIME); } this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime); }  }
InitialRegistrationImpl { @Activate protected void activate(final Map<String, Object> props) throws ServiceException { logger.debug("activate(): props = {}", props); this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null); if (this.filterRoots == null) { throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!"); } final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null)); if (localDirValue == null) { throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!"); } this.localDir = new File(localDirValue); this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES), DEFAULT_OVERWRITE_CONFIG_FILES); this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED); generateFiles(); Long expectedSyncOnceTime = null; if (this.willSyncOnce) { expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME), DEFAULT_SYNC_ONCE_EXPECTED_TIME); } this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime); }   }
InitialRegistrationImpl { @Activate protected void activate(final Map<String, Object> props) throws ServiceException { logger.debug("activate(): props = {}", props); this.filterRoots = PropertiesUtil.toStringArray(props.get(PROP_FILTER_ROOTS), null); if (this.filterRoots == null) { throw new ServiceException(PROP_FILTER_ROOTS + " is mandatory!"); } final String localDirValue = StringUtils.trim(PropertiesUtil.toString(props.get(PROP_LOCAL_PATH), null)); if (localDirValue == null) { throw new ServiceException(PROP_LOCAL_PATH + " is mandatory!"); } this.localDir = new File(localDirValue); this.overwriteConfigFiles = PropertiesUtil.toBoolean(props.get(PROP_OVERWRITE_CONFIG_FILES), DEFAULT_OVERWRITE_CONFIG_FILES); this.syncOnceType = PropertiesUtil.toString(props.get(PROP_SYNC_ONCE_TYPE), SYNC_ONCE_DISABLED); generateFiles(); Long expectedSyncOnceTime = null; if (this.willSyncOnce) { expectedSyncOnceTime = PropertiesUtil.toLong(props.get(PROP_SYNC_ONCE_EXPECTED_TIME), DEFAULT_SYNC_ONCE_EXPECTED_TIME); } this.serviceSettings.addSyncRoot(this.localDir, expectedSyncOnceTime); }    }