use of org.apache.syncope.client.cli.Input in project syncope by apache.
the class MigrateTest method conf.
@Test
public void conf() throws Exception {
// 1. migrate
String[] args = new String[4];
args[0] = "migrate";
args[1] = "--conf";
args[2] = BASE_PATH + File.separator + "content12.xml";
args[3] = BASE_PATH + File.separator + "MasterContent.xml";
new MigrateCommand().execute(new Input(args));
// 2. initialize db as persistence-jpa does
DataSource dataSource = new DriverManagerDataSource("jdbc:h2:mem:syncopedb;DB_CLOSE_DELAY=-1", "sa", null);
new ResourceDatabasePopulator(new ClassPathResource("/schema20.sql")).execute(dataSource);
// 3. attempt to set initial content from the migrated MasterContent.xml
SAXParserFactory factory = SAXParserFactory.newInstance();
try (InputStream in = new FileInputStream(args[3])) {
SAXParser parser = factory.newSAXParser();
parser.parse(in, new ContentLoaderHandler(dataSource, ROOT_ELEMENT, false));
}
}
Aggregations