use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testGetMaxCRL.
/**
* getMaxCRL() method testing. Tests if the method return null in the case
* of not specified maxCRL criteria, and if the returned value corresponds
* to the specified one.
*/
public void testGetMaxCRL() {
X509CRLSelector selector = new X509CRLSelector();
assertNull("Initially the maxCRL should be null.", selector.getMaxCRL());
BigInteger maxCRL = new BigInteger("10000");
selector.setMaxCRLNumber(maxCRL);
assertTrue("The result should be equal to specified.", maxCRL.equals(selector.getMaxCRL()));
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testGetIssuerNames.
/**
* getIssuerNames() method testing. Tests if the method return null in the
* case of not specified issuers, if the returned collection corresponds to
* the specified issuers.
*/
public void testGetIssuerNames() {
X509CRLSelector selector = new X509CRLSelector();
byte[] iss1 = new byte[] // manually obtained DER encoding of "O=First Org." issuer name;
{ 48, 21, 49, 19, 48, 17, 6, 3, 85, 4, 10, 19, 10, 70, 105, 114, 115, 116, 32, 79, 114, 103, 46 };
byte[] iss2 = new byte[] // manually obtained DER encoding of "O=Second Org." issuer name;
{ 48, 22, 49, 20, 48, 18, 6, 3, 85, 4, 10, 19, 11, 83, 101, 99, 111, 110, 100, 32, 79, 114, 103, 46 };
assertNull("The collection should be null.", selector.getIssuerNames());
try {
selector.addIssuerName(iss1);
selector.addIssuerName(iss2);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
Collection<Object> result = selector.getIssuerNames();
assertEquals("The collection should contain all of the specified DNs.", 2, result.size());
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testGetMinCRL.
/**
* getMinCRL() method testing. Tests if the method return null in the case
* of not specified minCRL criteria, and if the returned value corresponds
* to the specified one.
*/
public void testGetMinCRL() {
X509CRLSelector selector = new X509CRLSelector();
assertNull("Initially the minCRL should be null.", selector.getMinCRL());
BigInteger minCRL = new BigInteger("10000");
selector.setMinCRLNumber(minCRL);
assertTrue("The result should be equal to specified.", minCRL.equals(selector.getMinCRL()));
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testX509CRLSelector.
/**
* constructor testing.
*
*/
public void testX509CRLSelector() {
X509CRLSelector selector = new X509CRLSelector();
assertNull(selector.getDateAndTime());
assertNull(selector.getCertificateChecking());
assertNull(selector.getIssuerNames());
assertNull(selector.getIssuers());
assertNull(selector.getMaxCRL());
assertNull(selector.getMinCRL());
}
use of java.security.cert.X509CRLSelector in project robovm by robovm.
the class X509CRLSelector2Test method testAddIssuerNameLjava_lang_String03.
/**
* addIssuerName(String name) method testing. Tests if CRLs with specified
* issuers match the selector, and if not specified issuer does not match
* the selector.
*/
public void testAddIssuerNameLjava_lang_String03() {
X509CRLSelector selector = new X509CRLSelector();
String iss1 = "O=First Org.";
String iss2 = "O=Second Org.";
TestCRL crl1 = new TestCRL(new X500Principal(iss1));
TestCRL crl2 = new TestCRL(new X500Principal(iss2));
try {
selector.addIssuerName(iss1);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
assertTrue("The CRL should match the selection criteria.", selector.match(crl1));
assertFalse("The CRL should not match the selection criteria.", selector.match(crl2));
try {
selector.addIssuerName(iss2);
} catch (IOException e) {
e.printStackTrace();
fail("Unexpected IOException was thrown.");
}
assertTrue("The CRL should match the selection criteria.", selector.match(crl2));
}
Aggregations