Exemplo n.º 1
0
 protected void verifyEntityProperties(
     Entity entity,
     Cluster cluster,
     Cluster srcCluster,
     WorkflowExecutionContext.EntityOperations operation,
     HashMap<String, String> props)
     throws Exception {
   Assert.assertEquals(props.get(WorkflowExecutionArgs.ENTITY_NAME.getName()), entity.getName());
   Assert.assertEquals(
       props.get(WorkflowExecutionArgs.ENTITY_TYPE.getName()), entity.getEntityType().name());
   if (WorkflowExecutionContext.EntityOperations.REPLICATE == operation) {
     Assert.assertEquals(
         props.get(WorkflowExecutionArgs.CLUSTER_NAME.getName()),
         cluster.getName()
             + WorkflowExecutionContext.CLUSTER_NAME_SEPARATOR
             + srcCluster.getName());
   } else {
     Assert.assertEquals(
         props.get(WorkflowExecutionArgs.CLUSTER_NAME.getName()), cluster.getName());
   }
   Assert.assertEquals(
       props.get(WorkflowExecutionArgs.LOG_DIR.getName()), getLogPath(cluster, entity));
   Assert.assertEquals(props.get("falconDataOperation"), operation.name());
 }
  private static String[] getTestMessageArgs(
      EntityOperations operation,
      String wfName,
      String outputFeedNames,
      String feedInstancePaths,
      String falconInputPaths,
      String falconInputFeeds) {
    String cluster;
    if (EntityOperations.REPLICATE == operation) {
      cluster =
          BCP_CLUSTER_ENTITY_NAME
              + WorkflowExecutionContext.CLUSTER_NAME_SEPARATOR
              + CLUSTER_ENTITY_NAME;
    } else {
      cluster = CLUSTER_ENTITY_NAME;
    }

    return new String[] {
      "-" + WorkflowExecutionArgs.CLUSTER_NAME.getName(),
      cluster,
      "-" + WorkflowExecutionArgs.ENTITY_TYPE.getName(),
      ("process"),
      "-" + WorkflowExecutionArgs.ENTITY_NAME.getName(),
      PROCESS_ENTITY_NAME,
      "-" + WorkflowExecutionArgs.NOMINAL_TIME.getName(),
      NOMINAL_TIME,
      "-" + WorkflowExecutionArgs.OPERATION.getName(),
      operation.toString(),
      "-" + WorkflowExecutionArgs.INPUT_FEED_NAMES.getName(),
      (falconInputFeeds != null ? falconInputFeeds : INPUT_FEED_NAMES),
      "-" + WorkflowExecutionArgs.INPUT_FEED_PATHS.getName(),
      (falconInputPaths != null ? falconInputPaths : INPUT_INSTANCE_PATHS),
      "-" + WorkflowExecutionArgs.OUTPUT_FEED_NAMES.getName(),
      (outputFeedNames != null ? outputFeedNames : OUTPUT_FEED_NAMES),
      "-" + WorkflowExecutionArgs.OUTPUT_FEED_PATHS.getName(),
      (feedInstancePaths != null ? feedInstancePaths : OUTPUT_INSTANCE_PATHS),
      "-" + WorkflowExecutionArgs.WORKFLOW_ID.getName(),
      "workflow-01-00",
      "-" + WorkflowExecutionArgs.WORKFLOW_USER.getName(),
      FALCON_USER,
      "-" + WorkflowExecutionArgs.RUN_ID.getName(),
      "1",
      "-" + WorkflowExecutionArgs.STATUS.getName(),
      "SUCCEEDED",
      "-" + WorkflowExecutionArgs.TIMESTAMP.getName(),
      NOMINAL_TIME,
      "-" + WorkflowExecutionArgs.WF_ENGINE_URL.getName(),
      "http://*****:*****@wf-id",
      "-" + WorkflowExecutionArgs.USER_WORKFLOW_NAME.getName(),
      wfName,
      "-" + WorkflowExecutionArgs.USER_WORKFLOW_VERSION.getName(),
      WORKFLOW_VERSION,
      "-" + WorkflowExecutionArgs.USER_WORKFLOW_ENGINE.getName(),
      EngineType.PIG.name(),
      "-" + WorkflowExecutionArgs.BRKR_IMPL_CLASS.getName(),
      BROKER,
      "-" + WorkflowExecutionArgs.BRKR_URL.getName(),
      "tcp://localhost:61616?daemon=true",
      "-" + WorkflowExecutionArgs.USER_BRKR_IMPL_CLASS.getName(),
      BROKER,
      "-" + WorkflowExecutionArgs.USER_BRKR_URL.getName(),
      "tcp://localhost:61616?daemon=true",
      "-" + WorkflowExecutionArgs.BRKR_TTL.getName(),
      "1000",
      "-" + WorkflowExecutionArgs.LOG_DIR.getName(),
      LOGS_DIR,
    };
  }