use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testClone.
/**
* clone() method testing. Tests if the selector is cloned correctly: the
* crl which matche to the initial selector should match to the clone and
* the change of clone should not cause the change of initial selector.
*/
public void testClone() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
BigInteger minCRL = new BigInteger("10000");
BigInteger maxCRL = new BigInteger("10000");
Date date = new Date(200);
selector.addIssuer(iss1);
selector.addIssuer(iss2);
selector.setMinCRLNumber(minCRL);
selector.setMaxCRLNumber(maxCRL);
selector.setDateAndTime(date);
X509CRLSelector clone = (X509CRLSelector) selector.clone();
TestCRL crl = new TestCRL(iss1);
crl.setCrlNumber(minCRL);
crl.setUpdateDates(new Date(200), new Date(200));
assertTrue("The specified CRL should match the clone selector.", selector.match(crl));
clone.addIssuer(iss3);
assertFalse("The changes of the clone selector should not cause " + "the changes of initial object", selector.getIssuerNames().size() == 3);
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testMatchLjava_security_cert_X509CRL.
/**
* match(CRL crl) method testing. Tests if the null object matches to the
* selector or not.
*/
public void testMatchLjava_security_cert_X509CRL() {
X509CRLSelector selector = new X509CRLSelector();
assertFalse("The null object should not match", selector.match((X509CRL) null));
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testSetIssuersLjava_util_Collection.
/**
* setIssuers(Collection <X500Principal> issuers) method testing. Tests if
* CRLs with any issuers match the selector in the case of null issuerNames
* criteria, if specified issuers match the selector, and if not specified
* issuer does not match the selector.
*/
public void testSetIssuersLjava_util_Collection() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
TestCRL crl1 = new TestCRL(iss1);
TestCRL crl2 = new TestCRL(iss2);
TestCRL crl3 = new TestCRL(iss3);
selector.setIssuers(null);
assertTrue("Any CRL issuers should match in the case of null issuers.", selector.match(crl1) && selector.match(crl2));
ArrayList<X500Principal> issuers = new ArrayList<X500Principal>(2);
issuers.add(iss1);
issuers.add(iss2);
selector.setIssuers(issuers);
assertTrue("The CRL should match the selection criteria.", selector.match(crl1) && selector.match(crl2));
assertFalse("The CRL should not match the selection criteria.", selector.match(crl3));
issuers.add(iss3);
assertFalse("The internal issuer collection is not protected " + "against the modifications.", selector.match(crl3));
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelectorTest method testGetIssuersImmutable.
public void testGetIssuersImmutable() {
X509CRLSelector crlSelector = new X509CRLSelector();
crlSelector.addIssuer(PRINCIPAL);
Collection<X500Principal> issuers = crlSelector.getIssuers();
try {
issuers.clear();
fail();
} catch (UnsupportedOperationException expected) {
}
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelectorTest method test_addIssuerNameLjava_lang_String01.
/**
* java.security.cert.X509CRLSelector#addIssuerName(java.lang.String)
*/
public void test_addIssuerNameLjava_lang_String01() throws Exception {
// Regression for HARMONY-465
X509CRLSelector obj = new X509CRLSelector();
try {
obj.addIssuerName("234");
fail("IOException expected");
} catch (IOException e) {
// expected
}
// Regression for HARMONY-1076
try {
new X509CRLSelector().addIssuerName("w=y");
fail("IOException expected");
} catch (IOException e) {
// expected
}
}
Aggregations