public WatchOperation(Config config, WatchOperationOptions options) { super(config); this.options = options; this.localDatabase = new SqlDatabase(config); this.watchThread = null; this.syncRunning = new AtomicBoolean(false); this.syncRequested = new AtomicBoolean(false); this.stopRequested = new AtomicBoolean(false); this.pauseRequested = new AtomicBoolean(false); this.upCount = new AtomicInteger(0); this.recursiveWatcher = null; this.notificationListener = null; this.eventBus = LocalEventBus.getInstance(); this.notificationChannel = StringUtil.toHex(config.getRepoId()); this.notificationInstanceId = "" + Math.abs(new Random().nextLong()); }
@Test public void testConfigHelperLoadConfig() throws Exception { // Setup Config testConfig = TestConfigUtil.createTestLocalConfig(); // Run Config loadedConfig = ConfigHelper.loadConfig(testConfig.getLocalDir()); // Test assertNotNull(loadedConfig); assertEquals(testConfig.getAppDir(), loadedConfig.getAppDir()); assertEquals(testConfig.getCacheDir(), loadedConfig.getCacheDir()); assertNotNull(loadedConfig.getChunker()); assertEquals(testConfig.getChunker().toString(), loadedConfig.getChunker().toString()); assertNotNull(loadedConfig.getCache()); assertNotNull(loadedConfig.getConnection()); assertEquals(testConfig.getDatabaseDir(), loadedConfig.getDatabaseDir()); assertEquals(testConfig.getDatabaseFile(), loadedConfig.getDatabaseFile()); assertEquals(testConfig.getDisplayName(), loadedConfig.getDisplayName()); assertEquals(testConfig.getLocalDir(), loadedConfig.getLocalDir()); assertEquals(testConfig.getLogDir(), loadedConfig.getLogDir()); assertEquals(testConfig.getMachineName(), loadedConfig.getMachineName()); assertEquals(testConfig.getMasterKey(), loadedConfig.getMasterKey()); assertNotNull(loadedConfig.getMultiChunker()); assertNotNull(loadedConfig.getRepoId()); assertNotNull(loadedConfig.getTransformer()); // Tear down TestConfigUtil.deleteTestLocalConfigAndData(testConfig); }