List of usage examples for org.apache.commons.configuration Configuration addProperty
void addProperty(String key, Object value);
From source file:cz.cas.lib.proarc.common.export.Kramerius4ExportOptionsTest.java
@Test public void testFrom() { Configuration config = new BaseConfiguration(); String[] excludes = { "ID1", "ID2", "ID3" }; config.addProperty(Kramerius4ExportOptions.PROP_EXCLUDE_DATASTREAM_ID, excludes); config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID1", "NEWID1"); config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID2", "NEWID2"); String policy = "policy:public"; config.addProperty(Kramerius4ExportOptions.PROP_POLICY, policy); Kramerius4ExportOptions result = Kramerius4ExportOptions.from(config); assertEquals(new HashSet<String>(Arrays.asList(excludes)), result.getExcludeDatastreams()); assertEquals("NEWID1", result.getDsIdMap().get("ID1")); assertEquals("NEWID2", result.getDsIdMap().get("ID2")); assertEquals(policy, result.getPolicy()); }
From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.config.BlueprintsNeo4jConfig.java
@Override public void putDefaultConfiguration(Configuration currentConfiguration, File dbLocation) { if (currentConfiguration.getString("blueprints.neo4j.directory") == null) { currentConfiguration.addProperty("blueprints.neo4j.directory", dbLocation.getAbsolutePath()); }/*from w w w. j a va 2s. com*/ }
From source file:eagle.storage.jdbc.criteria.TestTorque.java
public void setUp() throws TorqueException { Configuration configuration = new BaseConfiguration(); configuration.addProperty("torque.database.default", "eagle"); configuration.addProperty("torque.database.eagle.adapter", "mysql"); configuration.addProperty("torque.dsfactory.eagle.factory", "org.apache.torque.dsfactory.SharedPoolDataSourceFactory"); configuration.addProperty("torque.dsfactory.eagle.connection.driver", "org.gjt.mm.mysql.Driver"); configuration.addProperty("torque.dsfactory.eagle.connection.url", "jdbc:mysql://localhost:3306/eagle"); configuration.addProperty("torque.dsfactory.eagle.connection.user", "eagle"); configuration.addProperty("torque.dsfactory.eagle.connection.password", "eagle"); Torque.init(configuration);/*from www . j a va 2 s. c o m*/ }
From source file:com.comcast.viper.flume2storm.location.DynamicLocationServiceConfigurationTest.java
/** * Test building {@link DynamicLocationServiceConfiguration} from a * {@link Configuration} object// w w w. j av a 2 s. c o m * * @throws F2SConfigurationException */ @Ignore @Test public void testFromConfiguration() throws F2SConfigurationException { String connectionStr = "host1.whatever.org"; int sessionTimeout = 1111; int connectionTimeout = 2222; int reconnectionDelay = 3333; int terminationTimeout = 4444; String basePath = "/whatever"; String serviceName = "yo"; Configuration config = new BaseConfiguration(); config.addProperty(DynamicLocationServiceConfiguration.CONNECTION_STRING, connectionStr); config.addProperty(DynamicLocationServiceConfiguration.SESSION_TIMEOUT, sessionTimeout); config.addProperty(DynamicLocationServiceConfiguration.CONNECTION_TIMEOUT, connectionTimeout); config.addProperty(DynamicLocationServiceConfiguration.RECONNECTION_DELAY, reconnectionDelay); config.addProperty(DynamicLocationServiceConfiguration.TERMINATION_TIMEOUT, terminationTimeout); config.addProperty(DynamicLocationServiceConfiguration.BASE_PATH, basePath); config.addProperty(DynamicLocationServiceConfiguration.TERMINATION_TIMEOUT, serviceName); DynamicLocationServiceConfiguration dlsConfiguration = DynamicLocationServiceConfiguration.from(config); Assert.assertEquals(connectionStr, dlsConfiguration.getConnectionStr()); Assert.assertEquals(sessionTimeout, dlsConfiguration.getSessionTimeout()); Assert.assertEquals(connectionTimeout, dlsConfiguration.getConnectionTimeout()); Assert.assertEquals(reconnectionDelay, dlsConfiguration.getReconnectionDelay()); Assert.assertEquals(terminationTimeout, dlsConfiguration.getTerminationTimeout()); Assert.assertEquals(basePath, dlsConfiguration.getBasePath()); Assert.assertEquals(serviceName, dlsConfiguration.getServiceName()); }
From source file:com.comcast.viper.flume2storm.connection.KryoNetConnectionParametersTest.java
/** * Test {@link KryoNetConnectionParameters} with a full configuration * // w ww. j a va2s . co m * @throws F2SConfigurationException * If the configuration is invalid */ @Test public void testFromConfiguration() throws F2SConfigurationException { String hostname = RandomStringUtils.randomAlphabetic(10); int port = TestUtils.getRandomPositiveInt(65000); int objectBufferSize = TestUtils.getRandomPositiveInt(100000); int writeBufferSize = TestUtils.getRandomPositiveInt(100000); Configuration config = new BaseConfiguration(); config.addProperty(KryoNetConnectionParameters.ADDRESS, hostname); config.addProperty(KryoNetConnectionParameters.PORT, port); config.addProperty(KryoNetConnectionParameters.OBJECT_BUFFER_SZ, objectBufferSize); config.addProperty(KryoNetConnectionParameters.WRITE_BUFFER_SZ, writeBufferSize); KryoNetConnectionParameters params = KryoNetConnectionParameters.from(config); Assert.assertEquals(hostname, params.getAddress()); Assert.assertEquals(port, params.getPort()); Assert.assertEquals(objectBufferSize, params.getObjectBufferSize()); Assert.assertEquals(writeBufferSize, params.getWriteBufferSize()); }
From source file:com.linkedin.pinot.server.integration.HelixStarterTest.java
@Test public void testSingleHelixServerStartAndTakingSegment() throws Exception { Configuration pinotHelixProperties = new PropertiesConfiguration(); pinotHelixProperties.addProperty("pinot.server.instance.id", "localhost:0000"); ServerConf serverConf = DefaultHelixStarterServerConfig.getDefaultHelixServerConfig(pinotHelixProperties); ServerInstance serverInstance = new ServerInstance(); serverInstance.init(serverConf, new MetricsRegistry()); serverInstance.start();/*w ww . j a v a 2 s . c o m*/ File segmentDir0 = new File(INDEX_DIR, "segment0"); setupSegment(segmentDir0, "testTable0"); File[] segment0Files = segmentDir0.listFiles(); Assert.assertNotNull(segment0Files); File segmentDir1 = new File(INDEX_DIR, "segment1"); setupSegment(segmentDir1, "testTable1"); File[] segment1Files = segmentDir1.listFiles(); Assert.assertNotNull(segment1Files); File segmentDir2 = new File(INDEX_DIR, "segment2"); setupSegment(segmentDir2, "testTable2"); File[] segment2Files = segmentDir2.listFiles(); Assert.assertNotNull(segment2Files); DataManager instanceDataManager = serverInstance.getInstanceDataManager(); instanceDataManager.addSegment( columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment0Files[0].getAbsolutePath()), null, null); instanceDataManager.addSegment( columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment1Files[0].getAbsolutePath()), null, null); instanceDataManager.addSegment( columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment2Files[0].getAbsolutePath()), null, null); }
From source file:com.linkedin.pinot.core.segment.index.converter.SegmentV1V2ToV3FormatConverterTest.java
@BeforeMethod public void setUp() throws Exception { INDEX_DIR = Files.createTempDirectory(SegmentV1V2ToV3FormatConverter.class.getName() + "_segmentDir") .toFile();// w w w . j a v a 2 s .co m final String filePath = TestUtils.getFileFromResourceUrl( SegmentV1V2ToV3FormatConverter.class.getClassLoader().getResource(AVRO_DATA)); // intentionally changed this to TimeUnit.Hours to make it non-default for testing final SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGenSpecWithSchemAndProjectedColumns( new File(filePath), INDEX_DIR, "daysSinceEpoch", TimeUnit.HOURS, "testTable"); config.setSegmentNamePostfix("1"); config.setTimeColumnName("daysSinceEpoch"); final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null); driver.init(config); driver.build(); segmentDirectory = new File(INDEX_DIR, driver.getSegmentName()); File starTreeFile = new File(segmentDirectory, V1Constants.STAR_TREE_INDEX_FILE); FileUtils.touch(starTreeFile); FileUtils.writeStringToFile(starTreeFile, "This is a star tree index"); Configuration tableConfig = new PropertiesConfiguration(); tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1"); v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig); tableConfig.clear(); tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3"); v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig); }
From source file:ai.grakn.graql.internal.analytics.DegreeAndPersistVertexProgram.java
@Override public void storeState(final Configuration configuration) { super.storeState(configuration); ofTypeNames.forEach(type -> configuration.addProperty(OF_TYPE_NAMES + "." + type, type)); }
From source file:grakn.core.graql.analytics.DegreeVertexProgram.java
@Override public void storeState(final Configuration configuration) { super.storeState(configuration); ofLabelIds.forEach(type -> configuration.addProperty(OF_LABELS + "." + type, type)); }
From source file:com.comcast.viper.flume2storm.spout.FlumeSpoutConfigurationTest.java
/** * Test invalid argument for//from www . j a va 2s .co m * {@link FlumeSpoutConfiguration#setLocationServiceFactoryClassName(String)} * * @throws F2SConfigurationException * If value is invalid */ @Test(expected = F2SConfigurationException.class) public void testLocationServiceFactoryClassName3() throws F2SConfigurationException { Configuration config = new BaseConfiguration(); config.addProperty(FlumeSpoutConfiguration.LOCATION_SERVICE_FACTORY_CLASS, "not-a-class"); FlumeSpoutConfiguration.from(config); }