Package co.cask.cdap.test

Examples of co.cask.cdap.test.FlowManager


  public void test() throws TimeoutException, InterruptedException, IOException {
    // Deploy the HelloWorld application
    ApplicationManager appManager = deployApplication(HelloWorld.class);

    // Start WhoFlow
    FlowManager flowManager = appManager.startFlow("WhoFlow");

    // Send stream events to the "who" Stream
    StreamWriter streamWriter = appManager.getStreamWriter("who");
    streamWriter.send("1");
    streamWriter.send("2");
    streamWriter.send("3");
    streamWriter.send("4");
    streamWriter.send("5");

    try {
      // Wait for the last Flowlet processing 5 events, or at most 5 seconds
      RuntimeMetrics metrics = RuntimeStats.getFlowletMetrics("HelloWorld", "WhoFlow", "saver");
      metrics.waitForProcessed(5, 5, TimeUnit.SECONDS);
    } finally {
      flowManager.stop();
    }

    // Start Greeting procedure and query
    ProcedureManager procedureManager = appManager.startProcedure("Greeting");
    String response = procedureManager.getClient().query("greet", ImmutableMap.<String, String>of());
View Full Code Here


      } catch (Exception e) {
        runningProcesses.remove(flowName);
        throw Throwables.propagate(e);
      }

      return new FlowManager() {
        @Override
        public void setFlowletInstances(String flowletName, int instances) {
          Preconditions.checkArgument(instances > 0, "Instance counter should be > 0.");
          try {
            appFabricClient.setFlowletInstances(applicationId, flowName, flowletName, instances);
View Full Code Here

TOP

Related Classes of co.cask.cdap.test.FlowManager

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.