@Test
public void testFilesystemCli() throws Exception {
File sourceFile = new File("/tmp/foo");
File targetFile = new File("/tmp/bar");
String[] args = new String[]{
"-source", "file://" + sourceFile,
"-target", "file://" + targetFile,
"--source-use-absolute-path",
"--target-include-base-dir"
};
CliConfig cliConfig = CliHelper.parseCliConfig(args);
SyncConfig syncConfig = CliHelper.parseSyncConfig(cliConfig, args);
Object source = syncConfig.getSource();
Assert.assertNotNull("source is null", source);
Assert.assertTrue("source is not FilesystemSource", source instanceof FilesystemConfig);
FilesystemConfig fsSource = (FilesystemConfig) source;
Object target = syncConfig.getTarget();
Assert.assertNotNull("target is null", target);
Assert.assertTrue("target is not FilesystemTarget", target instanceof FilesystemConfig);
FilesystemConfig fsTarget = (FilesystemConfig) target;
Assert.assertEquals("source file mismatch", sourceFile.getPath(), fsSource.getPath());
Assert.assertTrue("source use-absolute-path should be enabled", fsSource.isUseAbsolutePath());
Assert.assertEquals("target file mismatch", targetFile.getPath(), fsTarget.getPath());
Assert.assertTrue("target include-base-dir should be enabled", fsTarget.isIncludeBaseDir());
}