Exemplo n.º 1
0
  @Test(expected = Exception.class)
  public void executeAsynchWitNullInport() throws Exception {
    configBean.setTypeOfInput("String");
    activity.configure(configBean);

    Map<String, Object> inputs = new HashMap<String, Object>();
    inputs.put(IN_FIRST_INPUT, table1);
    // inputs.put(IN_SECOND_INPUT, table2);

    Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
    expectedOutputTypes.put(OUT_SIMPLE_OUTPUT, String.class);
    expectedOutputTypes.put(OUT_REPORT, String.class);

    Map<String, Object> outputs =
        ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputTypes);

    String result = (String) outputs.get(OUT_SIMPLE_OUTPUT);

    assertTrue("Wrong output : ", result.indexOf("nrows=\"3\"") != -1);
    assertEquals("Unexpected outputs", 2, outputs.size());
    // assertEquals("/home/julian/Documentos/wf4ever/tables/join_test.xml",
    // outputs.get(OUT_SIMPLE_OUTPUT));
    assertEquals("simple-report", outputs.get(OUT_REPORT));

    // assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
    //		.get("moreOutputs"));

  }
Exemplo n.º 2
0
  @Test(expected = Exception.class)
  public void executeAsynchWithUnexistingFile() throws Exception {
    configBean.setTypeOfInput("File");
    activity.configure(configBean);

    Map<String, Object> inputs = new HashMap<String, Object>();
    inputs.put(IN_FIRST_INPUT, "/home/julian/Documentos/wf4ever/tables/filenoexist.xml");
    inputs.put(IN_SECOND_INPUT, "/home/julian/Documentos/wf4ever/tables/filenoexist2.xml");
    inputs.put(IN_OUTPUT_TABLE_NAME, "/home/julian/Documentos/wf4ever/tables/file.xml");

    Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
    expectedOutputTypes.put(OUT_SIMPLE_OUTPUT, String.class);
    expectedOutputTypes.put(OUT_REPORT, String.class);

    Map<String, Object> outputs =
        ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputTypes);

    assertEquals("Unexpected outputs", 2, outputs.size());
    assertEquals(
        "/home/julian/Documentos/wf4ever/tables/join_test.xml", outputs.get(OUT_SIMPLE_OUTPUT));
    assertEquals("simple-report", outputs.get(OUT_REPORT));

    // assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
    //		.get("moreOutputs"));

  }
 protected void executeActivity() throws Exception {
   Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
   expectedOutputTypes.put(activityOutputNames[0], byte[].class);
   expectedOutputTypes.put(activityOutputNames[1], byte[].class);
   resultMap = ActivityInvoker.invokeAsyncActivity(this.activity, inputMap, expectedOutputTypes);
 }