assertSame(inst.getProcess() , p );
assertEquals(inst.getPreviousState() , 0);
assertEquals(inst.getState() , 1);
// Assert the Root ScopeDAO
ScopeDAO rs = inst.getRootScope();
assertNotNull( rs );
assertNotNull(rs.getChildScopes());
ScopeDAO child1 = null;
for ( ScopeDAO childItr : rs.getChildScopes()){
child1 = childItr;
break;
}
assertNotNull(child1);
assertNotNull(rs.getCorrelationSets());
assertEquals(rs.getCorrelationSets().size() , 0 );
assertEquals(rs.getModelId(),1);
assertEquals(rs.getName(),"Root");
assertTrue(rs.getParentScope() == null);
assertNotNull(rs.getPartnerLinks());
assertEquals(rs.getPartnerLinks().size() ,0);
assertSame(rs.getProcessInstance(),inst);
assertNotNull(rs.getScopeInstanceId());
assertEquals(rs.getState(),ScopeStateEnum.ACTIVE);
assertNotNull(rs.getVariables());
assertEquals(rs.getVariables().size(),0);
// Assert the ActivityRecoveryDAO
assertNotNull(inst.getActivityRecoveries());
ActivityRecoveryDAO rec1 = null;
for (ActivityRecoveryDAO recItr : inst.getActivityRecoveries()) {
rec1 = recItr;
break;
}
assertNotNull(rec1);
String tmpAct = rec1.getActions();
// assertEquals(rec1.getActionsList(),actions);
assertEquals(rec1.getActivityId(),3);
assertEquals(rec1.getChannel(),"testChannel1");
assertNotNull(rec1.getDateTime());
// assertNotNull(rec1.getDetails());
assertEquals(rec1.getReason(),"testReason1");
assertEquals(rec1.getRetries(),2);
// Assert the CorrelationSetDAO
//assertNotNull(inst.getCorrelationSets());
//CorrelationSetDAO cs1 = null;
//for ( CorrelationSetDAO csItr : inst.getCorrelationSets() ) {
// cs1 = csItr;
// break;
//}
//assertNotNull(cs1);
// Assert the FaultDAO
FaultDAO fault = inst.getFault();
assertNotNull(fault);
assertEquals(fault.getActivityId(),1);
assertNotNull(fault.getData());
assertEquals(fault.getExplanation(),"testExplanation");
assertEquals(fault.getLineNo(),1);
assertEquals(fault.getName(),new QName(TEST_NS,"testFault"));
// Assert MessageExchangeDAO
CorrelatorDAO ic = inst.getInstantiatingCorrelator();
assertNotNull(ic);
assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
// The message is dequeued but not persisted
MessageExchangeDAO me = ic.dequeueMessage(key1);
assertNotNull(me);
assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
assertEquals(me.getPropagateTransactionFlag(),false);
assertEquals(me.getChannel(),"testChannel");
assertEquals(me.getCorrelationId(),"testCorrelationId");
//assertNotNull(me.getCreateTime());
assertEquals(me.getDirection(),'0');
assertNotNull(me.getEPR());
assertEquals(me.getFault().toString(),"testFault");
assertEquals(me.getFaultExplanation(),"testFaultExplanation");
assertSame(me.getInstance(),inst);
assertEquals(me.getOperation(),"testOperation");
assertNotNull(me.getPartnerLink());
assertEquals(me.getPartnerLinkModelId(),1);
assertEquals(me.getPattern(),"testPattern");
assertEquals(me.getPortType(),new QName(TEST_NS,"testPortType"));
assertSame(me.getProcess(),p);
assertEquals(me.getProperty("testProp1Key"),"testProp1");
assertNotNull(me.getRequest());
assertNotNull(me.getResponse());
assertEquals(me.getStatus(),"testStatus");
// Assert MessageDAO
MessageDAO m = me.getRequest();
assertNotNull(m.getData());
assertSame(m.getMessageExchange(),me);
assertEquals(m.getType(),new QName(TEST_NS,"testRequest"));
//Assert Child ScopeDAO
assertNotNull(inst.getScopes());
assertTrue(inst.getScopes().size() > 0);
assertNotNull(inst.getScopes("Child1"));
assertTrue(inst.getScopes("Child1").size() == 1);
ScopeDAO childS = inst.getScopes("Child1").iterator().next();
assertSame(childS,child1);
assertSame(childS.getParentScope(),rs);
assertNotNull(childS.getChildScopes());
assertEquals(childS.getChildScopes().size(), 0);
assertNotNull(childS.getVariables());
assertTrue(childS.getVariables().size() > 0);
assertNotNull(childS.getVariable("var1"));
XmlDataDAO chsVar = childS.getVariable("var1");
assertNotNull(childS.getPartnerLinks());
assertTrue(childS.getPartnerLinks().size() > 0);
PartnerLinkDAO spl = childS.getPartnerLinks().iterator().next();
assertSame(spl,me.getPartnerLink());
assertSame(spl,childS.getPartnerLink(spl.getPartnerLinkModelId()));
assertNotNull(childS.getCorrelationSets());
assertTrue(childS.getCorrelationSets().size() > 0);
assertNotNull(childS.getCorrelationSet("TestCorrelationSet1"));
// Assert CorrelationSetDAO
CorrelationSetDAO cs = childS.getCorrelationSet("TestCorrelationSet1");
assertEquals(cs.getName(),"TestCorrelationSet1");
assertNotNull(cs.getProperties());
assertTrue(cs.getProperties().size() > 0);
assertSame(cs.getScope(),childS);
assertNotNull(cs.getValue());