Search in sources :

Example 46 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class BaseSingleValueQueriesTest 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("column3", FieldSpec.DataType.INT).addSingleValueDimension("column5", FieldSpec.DataType.STRING).addSingleValueDimension("column6", FieldSpec.DataType.INT).addSingleValueDimension("column7", FieldSpec.DataType.INT).addSingleValueDimension("column9", FieldSpec.DataType.INT).addSingleValueDimension("column11", FieldSpec.DataType.STRING).addSingleValueDimension("column12", FieldSpec.DataType.STRING).addMetric("column17", FieldSpec.DataType.INT).addMetric("column18", 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("column6", "column7", "column11", "column17", "column18"));
    // Build the index segment.
    SegmentIndexCreationDriver driver = new SegmentIndexCreationDriverImpl();
    driver.init(segmentGeneratorConfig);
    driver.build();
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) Schema(com.linkedin.pinot.common.data.Schema) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) URL(java.net.URL) SegmentIndexCreationDriverImpl(com.linkedin.pinot.core.segment.creator.impl.SegmentIndexCreationDriverImpl) BeforeTest(org.testng.annotations.BeforeTest)

Example 47 with BeforeTest

use of org.testng.annotations.BeforeTest in project rest.li by linkedin.

the class TestMIMEWriter method setup.

@BeforeTest
public void setup() {
    _normalBodyData = "abc".getBytes();
    _normalBodyHeaders = new HashMap<String, String>();
    _normalBodyHeaders.put("simpleheader", "simplevalue");
    //Second body has no headers
    _headerLessBodyData = "def".getBytes();
    //Third body has only headers
    _bodyLessHeaders = new HashMap<String, String>();
    _normalBodyHeaders.put("header1", "value1");
    _normalBodyHeaders.put("header2", "value2");
    _normalBodyHeaders.put("header3", "value3");
    _normalBody = new MIMEDataPart(ByteString.copy(_normalBodyData), _normalBodyHeaders);
    _headerLessBody = new MIMEDataPart(ByteString.copy(_headerLessBodyData), Collections.<String, String>emptyMap());
    _bodyLessBody = new MIMEDataPart(ByteString.empty(), _bodyLessHeaders);
    _purelyEmptyBody = new MIMEDataPart(ByteString.empty(), Collections.<String, String>emptyMap());
}
Also used : MIMEDataPart(com.linkedin.multipart.utils.MIMEDataPart) ByteString(com.linkedin.data.ByteString) BeforeTest(org.testng.annotations.BeforeTest)

Example 48 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class HelixBrokerStarterTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    _zookeeperInstance = ZkStarter.startLocalZkServer();
    _zkClient = new ZkClient(ZkStarter.DEFAULT_ZK_STR);
    final String instanceId = "localhost_helixController";
    _pinotResourceManager = new PinotHelixResourceManager(ZkStarter.DEFAULT_ZK_STR, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/
    false);
    _pinotResourceManager.start();
    final String helixZkURL = HelixConfig.getAbsoluteZkPathForHelix(ZkStarter.DEFAULT_ZK_STR);
    _helixZkManager = HelixSetupUtils.setup(HELIX_CLUSTER_NAME, helixZkURL, instanceId, /*isUpdateStateModel=*/
    false);
    _helixAdmin = _helixZkManager.getClusterManagmentTool();
    Thread.sleep(3000);
    final Configuration pinotHelixBrokerProperties = DefaultHelixBrokerConfig.getDefaultBrokerConf();
    pinotHelixBrokerProperties.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, 8943);
    _helixBrokerStarter = new HelixBrokerStarter(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, pinotHelixBrokerProperties);
    Thread.sleep(1000);
    ControllerRequestBuilderUtil.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 5, true);
    ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true);
    final String tableName = "dining";
    JSONObject buildCreateOfflineTableV2JSON = ControllerRequestBuilderUtil.buildCreateOfflineTableJSON(tableName, null, null, 1);
    AbstractTableConfig config = AbstractTableConfig.init(buildCreateOfflineTableV2JSON.toString());
    _pinotResourceManager.addTable(config);
    for (int i = 1; i <= 5; i++) {
        addOneSegment(tableName);
        Thread.sleep(2000);
        final ExternalView externalView = _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(tableName));
        Assert.assertEquals(externalView.getPartitionSet().size(), i);
    }
}
Also used : ZkClient(org.I0Itec.zkclient.ZkClient) ExternalView(org.apache.helix.model.ExternalView) PinotHelixResourceManager(com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager) Configuration(org.apache.commons.configuration.Configuration) JSONObject(org.json.JSONObject) HelixBrokerStarter(com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter) AbstractTableConfig(com.linkedin.pinot.common.config.AbstractTableConfig) BeforeTest(org.testng.annotations.BeforeTest)

