osworkflow 练习 之 beanshell

王朝java/jsp·作者佚名  2006-01-31
窄屏简体版  字體: |||超大  

下面我将osworkflow的各个部分职能的小测试写一下,以便比较全面的掌握osworkflow。

Beanshell部分:

要把bsh的jar 包放到classpath中。

如做个简单的测试:

public class SimpleBeanShell {

private int count;

public int getCount() {

return count;

}

public void setCount(int count) {

this.count = count;

}

}

过程定义这样写一下:

<pre-functions>

<function type="beanshell">

<arg name="script">

com.littledragon.os.SimpleBeanShell sbs= transientVars.get("aaaa");

sbs.setCount(20);

</arg>

</function>

</pre-functions>

写个测试类:

测试方法如下。

public void testGetCount() throws Exception {

//long id;

SimpleBeanShell simpleBeanShell = new SimpleBeanShell();

Map inputs = new HashMap();

inputs.put("aaaa", simpleBeanShell);

Workflow wf = new BasicWorkflow("testyunguang");

wf.initialize("ospractice", 1, inputs);

int count = simpleBeanShell.getCount();

assertEquals(20, count);

}

即可看到通过beanshell方法将count值设为20,junit一路跑绿。

其他待续

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航