use of org.testng.annotations.BeforeTest in project pinot by linkedin.
the class SegmentAssignmentStrategyTest method setup.
@BeforeTest
public void setup() throws Exception {
_zookeeperInstance = ZkStarter.startLocalZkServer();
_zkClient = new ZkClient(ZK_SERVER);
final String zkPath = "/" + HELIX_CLUSTER_NAME;
if (_zkClient.exists(zkPath)) {
_zkClient.deleteRecursive(zkPath);
}
final String instanceId = "localhost_helixController";
_pinotHelixResourceManager = new PinotHelixResourceManager(ZK_SERVER, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/
false);
_pinotHelixResourceManager.start();
final String helixZkURL = HelixConfig.getAbsoluteZkPathForHelix(ZK_SERVER);
_helixZkManager = HelixSetupUtils.setup(HELIX_CLUSTER_NAME, helixZkURL, instanceId, /*isUpdateStateModel=*/
false);
_helixAdmin = _helixZkManager.getClusterManagmentTool();
ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZK_SERVER, _numServerInstance, true);
ControllerRequestBuilderUtil.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZK_SERVER, _numBrokerInstance, true);
Thread.sleep(3000);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size(), _numServerInstance);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_REALTIME").size(), _numServerInstance);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), _numBrokerInstance);
}
use of org.testng.annotations.BeforeTest in project pinot by linkedin.
the class PinotResourceManagerTest method setup.
@BeforeTest
public void setup() throws Exception {
_zookeeperInstance = ZkStarter.startLocalZkServer();
_zkClient = new ZkClient(ZK_SERVER);
final String instanceId = "localhost_helixController";
_pinotHelixResourceManager = new PinotHelixResourceManager(ZK_SERVER, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/
false);
_pinotHelixResourceManager.start();
final String helixZkURL = HelixConfig.getAbsoluteZkPathForHelix(ZK_SERVER);
_helixZkManager = HelixSetupUtils.setup(HELIX_CLUSTER_NAME, helixZkURL, instanceId, /*isUpdateStateModel=*/
false);
_helixAdmin = _helixZkManager.getClusterManagmentTool();
/////////////////////////
_numInstance = 1;
ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZK_SERVER, _numInstance, true);
ControllerRequestBuilderUtil.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZK_SERVER, 1, true);
Thread.sleep(3000);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 1);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size(), 1);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_REALTIME").size(), 1);
// Adding table
String OfflineTableConfigJson = ControllerRequestBuilderUtil.buildCreateOfflineTableJSON(TABLE_NAME, null, null, 1).toString();
AbstractTableConfig offlineTableConfig = AbstractTableConfig.init(OfflineTableConfigJson);
_pinotHelixResourceManager.addTable(offlineTableConfig);
}
use of org.testng.annotations.BeforeTest in project pinot by linkedin.
the class TestSumStarTreeIndexBackwardCompatibilityTest method setup.
@BeforeTest
void setup() throws Exception {
String compressedIndex = TestUtils.getFileFromResourceUrl(TestSumStarTreeIndexBackwardCompatibilityTest.class.getClassLoader().getResource("data/starTreeSegment.tar.gz"));
_tmpDir = new File(_tmpDirName);
if (_tmpDir.exists()) {
FileUtils.deleteQuietly(_tmpDir);
}
TarGzCompressionUtils.unTar(new File(compressedIndex), _tmpDir);
File segmentFile = _tmpDir.listFiles()[0];
_segment = Loaders.IndexSegment.load(segmentFile, ReadMode.heap);
}
use of org.testng.annotations.BeforeTest in project pinot by linkedin.
the class ThirdeyePinotSchemaUtilsTest method setup.
@BeforeTest
public void setup() {
props = new Properties();
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TABLE_NAME.toString(), "collection");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_DIMENSION_NAMES.toString(), "d1,d2,d3");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_NAMES.toString(), "m1,m2");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_METRIC_TYPES.toString(), "INT,INT");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TIMECOLUMN_NAME.toString(), "hoursSinceEpoch");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_DIMENSION_NAMES.toString(), "d2");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_METRICS.toString() + ".d2", "m1,m2");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_TOPK_KVALUES.toString() + ".d2", "20,30");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_WHITELIST_DIMENSION_NAMES.toString(), "d1,d2");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_WHITELIST_DIMENSION.toString() + ".d1", "x,y");
props.setProperty(ThirdEyeConfigProperties.THIRDEYE_WHITELIST_DIMENSION.toString() + ".d2", "a");
thirdeyeConfig = ThirdEyeConfig.fromProperties(props);
}
use of org.testng.annotations.BeforeTest in project pinot by linkedin.
the class BaseMultiValueQueriesTest method buildSegment.
@BeforeTest
public void buildSegment() throws Exception {
FileUtils.deleteQuietly(INDEX_DIR);
// Get resource file path.
URL resource = getClass().getClassLoader().getResource(AVRO_DATA);
Assert.assertNotNull(resource);
String filePath = resource.getFile();
// Build the segment schema.
Schema schema = new Schema.SchemaBuilder().setSchemaName("testTable").addMetric("column1", FieldSpec.DataType.INT).addMetric("column2", FieldSpec.DataType.INT).addSingleValueDimension("column3", FieldSpec.DataType.STRING).addSingleValueDimension("column5", FieldSpec.DataType.STRING).addMultiValueDimension("column6", FieldSpec.DataType.INT).addMultiValueDimension("column7", FieldSpec.DataType.INT).addSingleValueDimension("column8", FieldSpec.DataType.INT).addMetric("column9", FieldSpec.DataType.INT).addMetric("column10", FieldSpec.DataType.INT).addTime("daysSinceEpoch", TimeUnit.DAYS, FieldSpec.DataType.INT).build();
// Create the segment generator config.
SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(schema);
segmentGeneratorConfig.setInputFilePath(filePath);
segmentGeneratorConfig.setTableName("testTable");
segmentGeneratorConfig.setOutDir(INDEX_DIR.getAbsolutePath());
segmentGeneratorConfig.setInvertedIndexCreationColumns(Arrays.asList("column3", "column7", "column8", "column9"));
// Build the index segment.
SegmentIndexCreationDriver driver = new SegmentIndexCreationDriverImpl();
driver.init(segmentGeneratorConfig);
driver.build();
}
Aggregations