@Override public FileConfiguration getConfiguration() throws ConfigurationException { return new PropertiesConfiguration(url); } }
public static PropertiesConfiguration getPropertiesConfiguration(File indexDir) { File metadataFile = SegmentDirectoryPaths.findMetadataFile(indexDir); Preconditions.checkNotNull(metadataFile, "Cannot find segment metadata file under directory: %s", indexDir); try { return new PropertiesConfiguration(metadataFile); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
/** * You can load configurations in precedence order. The first one takes * precedence over any loaded later. * * @param confURL Configuration URL */ public void loadConf(URL confURL) throws ConfigurationException { Configuration loadedConf = new PropertiesConfiguration(confURL); addConfiguration(loadedConf); }
private void createMetadataFile(File currentDir, File v3Dir) throws ConfigurationException { File v2MetadataFile = new File(currentDir, V1Constants.MetadataKeys.METADATA_FILE_NAME); File v3MetadataFile = new File(v3Dir, V1Constants.MetadataKeys.METADATA_FILE_NAME); final PropertiesConfiguration properties = new PropertiesConfiguration(v2MetadataFile); // update the segment version properties.setProperty(V1Constants.MetadataKeys.Segment.SEGMENT_VERSION, SegmentVersion.v3.toString()); properties.save(v3MetadataFile); }
public static HelixBrokerStarter startDefault() throws Exception { Configuration configuration = new PropertiesConfiguration(); int port = 5001; configuration.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, port); configuration.addProperty("pinot.broker.timeoutMs", 500 * 1000L); final HelixBrokerStarter pinotHelixBrokerStarter = new HelixBrokerStarter(null, "quickstart", "localhost:2122", configuration); return pinotHelixBrokerStarter; }
/** * This method is for reference purpose only. */ public static HelixServerStarter startDefault() throws Exception { Configuration configuration = new PropertiesConfiguration(); int port = 8003; configuration.addProperty(CommonConstants.Helix.KEY_OF_SERVER_NETTY_PORT, port); configuration.addProperty("pinot.server.instance.dataDir", "/tmp/PinotServer/test" + port + "/index"); configuration.addProperty("pinot.server.instance.segmentTarDir", "/tmp/PinotServer/test" + port + "/segmentTar"); return new HelixServerStarter("quickstart", "localhost:2191", configuration); }
@Test public void testDefaultPinotFSFactory() { _pinotFSFactory.init(new PropertiesConfiguration()); Assert.assertTrue(_pinotFSFactory.create("file") instanceof LocalPinotFS); }
public static TableDataManagerConfig getDefaultHelixTableDataManagerConfig( @Nonnull InstanceDataManagerConfig instanceDataManagerConfig, @Nonnull String tableNameWithType) { Configuration defaultConfig = new PropertiesConfiguration(); defaultConfig.addProperty(TABLE_DATA_MANAGER_NAME, tableNameWithType); defaultConfig.addProperty(TABLE_DATA_MANAGER_DATA_DIRECTORY, instanceDataManagerConfig.getInstanceDataDir() + "/" + tableNameWithType); defaultConfig.addProperty(TABLE_DATA_MANAGER_CONSUMER_DIRECTORY, instanceDataManagerConfig.getConsumerDir()); TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType); Preconditions.checkNotNull(tableType); defaultConfig.addProperty(TABLE_DATA_MANAGER_TYPE, tableType.name()); return new TableDataManagerConfig(defaultConfig); }
@BeforeClass public void setUp() { serverMetrics = new ServerMetrics(new MetricsRegistry()); channelHandlerContext = mock(ChannelHandlerContext.class, RETURNS_DEEP_STUBS); when(channelHandlerContext.channel().remoteAddress()) .thenAnswer((Answer<InetSocketAddress>) invocationOnMock -> new InetSocketAddress("localhost", 60000)); queryScheduler = mock(QueryScheduler.class); queryExecutor = new ServerQueryExecutorV1Impl(); latestQueryTime = new LongAccumulator(Long::max, 0); resourceManager = new UnboundedResourceManager(new PropertiesConfiguration()); }
@Test public void testDefaultPinotCrypter() { PinotCrypterFactory.init(new PropertiesConfiguration()); Assert.assertTrue(PinotCrypterFactory.create("NoOpPinotCrypter") instanceof NoOpPinotCrypter); Assert.assertTrue(PinotCrypterFactory.create("nooppinotcrypter") instanceof NoOpPinotCrypter); }
@Test public void testPartitionsConfig() { PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty("partitions", PARTITIONS); Set<Integer> actual = ColumnPartitionMetadata.extractPartitions(config.getList("partitions")); assertEquals(actual, PARTITIONS); }
@Test public void testLegacyPartitionRangesConfig() { PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty("partitionRanges", LEGACY_PARTITION_RANGES_STRING); Set<Integer> actual = ColumnPartitionMetadata.extractPartitions(config.getList("partitionRanges")); assertEquals(actual, PARTITIONS); } }
private Configuration getConfig(int runners, int workers) { Configuration config = new PropertiesConfiguration(); config.setProperty(ResourceManager.QUERY_RUNNER_CONFIG_KEY, runners); config.setProperty(ResourceManager.QUERY_WORKER_CONFIG_KEY, workers); return config; } }
private MultiLevelPriorityQueue createQueue() { PropertiesConfiguration conf = new PropertiesConfiguration(); return createQueue(conf, new UnboundedResourceManager(conf)); }
@Test public void testDefaultSegmentFetcherFactory() throws Exception { _segmentFetcherFactory.init(new PropertiesConfiguration()); Assert.assertTrue(_segmentFetcherFactory.containsProtocol("file")); Assert.assertTrue(_segmentFetcherFactory.containsProtocol("http")); Assert.assertFalse(_segmentFetcherFactory.containsProtocol("https")); Assert.assertFalse(_segmentFetcherFactory.containsProtocol("hdfs")); }
@Test public void testConfiguredPinotCrypter() { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); propertiesConfiguration.addProperty("class.testpinotcrypter", TestPinotCrypter.class.getName()); propertiesConfiguration.addProperty("testpinotcrypter" + "." + CONFIG_SUBSET_KEY, SAMPLE_KEYMAP_VAL); PinotCrypterFactory.init(propertiesConfiguration); Assert.assertTrue(PinotCrypterFactory.create(NoOpPinotCrypter.class.getSimpleName()) instanceof NoOpPinotCrypter); PinotCrypter testPinotCrypter = PinotCrypterFactory.create(TestPinotCrypter.class.getSimpleName()); Assert.assertTrue(testPinotCrypter instanceof TestPinotCrypter); testPinotCrypter.encrypt(null, null); }
@Test public void testCustomizedSegmentFetcherFactory() { Configuration config = new PropertiesConfiguration(); config.addProperty("class.file", LocalPinotFS.class.getName()); config.addProperty("class.test", TestPinotFS.class.getName()); PinotFSFactory.init(config); PinotFS testPinotFS = PinotFSFactory.create("test"); Assert.assertTrue(testPinotFS instanceof TestPinotFS); Assert.assertEquals(((TestPinotFS) testPinotFS).getInitCalled(), 1); Assert.assertTrue(PinotFSFactory.create("file") instanceof LocalPinotFS); }
public static Configuration getDefaultBrokerConf() { Configuration brokerConf = new PropertiesConfiguration(); // config based routing brokerConf.addProperty("pinot.broker.transport.routingMode", "HELIX"); brokerConf.addProperty("pinot.broker.routing.table.builder.default.offline.class", "balanced"); brokerConf.addProperty("pinot.broker.routing.table.builder.default.offline.numOfRoutingTables", "10"); brokerConf.addProperty("pinot.broker.routing.table.builder.tables", ""); //client properties brokerConf.addProperty("pinot.broker.client.queryPort", "8099"); // [PINOT-2435] setting to 0 so it doesn't disconnect from zk brokerConf.addProperty("pinot.broker.helix.flappingTimeWindowMs", "0"); return brokerConf; }
@Test public void testDefault() { Configuration config = new PropertiesConfiguration(); UnboundedResourceManager rm = new UnboundedResourceManager(config); assertTrue(rm.getNumQueryRunnerThreads() > 1); assertTrue(rm.getNumQueryWorkerThreads() >= 1); assertEquals(rm.getTableThreadsHardLimit(), rm.getNumQueryRunnerThreads() + rm.getNumQueryWorkerThreads()); assertEquals(rm.getTableThreadsSoftLimit(), rm.getNumQueryRunnerThreads() + rm.getNumQueryWorkerThreads()); }
private static TableDataManagerConfig getTableDataManagerConfig() throws ConfigurationException { String tableName = "testTable_R"; Configuration defaultConfig = new PropertiesConfiguration(); defaultConfig.addProperty(TABLE_DATA_MANAGER_NAME, tableName); String dataDir = "/tmp/" + tableName; defaultConfig.addProperty(TABLE_DATA_MANAGER_DATA_DIRECTORY, dataDir); defaultConfig.addProperty(READ_MODE, ReadMode.heap.toString()); defaultConfig.addProperty(TABLE_DATA_MANAGER_NUM_QUERY_EXECUTOR_THREADS, 20); TableDataManagerConfig tableDataManagerConfig = new TableDataManagerConfig(defaultConfig); defaultConfig.addProperty(TABLE_DATA_MANAGER_TYPE, "realtime"); return tableDataManagerConfig; }