org.apache.commons.configuration2.convert.LegacyListDelimiterHandler Java Examples
The following examples show how to use
org.apache.commons.configuration2.convert.LegacyListDelimiterHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableSyncher.java From obevo with Apache License 2.0 | 6 votes |
public void execute(DbFileMergerArgs args) { Configuration config; try { config = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class) .configure(new Parameters().properties() .setFile(args.getDbMergeConfigFile()) .setListDelimiterHandler(new LegacyListDelimiterHandler(',')) ).getConfiguration(); } catch (ConfigurationException e) { throw new RuntimeException(e); } RichIterable<DbMergeInfo> dbMergeInfos = DbMergeInfo.parseFromProperties(config); RichIterable<TableSyncSide> tableSyncSides = dbMergeInfos.collect(new Function<DbMergeInfo, TableSyncSide>() { @Override public TableSyncSide valueOf(DbMergeInfo dbMergeInfo) { DataSource ds = ds(dbMergeInfo.getDriverClassName(), dbMergeInfo.getUrl(), dbMergeInfo.getUsername(), dbMergeInfo.getPassword()); return new TableSyncSide(ds, PhysicalSchema.parseFromString(dbMergeInfo.getPhysicalSchema())); } }); this.syncSchemaTables(DbPlatformConfiguration.getInstance().valueOf(config.getString("dbType")), tableSyncSides, args.getOutputDir()); }
Example #2
Source File: DbFileMerger.java From obevo with Apache License 2.0 | 6 votes |
public void execute(DbFileMergerArgs args) { PropertiesConfiguration config; RichIterable<DbMergeInfo> dbNameLocationPairs; try { config = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class) .configure(new Parameters().properties() .setFile(args.getDbMergeConfigFile()) .setListDelimiterHandler(new LegacyListDelimiterHandler(',')) ) .getConfiguration(); dbNameLocationPairs = DbMergeInfo.parseFromProperties(config); } catch (Exception e) { throw new DeployerRuntimeException("Exception reading configs from file " + args.getDbMergeConfigFile(), e); } Platform dialect = PlatformConfiguration.getInstance().valueOf(config.getString("dbType")); this.generateDiffs(dialect, dbNameLocationPairs, args.getOutputDir()); }
Example #3
Source File: TestCompositeConfiguration.java From commons-configuration with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { cc = new CompositeConfiguration(); final ListDelimiterHandler listHandler = new LegacyListDelimiterHandler(','); conf1 = new PropertiesConfiguration(); conf1.setListDelimiterHandler(listHandler); final FileHandler handler1 = new FileHandler(conf1); handler1.setFileName(testProperties); handler1.load(); conf2 = new PropertiesConfiguration(); conf2.setListDelimiterHandler(listHandler); final FileHandler handler2 = new FileHandler(conf2); handler2.setFileName(testProperties2); handler2.load(); xmlConf = new XMLConfiguration(); final FileHandler handler3 = new FileHandler(xmlConf); handler3.load(new File(testPropertiesXML)); cc.setThrowExceptionOnMissing(true); }
Example #4
Source File: TestNullCompositeConfiguration.java From commons-configuration with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { cc = new CompositeConfiguration(); final ListDelimiterHandler listHandler = new LegacyListDelimiterHandler(','); conf1 = new PropertiesConfiguration(); conf1.setListDelimiterHandler(listHandler); final FileHandler handler1 = new FileHandler(conf1); handler1.setFileName(testProperties); handler1.load(); conf2 = new PropertiesConfiguration(); conf2.setListDelimiterHandler(listHandler); final FileHandler handler2 = new FileHandler(conf2); handler2.setFileName(testProperties2); handler2.load(); xmlConf = new XMLConfiguration(); final FileHandler handler3 = new FileHandler(xmlConf); handler3.load(new File(testPropertiesXML)); cc.setThrowExceptionOnMissing(false); }
Example #5
Source File: GryoPoolTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test public void shouldConfigPoolOnConstructionWithMultipleCustomIoRegistries() throws Exception { final Configuration conf = new BaseConfiguration(); ((BaseConfiguration) conf).setListDelimiterHandler(new LegacyListDelimiterHandler(',')); conf.setProperty(IoRegistry.IO_REGISTRY, IoXIoRegistry.InstanceBased.class.getName() + "," + IoYIoRegistry.InstanceBased.class.getName()); final GryoPool pool = GryoPool.build().ioRegistries(conf.getList(IoRegistry.IO_REGISTRY, Collections.emptyList())).create(); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoX("test"), IoX.class); assertReaderWriter(pool.takeWriter(), pool.takeReader(), new IoY(100, 200), IoY.class); }
Example #6
Source File: TestThreesomeConfiguration.java From commons-configuration with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { final PropertiesConfiguration c = new PropertiesConfiguration(); c.setListDelimiterHandler(new LegacyListDelimiterHandler(',')); final FileHandler handler = new FileHandler(c); handler.setFileName("threesome.properties"); handler.load(); conf = c; }
Example #7
Source File: TestPropertiesConfiguration.java From commons-configuration with Apache License 2.0 | 5 votes |
/** * Helper method for testing a saved configuration. Reads in the file using * a new instance and compares this instance with the original one. * * @return the newly created configuration instance * @throws ConfigurationException if an error occurs */ private PropertiesConfiguration checkSavedConfig() throws ConfigurationException { final PropertiesConfiguration checkConfig = new PropertiesConfiguration(); checkConfig.setListDelimiterHandler(new LegacyListDelimiterHandler(',')); load(checkConfig, testSavePropertiesFile.getAbsolutePath()); ConfigurationAssert.assertConfigurationEquals(conf, checkConfig); return checkConfig; }
Example #8
Source File: TestPropertiesConfiguration.java From commons-configuration with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { conf = new PropertiesConfiguration(); conf.setListDelimiterHandler(new LegacyListDelimiterHandler(',')); load(conf, testProperties); // remove the test save file if it exists if (testSavePropertiesFile.exists()) { assertTrue("Test output file could not be deleted", testSavePropertiesFile.delete()); } }
Example #9
Source File: TestPropertiesConfigurationLayout.java From commons-configuration with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { config = new LayoutTestConfiguration(); config.setListDelimiterHandler(new LegacyListDelimiterHandler(',')); layout = new PropertiesConfigurationLayout(); config.setLayout(layout); builder = new PropertiesBuilder(); }
Example #10
Source File: TestXMLConfiguration_605.java From commons-configuration with Apache License 2.0 | 5 votes |
/** * Creates a configuration with the specified content and the legacy list * delimiter handler. * * @param content the XML content * @return the newly created configuration */ private static Configuration create(final String content) throws ConfigurationException { final XMLConfiguration config = new XMLConfiguration(); config.setListDelimiterHandler(new LegacyListDelimiterHandler(',')); final FileHandler handler = new FileHandler(config); handler.load(new StringReader(content)); return config; }