Example #1
0
  @BeforeClass
  public void setup() throws Exception {
    TableDataManagerProvider.setServerMetrics(new ServerMetrics(new MetricsRegistry()));

    File confDir = new File(QueryExecutorTest.class.getClassLoader().getResource("conf").toURI());
    setupSegmentList(2);
    // ServerBuilder serverBuilder = new ServerBuilder(confDir.getAbsolutePath());
    String configFilePath = confDir.getAbsolutePath();

    // build _serverConf
    PropertiesConfiguration serverConf = new PropertiesConfiguration();
    serverConf.setDelimiterParsingDisabled(false);
    serverConf.load(new File(configFilePath, PINOT_PROPERTIES));

    FileBasedInstanceDataManager instanceDataManager =
        FileBasedInstanceDataManager.getInstanceDataManager();
    instanceDataManager.init(
        new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
    instanceDataManager.start();

    for (int i = 0; i < 2; ++i) {
      instanceDataManager.getTableDataManager("midas");
      instanceDataManager.getTableDataManager("midas").addSegment(_indexSegmentList.get(i));
    }
    _queryExecutor = new ServerQueryExecutorV1Impl();
    _queryExecutor.init(
        serverConf.subset("pinot.server.query.executor"),
        instanceDataManager,
        new ServerMetrics(new MetricsRegistry()));
  }
  @BeforeClass
  public void setup() throws Exception {
    CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");

    setupSegmentFor("testTable");
    setUpTestQueries("testTable");

    final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
    serverConf.setDelimiterParsingDisabled(false);

    final FileBasedInstanceDataManager instanceDataManager =
        FileBasedInstanceDataManager.getInstanceDataManager();
    instanceDataManager.init(
        new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
    instanceDataManager.start();

    System.out.println(
        "************************** : " + new File(INDEX_DIR, "segment").getAbsolutePath());
    File segmentFile = new File(INDEX_DIR, "segment").listFiles()[0];
    segmentName = segmentFile.getName();
    final IndexSegment indexSegment = ColumnarSegmentLoader.load(segmentFile, ReadMode.heap);
    instanceDataManager.getTableDataManager("testTable");
    instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);

    QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
    QUERY_EXECUTOR.init(
        serverConf.subset("pinot.server.query.executor"),
        instanceDataManager,
        new ServerMetrics(new MetricsRegistry()));
  }
  public ModuleContainer(File directory) throws Exception {
    this.directory = directory;
    this.config = new PropertiesConfiguration(new File(directory, "module.conf"));

    String[] jars = config.getStringArray("jars");
    URL[] urls = new URL[jars.length];
    for (int i = 0; i < jars.length; i++) {
      urls[i] = new URL("file:" + new File(directory, jars[i]).getPath());
    }

    urlClassLoader = new URLClassLoader(urls);
    Class<?> classApp = Class.forName(config.getString("moduleClass"), true, urlClassLoader);
    Object object = classApp.newInstance();
    module = (Module) object;
    defaultTopologyConfig = config.subset("defaultTopology");
    defaultAlgorithmConfiguration = new File(config.getString("defaultAlgorithmConfiguration"));
  }