assertFalse(ejbcaraws.existsHardToken("23456789"));
}
protected void getHardTokenData(String serialNumber, boolean onlyOnce) throws Exception {
HardTokenDataWS hardTokenDataWS = ejbcaraws.getHardTokenData(serialNumber, true, true);
assertNotNull(hardTokenDataWS);
assertTrue("" + hardTokenDataWS.getTokenType(), hardTokenDataWS.getTokenType() == HardTokenConstants.TOKENTYPE_SWEDISHEID);
assertTrue(hardTokenDataWS.getHardTokenSN().equals(serialNumber));
assertTrue(hardTokenDataWS.getCopyOfSN(), hardTokenDataWS.getCopyOfSN() == null);
assertTrue(hardTokenDataWS.getCopies().size() == 0);
// assertTrue(hardTokenDataWS.getCertificates().size() == 2);
assertTrue(hardTokenDataWS.getPinDatas().size() == 2);
Iterator<PinDataWS> iter = hardTokenDataWS.getPinDatas().iterator();
while (iter.hasNext()) {
PinDataWS next = iter.next();
if (next.getType() == HardTokenConstants.PINTYPE_BASIC) {
assertTrue(next.getPUK().equals("12345678"));
assertTrue(next.getInitialPIN().equals("1234"));
}
if (next.getType() == HardTokenConstants.PINTYPE_SIGNATURE) {
assertTrue(next.getPUK(), next.getPUK().equals("23456789"));
assertTrue(next.getInitialPIN().equals("5678"));
}
}
if (!onlyOnce) {
hardTokenDataWS = ejbcaraws.getHardTokenData(serialNumber, false, false);
assertNotNull(hardTokenDataWS);
// assertTrue(""+ hardTokenDataWS.getCertificates().size(),
// hardTokenDataWS.getCertificates().size() == 2);
assertTrue("" + hardTokenDataWS.getPinDatas().size(), hardTokenDataWS.getPinDatas().size() == 0);
try {
ejbcaraws.getHardTokenData("12345679", false, false);
assertTrue(false);
} catch (HardTokenDoesntExistsException_Exception e) {