msghome.create("SimpleCardRenewalTest", smgs);
Message msg = waitForUser("SimpleCardRenewalTest");
assertNotNull("No response.", msg);
SubMessages submessagesresp = msg.getSubMessages(null,null,null);
assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 10);
assertTrue(resp.isSuccessful() == false);
assertEquals(resp.getFailInfo(), "An authentication cert, a signature cert, an authentication request and a signature request are required");
// Second fail message
smgs = new SubMessages(null,null,null);
smgs.addSubMessage(new CardRenewalRequest(11, null, null, Constants.pkcs10_1, Constants.pkcs10_2));
msghome.create("SimpleCardRenewalTest", smgs);
msg = waitForUser("SimpleCardRenewalTest");
assertNotNull(msg);
submessagesresp = msg.getSubMessages(null,null,null);
assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 11);
assertTrue(resp.isSuccessful() == false);
assertEquals(resp.getFailInfo(), "An authentication cert, a signature cert, an authentication request and a signature request are required");
// Third fail message
smgs = new SubMessages(null,null,null);
smgs.addSubMessage(new CardRenewalRequest(12, cert1, cert1, Constants.pkcs10_1, Constants.pkcs10_2));
msghome.create("SimpleCardRenewalTest", smgs);
msg = waitForUser("SimpleCardRenewalTest");
assertNotNull(msg);
submessagesresp = msg.getSubMessages(null,null,null);
assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 12);
assertTrue(resp.isSuccessful() == false);
assertEquals(resp.getFailInfo(), "Verify failed for signature request");
// Fourth fail message
smgs = new SubMessages(null,null,null);
smgs.addSubMessage(new CardRenewalRequest(12, cert1, cert2, Constants.pkcs10_1, Constants.pkcs10_2));
msghome.create("SimpleCardRenewalTest", smgs);
msg = waitForUser("SimpleCardRenewalTest");
assertNotNull(msg);
submessagesresp = msg.getSubMessages(null,null,null);
assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 12);
assertTrue(resp.isSuccessful() == false);
log.debug("resp.getFailInfo: " + resp.getFailInfo());
assertEquals("Wrong error message.", resp.getFailInfo(), "User status must be new for SimplePKCS10Test1");
// TODO: make a successful message, but user status must be set to new then
}