Package org.soybeanMilk.core.exe

Examples of org.soybeanMilk.core.exe.Action


  @Test
  public void parse_executables_emptyName() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Action exe0=(Action)config.getExecutable("global_");
    Assert.assertNotNull(exe0);
   
    Action exe1=(Action)config.getExecutable("m1_");
    Assert.assertNotNull(exe1);
   
    Action exe2=(Action)config.getExecutable("m2_");
    Assert.assertNotNull(exe2);
  }
View Full Code Here


  @Test
  public void parse_executables_multiExecutables() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    Action exe0=(Action)config.getExecutable("another_exe1");
    Assert.assertNotNull(exe0);
   
    List<Executable> inners=exe0.getExecutables();
   
    Assert.assertEquals(2, inners.size());
   
    Assert.assertTrue( inners.get(0) == config.getExecutable("another_innerRef") );
    Assert.assertTrue( inners.get(1) == config.getExecutable("global_exe1") );
View Full Code Here

  public void parse_executables_action() throws Exception
  {
    config=new ConfigurationParser().parse("org/soybeanMilk/test/unit/core/TestConfigurationParser-main.xml");
   
    {
      Action exe=(Action)config.getExecutable("global_exe0");
      Assert.assertNull(exe.getExecutables());
    }
   
    {
      Action exe=(Action)config.getExecutable("global_exe1");
     
      Assert.assertNotNull(exe.getExecutables());
      List<Executable> children=exe.getExecutables();
      Assert.assertEquals(4, children.size());
      Assert.assertEquals(Invoke.class, children.get(0).getClass());
      Assert.assertTrue( children.get(1) == config.getExecutable("global_exe0") );
      Assert.assertTrue( children.get(2) == config.getExecutable("global_exe0") );
      Assert.assertTrue( children.get(3) == config.getExecutable("m1_exe0") );
View Full Code Here

   
    for(Executable exe : executables)
    {
      if(exe instanceof Action)
      {
        Action action=(Action)exe;
        List<Executable> actionExes=action.getExecutables();
        if(actionExes==null)
          continue;
       
        for(int i=0,len=actionExes.size();i<len;i++)
        {
          Executable e=actionExes.get(i);
         
          if(e instanceof ExecutableRefProxy)
          {
            ExecutableRefProxy proxy=((ExecutableRefProxy)e);
            Executable targetExe=getTargetRefExecutable((ExecutableRefProxy)e);
           
            if(targetExe == null)
              throw new ParseException("can not find Executable named "+SbmUtils.toString(proxy.getRefName())+" referenced in Action "+SbmUtils.toString(action.getName()));
           
            actionExes.set(i, targetExe);
          }
        }
      }
View Full Code Here

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

   
    //创建配置
    Configuration cfg=new Configuration(rf);
   
    //创建动作
    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);
     
      action.addExecutable(invoke);
    }
   
    cfg.addExecutable(action);
   
    //创建执行器
View Full Code Here

TOP

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

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.