java.security.cert.X509CRLSelector#setMaxCRLNumber()源码实例Demo

下面列出了java.security.cert.X509CRLSelector#setMaxCRLNumber() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: j2objc   文件: X509CRLSelector2Test.java
/**
 * setMaxCRLNumber(BigInteger maxCRL) method testing. Tests if CRLs with any
 * crl number value match the selector in the case of null crlNumber
 * criteria, if specified maxCRL value matches the selector, and if CRL with
 * inappropriate crlNumber value does not match the selector.
 */
public void testSetMaxCRLNumberLjava_math_BigInteger() {
    X509CRLSelector selector = new X509CRLSelector();
    BigInteger maxCRL = new BigInteger("10000");
    TestCRL crl = new TestCRL(maxCRL);

    selector.setMaxCRLNumber(null);
    assertTrue("Any CRL should match in the case of null minCRLNumber.",
            selector.match(crl));
    selector.setMaxCRLNumber(maxCRL);
    assertTrue("The CRL should match the selection criteria.", selector
            .match(crl));
    selector.setMaxCRLNumber(new BigInteger("9999"));
    assertFalse("The CRL should not match the selection criteria.",
            selector.match(crl));
}
 
源代码2 项目: j2objc   文件: X509CRLSelector2Test.java
public void testToString() {
    X509CRLSelector selector = new X509CRLSelector();
    X500Principal iss1 = new X500Principal("O=First Org.");
    X500Principal iss2 = new X500Principal("O=Second 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);

    assertNotNull("The result should not be null.", selector.toString());
}
 
源代码3 项目: j2objc   文件: X509CRLSelector2Test.java
/**
 * 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()));
}
 
源代码4 项目: j2objc   文件: X509CRLSelector2Test.java
/**
 * 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);
}