use of org.apache.rya.export.MergeToolConfiguration in project incubator-rya by apache.
the class MergeConfigurationCLITest method testCreate1ConfigurationFromFile.
@Test
public void testCreate1ConfigurationFromFile() throws MergeConfigurationException, JAXBException {
final MergeToolConfiguration conf = MergeConfigurationCLI.createConfigurationFromFile(new File("conf/config.xml"));
assertEquals("10.10.10.100", conf.getParentHostname());
assertEquals("accumuloUsername", conf.getParentUsername());
assertEquals("accumuloPassword", conf.getParentPassword());
assertEquals("accumuloInstance", conf.getParentRyaInstanceName());
assertEquals("rya_demo_export_", conf.getParentTablePrefix());
assertEquals("http://10.10.10.100:8080", conf.getParentTomcatUrl());
assertEquals(DBType.ACCUMULO, conf.getParentDBType());
assertEquals(1111, conf.getParentPort());
assertEquals("10.10.10.101", conf.getChildHostname());
assertEquals("rya_demo_child", conf.getChildRyaInstanceName());
assertEquals("rya_demo_export_", conf.getChildTablePrefix());
assertEquals("http://10.10.10.101:8080", conf.getChildTomcatUrl());
assertEquals(DBType.MONGO, conf.getChildDBType());
assertEquals(27017, conf.getChildPort());
assertEquals(MergePolicy.TIMESTAMP, conf.getMergePolicy());
assertEquals(Boolean.FALSE, conf.isUseNtpServer());
assertEquals(null, conf.getNtpServerHost());
}
use of org.apache.rya.export.MergeToolConfiguration in project incubator-rya by apache.
the class MergeConfigurationCLI method createConfigurationFromFile.
public static MergeToolConfiguration createConfigurationFromFile(final File configFile) throws MergeConfigurationException {
try {
final JAXBContext context = JAXBContext.newInstance(DBType.class, MergeToolConfiguration.class, AccumuloMergeToolConfiguration.class, TimestampMergePolicyConfiguration.class, MergePolicy.class, InstanceType.class);
final Unmarshaller unmarshaller = context.createUnmarshaller();
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
XmlFactoryConfiguration.harden(dbf);
final DocumentBuilder db = dbf.newDocumentBuilder();
return unmarshaller.unmarshal(db.parse(configFile), MergeToolConfiguration.class).getValue();
} catch (final JAXBException | IllegalArgumentException | ParserConfigurationException | SAXException | IOException JAXBe) {
throw new MergeConfigurationException("Failed to create a config based on the provided configuration.", JAXBe);
}
}
Aggregations