approvalSessionRemote.addApprovalRequest(admin1, req1, gc);
approvalSessionRemote.addApprovalRequest(admin1, req2, gc);
approvalSessionRemote.addApprovalRequest(admin1, req3, gc);
// Make som queries
Query q1 = new Query(Query.TYPE_APPROVALQUERY);
q1.add(ApprovalMatch.MATCH_WITH_APPROVALTYPE, BasicMatch.MATCH_TYPE_EQUALS, "" + req1.getApprovalType());
List result = approvalSessionRemote.query(admin1, q1, 0, 3, "cAId=" + caid, "(endEntityProfileId=" + SecConst.EMPTY_ENDENTITYPROFILE + ")");
assertTrue("Result size " + result.size(), result.size() >= 2 && result.size() <= 3);
result = approvalSessionRemote.query(admin1, q1, 1, 3, "cAId=" + caid, "(endEntityProfileId=" + SecConst.EMPTY_ENDENTITYPROFILE + ")");
assertTrue("Result size " + result.size(), result.size() >= 1 && result.size() <= 3);
result = approvalSessionRemote.query(admin1, q1, 0, 1, "cAId=" + caid, "(endEntityProfileId=" + SecConst.EMPTY_ENDENTITYPROFILE + ")");
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 = approvalSessionRemote.query(admin1, q1, 1, 3, "cAId=" + caid, "(endEntityProfileId=" + SecConst.EMPTY_ENDENTITYPROFILE + ")");
assertTrue("Result size " + result.size(), result.size() >= 1 && result.size() <= 3);
// Remove the requests