DummyApprovalRequest req1 = new DummyApprovalRequest(reqadmincert,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false); DummyApprovalRequest req2 = new DummyApprovalRequest(admincert1,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false); DummyApprovalRequest req3 = new DummyApprovalRequest(admincert2,null,3,2,false);
DummyApprovalRequest req1 = new DummyApprovalRequest(reqadmin,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false); DummyApprovalRequest req2 = new DummyApprovalRequest(admin1,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false); DummyApprovalRequest req3 = new DummyApprovalRequest(admin2,null,3,2,false);
	public void testQuery() throws Exception {				// Add a few requests		DummyApprovalRequest req1 = new DummyApprovalRequest(reqadmincert,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false);		DummyApprovalRequest req2 = new DummyApprovalRequest(admincert1,null,caid,SecConst.EMPTY_ENDENTITYPROFILE,false);		DummyApprovalRequest req3 = new DummyApprovalRequest(admincert2,null,3,2,false);				pub.addApprovalRequest(admin1, req1);		pub.addApprovalRequest(admin1, req2);		pub.addApprovalRequest(admin1, req3);				// Make som queries		Query q1 = new Query(Query.TYPE_APPROVALQUERY);		q1.add(ApprovalMatch.MATCH_WITH_APPROVALTYPE,BasicMatch.MATCH_TYPE_EQUALS,""+req1.getApprovalType());				List result = pub.query(admin1, q1, 0, 3);		assertTrue("Result size " + result.size(), result.size() == 2);				result = pub.query(admin1, q1, 1, 3);		assertTrue("Result size " + result.size(), result.size() == 1);				result = pub.query(admin1, q1, 0, 1);		assertTrue("Result size " + result.size(), result.size() == 1);				Query q2 = new Query(Query.TYPE_APPROVALQUERY);		q2.add(ApprovalMatch.MATCH_WITH_STATUS,BasicMatch.MATCH_TYPE_EQUALS,""+ApprovalDataVO.STATUS_WAITINGFORAPPROVAL,Query.CONNECTOR_AND);		q2.add(ApprovalMatch.MATCH_WITH_REQUESTADMINCERTSERIALNUMBER,BasicMatch.MATCH_TYPE_EQUALS,reqadmincert.getSerialNumber().toString(16));						result = pub.query(admin1, q1, 1, 3);		assertTrue("Result size " + result.size(), result.size() == 1);						// Remove the requests		int  id1 = ((ApprovalDataVO) pub.findApprovalDataVO(admin1, req1.generateApprovalId()).iterator().next()).getId();		int  id2 = ((ApprovalDataVO) pub.findApprovalDataVO(admin1, req2.generateApprovalId()).iterator().next()).getId();		int  id3 = ((ApprovalDataVO) pub.findApprovalDataVO(admin1, req3.generateApprovalId()).iterator().next()).getId();		pub.removeApprovalRequest(admin1, id1);		pub.removeApprovalRequest(admin1, id2);		pub.removeApprovalRequest(admin1, id3);			}