final String serialNumber = "12344711";
setUpNonAdmin();
setupApprovals();
ApprovalRequest approvalRequest = new ViewHardTokenDataApprovalRequest(TEST_NONADMIN_USERNAME, TEST_NONADMIN_CN, serialNumber, true, reqadmin, null, 1,
0, 0);
// Setup the test
if (!hardTokenSessionRemote.existsHardToken(reqadmin, serialNumber)) {
/*
* Add an arbitrary token for the below two tests to wait for
* (should such a token not already exist due to sloppy cleanup).
*/
hardTokenSessionRemote.addHardToken(reqadmin, serialNumber, TEST_NONADMIN_USERNAME, TEST_NONADMIN_CN, SecConst.TOKEN_SWEDISHEID,
new SwedishEIDHardToken("1234", "12345678", "5678", "23456789", 1), new ArrayList<Certificate>(), null);
}
// Make sure that the ApprovalSession is clean.
cleanApprovalRequestFromApprovalSession(approvalRequest, reqadmin);
try {
try {
getHardTokenData(serialNumber, true);
assertTrue(false);
} catch (WaitingForApprovalException_Exception e) {
}
try {
getHardTokenData(serialNumber, true);
assertTrue(false);
} catch (WaitingForApprovalException_Exception e) {
}
Approval approval1 = new Approval("ap1test");
try {
approvalExecutionSession.approve(admin1, approvalRequest.generateApprovalId(), approval1, gc);
getHardTokenData(serialNumber, true);
try {
getHardTokenData(serialNumber, true);
assertTrue(false);
} catch (WaitingForApprovalException_Exception e) {
}
approvalSession.reject(admin1, approvalRequest.generateApprovalId(), approval1, gc);
try {
getHardTokenData(serialNumber, true);
assertTrue(false);
} catch (ApprovalRequestExecutionException_Exception e) {
}