示例#1
0
  public void testConfigure_CustomStepMissing() throws Exception {

    JavaActor actor = new JavaActor();
    actor.setName("MultiplyActor");
    MultiplyBean bean = new MultiplyBean();
    actor.setWrappedBean(bean);
    actor.setStepMethod("customStepMissing");
    actor.setApplicationContext(_context);
    actor.afterPropertiesSet();
    actor.elaborate();

    Exception exception = null;
    try {
      actor.configure();
    } catch (ActorDeclarationException e) {
      exception = e;
    }
    assertNotNull(exception);
    assertEquals(
        "org.restflow.exceptions.ActorDeclarationException: "
            + "Error finding declared method customStepMissing "
            + "on bean class org.restflow.actors.TestJavaActor$MultiplyBean "
            + "for actor MultiplyActor",
        exception.toString());
    Throwable cause = exception.getCause();
    assertNotNull(cause);
    assertEquals(
        "java.lang.NoSuchMethodException: "
            + "org.restflow.actors.TestJavaActor$MultiplyBean.customStepMissing()",
        cause.toString());
  }
示例#2
0
  public void testConfigure_CustomStep() throws Exception {

    JavaActor actor = new JavaActor();
    MultiplyBean bean = new MultiplyBean();
    actor.setStepMethod("customStep");
    actor.setWrappedBean(bean);
    Yaml yaml = new Yaml();
    actor.setInputs((Map<String, Object>) yaml.load("originalValue:" + EOL));
    actor.setApplicationContext(_context);
    actor.afterPropertiesSet();
    actor.elaborate();

    actor.configure();
    actor.initialize();
    actor.setInputValue("originalValue", 1);

    assertFalse(bean.stepped);
    actor.step();
    assertTrue(bean.stepped);
    assertTrue(bean.customStep);
  }