Package com.odiago.flumebase.exec.local

Examples of com.odiago.flumebase.exec.local.LocalEnvironment


    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery("SELECT fieldname FROM memstream",
        getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(id);
    joinFlow(id);
View Full Code Here


    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery("SELECT fieldname FROM memstream",
        getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(id);
    joinFlow(id);
View Full Code Here

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

    getSymbolTable().addSymbol(stream);
    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // Connect to the environment and run it.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

    streamBuilder.setSource("tail(\"" + sourceFilename + "\")");
    StreamSymbol inputStream = streamBuilder.build();

    getSymbolTable().addSymbol(inputStream);

    LocalEnvironment env = getEnvironment();
    env.connect();

    // Create another stream that selects 2 * any value we put into 'inputstream'.
    QuerySubmitResponse createResponse = env.submitQuery(
        "CREATE STREAM doubled AS SELECT 2 * a as b FROM inputstream",
        getQueryOpts());
    LOG.info("Create response message: " + createResponse.getMessage());
    FlowId createId = createResponse.getFlowId();
    assertNotNull(createId);

    // Select 3 * any value in doubled.

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "test6x");
    QuerySubmitResponse queryResponse = env.submitQuery(
        "SELECT 3 * b as c FROM doubled", getQueryOpts());
    LOG.info("Query response message: " + queryResponse.getMessage());
    FlowId queryId = queryResponse.getFlowId();
    assertNotNull(queryId);

View Full Code Here

    streamBuilder.setSourceType(StreamSourceType.Node);
    streamBuilder.setLocal(false);
    streamBuilder.addField("x", Type.getPrimitive(Type.TypeName.STRING));

    getSymbolTable().addSymbol(streamBuilder.build());
    LocalEnvironment env = getEnvironment();
    env.connect();

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "select-out");

    QuerySubmitResponse selectResponse = env.submitQuery(
        "SELECT * FROM inputstream",
        getQueryOpts());
    assertNotNull(selectResponse);
    FlowId queryId = selectResponse.getFlowId();
    assertNotNull(queryId);
View Full Code Here

    streamBuilder.setLocal(false);
    streamBuilder.addField("x", Type.getPrimitive(Type.TypeName.STRING));
    streamBuilder.addField("y", Type.getPrimitive(Type.TypeName.INT));

    getSymbolTable().addSymbol(streamBuilder.build());
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Test the first query.
    LOG.debug("Running first query");
    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "select-out");

    QuerySubmitResponse selectResponse1 = env.submitQuery(
        "SELECT * FROM inputstream",
        getQueryOpts());
    assertNotNull(selectResponse1);
    FlowId queryId1 = selectResponse1.getFlowId();
    assertNotNull(queryId1);

    // Put some data into the stream.
    BufferedWriter w = new BufferedWriter(new FileWriter(sourceFile));
    try {
      w.write("line1,1\n");
      w.write("line2,2\n");
      w.write("line3,3\n");
    } finally {
      w.close();
    }

    MemoryOutputElement output1 = getOutput("select-out");
    assertNotNull(output1);
    SelectableList<GenericData.Record> outRecords1 = output1.getRecords();
    synchronized (outRecords1) {
      while (outRecords1.size() < 3) {
        outRecords1.wait();
      }

      for(GenericData.Record r : outRecords1) {
        LOG.debug("query 1 got " + r.get("x"));
      }

      this.assertRecordExists(outRecords1, "x", new Utf8("line1"));
      this.assertRecordExists(outRecords1, "x", new Utf8("line2"));
      this.assertRecordExists(outRecords1, "x", new Utf8("line3"));
    }

    LOG.debug("first query SUCCESS");

    if (killFirstQuery) {
      LOG.debug("Canceling first query");
      env.cancelFlow(queryId1);
      joinFlow(queryId1);
      LOG.debug("First query canceled.");
    }

    // Test the second query.
    LOG.debug("Running second query");
    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "select-out2");

    QuerySubmitResponse selectResponse2 = env.submitQuery(
        "SELECT * FROM inputstream WHERE y = 6",
        getQueryOpts());
    assertNotNull(selectResponse2);
    FlowId queryId2 = selectResponse2.getFlowId();
    assertNotNull(queryId2);

    // Add more data to the stream.
    w = new BufferedWriter(new FileWriter(sourceFile, true));
    try {
      w.write("line4,4\n");
      w.write("line5,5\n");
      w.write("line6,6\n");
    } finally {
      w.close();
    }
   
    MemoryOutputElement output2 = getOutput("select-out2");
    assertNotNull(output2);
    SelectableList<GenericData.Record> outRecords2 = output2.getRecords();
    synchronized (outRecords2) {
      while (outRecords2.size() < 1) {
        outRecords2.wait();
      }

      for(GenericData.Record r : outRecords2) {
        LOG.debug("query 2 got " + r.get("x"));
      }

      this.assertRecordFields(outRecords2, "y", Integer.valueOf(6), "x", new Utf8("line6"));
    }
    LOG.debug("second query SUCCESS");

    if (!killFirstQuery) {
      // Double check to ensure that the first query received those additional records.
      synchronized (outRecords1) {
        while (outRecords1.size() < 6) {
          outRecords1.wait();
        }

        for(GenericData.Record r : outRecords1) {
          LOG.debug("second time around, query 1 got " + r.get("x"));
        }

        this.assertRecordExists(outRecords1, "x", new Utf8("line4"));
        this.assertRecordExists(outRecords1, "x", new Utf8("line5"));
        this.assertRecordExists(outRecords1, "x", new Utf8("line6"));
      }

      LOG.debug("first query CONTINUED SUCCESS");
      LOG.debug("Now we're killing the first query.");
      env.cancelFlow(queryId1);
      joinFlow(queryId1);
    }

    LOG.debug("Killing 2nd query.");
    env.cancelFlow(queryId2);
    joinFlow(queryId2);
  }
View Full Code Here

    getSymbolTable().addSymbol(stream);

    getConf().set(SelectStmt.CLIENT_SELECT_TARGET_KEY, "testSelect");

    // With all configuration complete, connect to the environment.
    LocalEnvironment env = getEnvironment();
    env.connect();

    // Run the query.
    QuerySubmitResponse response = env.submitQuery(query, getQueryOpts());
    FlowId id = response.getFlowId();
    assertNotNull(response.getMessage(), id);
    joinFlow(id);

    // Examine the response records.
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.exec.local.LocalEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.