System.out.println("save");
final File file = File.createTempFile("testconf",".xml");
final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
final ScanManagerConfig bean =
new ScanManagerConfig("testSave");
final DirectoryScannerConfig dir =
new DirectoryScannerConfig("tmp");
dir.setRootDirectory(file.getParent());
FileMatch filter = new FileMatch();
filter.setFilePattern(".*");
dir.setIncludeFiles(new FileMatch[] {
filter
});
instance.setConfiguration(bean);
instance.addDirectoryScanner(dir.getName(),
dir.getRootDirectory(),
filter.getFilePattern(),
filter.getSizeExceedsMaxBytes(),
0);
instance.save();
final ScanManagerConfig loaded =
new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
assertNotNull(loaded.getScan(dir.getName()));
assertEquals(dir,loaded.getScan(dir.getName()));
assertEquals(instance.getConfiguration(),loaded);
assertEquals(instance.getConfiguration().getScan(dir.getName()),dir);
}