Example 49 with BeforeTest

use of org.testng.annotations.BeforeTest in project pinot by linkedin.

the class IntegrationTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    //Process Command Line to get config and port
    FileUtils.deleteDirectory(new File("/tmp/pinot/test1"));
    setupSegmentList();
    File confFile = new File(TestUtils.getFileFromResourceUrl(InstanceServerStarter.class.getClassLoader().getResource("conf/" + PINOT_PROPERTIES)));
    // build _serverConf
    PropertiesConfiguration serverConf = new PropertiesConfiguration();
    serverConf.setDelimiterParsingDisabled(false);
    serverConf.load(confFile);
    _serverConf = new ServerConf(serverConf);
    LOGGER.info("Trying to create a new ServerInstance!");
    _serverInstance = new ServerInstance();
    LOGGER.info("Trying to initial ServerInstance!");
    _serverInstance.init(_serverConf, new MetricsRegistry());
    LOGGER.info("Trying to start ServerInstance!");
    _serverInstance.start();
    _queryExecutor = _serverInstance.getQueryExecutor();
    FileBasedInstanceDataManager instanceDataManager = (FileBasedInstanceDataManager) _serverInstance.getInstanceDataManager();
    for (int i = 0; i < 2; ++i) {
        instanceDataManager.getTableDataManager("testTable");
        instanceDataManager.getTableDataManager("testTable").addSegment(_indexSegmentList.get(i));
    }
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerConf(com.linkedin.pinot.server.conf.ServerConf) FileBasedInstanceDataManager(com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) BeforeTest(org.testng.annotations.BeforeTest)

Example 50 with BeforeTest

use of org.testng.annotations.BeforeTest in project swagger-core by swagger-api.

the class InheritedBeanTest method setup.

@BeforeTest
public void setup() {
    modelResolver = new ModelResolver(new ObjectMapper());
    context = new ModelConverterContextImpl(modelResolver);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ModelConverterContextImpl(io.swagger.converter.ModelConverterContextImpl) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

BeforeTest (org.testng.annotations.BeforeTest)80 HashMap (java.util.HashMap)8 CommandManager (com.sun.identity.cli.CommandManager)6 Path (java.nio.file.Path)6 File (java.io.File)5 Injector (com.google.inject.Injector)4 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)4 Series (com.axibase.tsd.api.model.series.Series)3 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)3 ArrayList (java.util.ArrayList)3 Parameters (org.testng.annotations.Parameters)3 SSOException (com.iplanet.sso.SSOException)2 Schema (com.linkedin.pinot.common.data.Schema)2 SegmentGeneratorConfig (com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig)2 SegmentIndexCreationDriver (com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver)2 SegmentIndexCreationDriverImpl (com.linkedin.pinot.core.segment.creator.impl.SegmentIndexCreationDriverImpl)2 ThirdEyeConfigProperties (com.linkedin.thirdeye.hadoop.config.ThirdEyeConfigProperties)2 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)2 OrganizationConfigManager (com.sun.identity.sm.OrganizationConfigManager)2 SMSException (com.sun.identity.sm.SMSException)2