Package org.soybeanMilk.core.exe

Examples of org.soybeanMilk.core.exe.Invoke


  @Test
  public void parse_executables_invoke_noArgNoResult() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke exe=(Invoke)config.getExecutable("global_before");
   
    Resolver rp=exe.getResolver();
    Assert.assertEquals(DynamicResolver.class, rp.getClass());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getFactoryResolverProvider().getResolverId());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getObjectSourceResolverProvider().getResolverKey());
    Assert.assertEquals("test0", exe.getMethodName());
    Assert.assertNull(exe.getArgs());
  }
View Full Code Here


  @Test
  public void parse_executables_invoke_hasArgHasResult() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke exe=(Invoke)config.getExecutable("global_exe3");
   
    Assert.assertEquals("result", exe.getResultKey());
    Resolver rp=exe.getResolver();
    Assert.assertEquals(DynamicResolver.class, rp.getClass());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getFactoryResolverProvider().getResolverId());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getObjectSourceResolverProvider().getResolverKey());
    Assert.assertEquals("test2", exe.getMethodName());
    Assert.assertEquals(2, exe.getArgs().length);
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[0].getClass());
    Assert.assertEquals("arg0", ((KeyArg)exe.getArgs()[0]).getKey());
    Assert.assertEquals(KeyArg.class, exe.getArgs()[1].getClass());
    Assert.assertEquals("arg1", ((KeyArg)exe.getArgs()[1]).getKey());
  }
View Full Code Here

  @Test
  public void parse_executables_invoke_staticMethod() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke exe=(Invoke)config.getExecutable("m1_exe1");
   
    Assert.assertEquals("result", exe.getResultKey());
    Resolver rp=exe.getResolver();
    Assert.assertEquals(ObjectResolver.class, rp.getClass());
    Assert.assertNull(((ObjectResolver)rp).getResolverObject(null));
    Assert.assertEquals(TestResolver.class, ((ObjectResolver)rp).getResolverClass(null));
    Assert.assertEquals("staticTest", exe.getMethodName());
    Assert.assertEquals(2, exe.getArgs().length);
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[0].getClass());
    Assert.assertEquals("arg0", ((KeyArg)exe.getArgs()[0]).getKey());
    Assert.assertEquals(KeyArg.class, exe.getArgs()[1].getClass());
    Assert.assertEquals("arg1", ((KeyArg)exe.getArgs()[1]).getKey());
  }
View Full Code Here

  @Test
  public void parse_executables_invoke_xml() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke exe=(Invoke)config.getExecutable("global_exe4");
   
    Assert.assertEquals("result", exe.getResultKey());
    Resolver rp=exe.getResolver();
    Assert.assertEquals(DynamicResolver.class, rp.getClass());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getFactoryResolverProvider().getResolverId());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getObjectSourceResolverProvider().getResolverKey());
    Assert.assertEquals("test2", exe.getMethodName());
    Assert.assertEquals(2, exe.getArgs().length);
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[0].getClass());
    Assert.assertEquals("arg0", ((KeyArg)exe.getArgs()[0]).getKey());
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[1].getClass());
    Assert.assertEquals("arg1", ((KeyArg)exe.getArgs()[1]).getKey());
  }
View Full Code Here

  @Test
  public void parse_executables_invoke_xml_setArgType() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke exe=(Invoke)config.getExecutable("global_exe5");
   
    Assert.assertEquals("result", exe.getResultKey());
    Resolver rp=exe.getResolver();
    Assert.assertEquals(DynamicResolver.class, rp.getClass());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getFactoryResolverProvider().getResolverId());
    Assert.assertEquals("tr", ((DynamicResolver)rp).getObjectSourceResolverProvider().getResolverKey());
    Assert.assertEquals("test2", exe.getMethodName());
    Assert.assertEquals(4, exe.getArgs().length);
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[0].getClass());
    Assert.assertEquals("arg0", ((KeyArg)exe.getArgs()[0]).getKey());
    Assert.assertEquals(String.class, exe.getArgs()[0].getType());
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[1].getClass());
    Assert.assertEquals("arg1", ((KeyArg)exe.getArgs()[1]).getKey());
    Assert.assertEquals(Date.class, exe.getArgs()[1].getType());
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[2].getClass());
    Assert.assertEquals("arg2", ((KeyArg)exe.getArgs()[2]).getKey());
    Assert.assertEquals(int.class, exe.getArgs()[2].getType());
   
    Assert.assertEquals(KeyArg.class, exe.getArgs()[3].getClass());
    Assert.assertEquals("arg3", ((KeyArg)exe.getArgs()[3]).getKey());
    Assert.assertEquals(Integer.class, exe.getArgs()[3].getType());
  }
View Full Code Here

  public void parse_executables_invoke_breaker() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    {
      Invoke exe=(Invoke)config.getExecutable("m2_exe1");
      Assert.assertEquals("breakerKey", exe.getBreaker());
    }
   
    {
      Invoke exe=(Invoke)config.getExecutable("m2_exe2");
      Assert.assertEquals(Boolean.TRUE, exe.getBreaker());
    }
   
    {
      Invoke exe=(Invoke)config.getExecutable("m2_exe3");
      Assert.assertEquals(Boolean.FALSE, exe.getBreaker());
    }
  }
View Full Code Here

  @Test
  public void parse_executables_invoke_valueArg_withType() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Invoke invoke=(Invoke)config.getExecutable("global_valueArg");
    Arg[] args=invoke.getArgs();
   
    int idx=-1;
   
    idx++;
    Assert.assertEquals(new Byte((byte)10), args[idx].getValue(null, null, null, null));
View Full Code Here

       
        action.addExecutable(new ExecutableRefProxy(refExecutableName, getCurrentExecutablePrefix()));
      }
      else if(TAG_INVOKE.equals(tagName))
      {
        Invoke invoke=createInvokeIntance();
        setInvokeProperties(invoke,e, false);
       
        action.addExecutable(invoke);
      }
    }
View Full Code Here

   * 创建空的调用对象,用于从配置文件解析并设置其属性
   * @return
   */
  protected Invoke createInvokeIntance()
  {
    return new Invoke();
  }
View Full Code Here

   
    //创建动作
    Action action=new Action(actionName);
   
    {
      Invoke invoke=new Invoke(
          null,
          "hello",
          new Arg[]{new Arg(argKey_hello_to), new Arg(argKey_hello_repeat)},
          resultKey_hello,
          new FactoryResolverProvider(rf, resolverId));
     
      action.addExecutable(invoke);
    }
    {
      Invoke invoke=new Invoke(
          null,
          "printObject",
          new Arg[]{new Arg(resultKey_hello)},
          null,
          HelloResolver.class);
View Full Code Here

TOP

Related Classes of org.soybeanMilk.core.exe.Invoke

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.