context.put(O2_KEY, new DomainObject("branch2"));
context.put(O3_KEY, new DomainObject("branch3"));
}
public void testAndJoin() {
// branch 1
Activity branch1 = new Primitive(O1_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotA("a");
}
return null;
}
});
// branch 2
Primitive p21 = new Primitive(O2_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotA("aa");
}
return null;
}
});
Primitive p22 = new Primitive(O2_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotB("bb");
}
return null;
}
});
Sequence branch2=new Sequence();
branch2.addStep(p21).addStep(p22);
// branch 3
Primitive p31 = new Primitive(O3_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotA("aaa");
}
return null;
}
});
Primitive p32 = new Primitive(O3_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotB("bbb");
}
return null;
}
});
Primitive p33 = new Primitive(O3_KEY, new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject domainObject = (DomainObject) getTarget();
domainObject.setSlotC("ccc");
}
return null;
}
});
Sequence branch3=new Sequence();
branch3.addStep(p31).addStep(p32).addStep(p33);
//
AndJoin join = new AndJoin();
join.setBody(new Primitive(O1_KEY, "result", new Performer() {
public Object execute() {
if (context.containsKey(targetKey)) {
DomainObject do1=(DomainObject) getTarget();
DomainObject do2=(DomainObject) get(O2_KEY);
DomainObject do3=(DomainObject) get(O3_KEY);