use of java.security.cert.PolicyNode in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testGetPolicyTree01.
/**
* Test for <code>getPolicyTree()</code> method<br>
* Assertion: returns the root node of the valid
* policy tree or <code>null</code> if there are
* no valid policies
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetPolicyTree01() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
// valid policy tree case;
PolicyNode pn = TestUtils.getPolicyTree();
PKIXCertPathValidatorResult vr = new PKIXCertPathValidatorResult(ta, pn, testPublicKey);
// must return the same reference passed
// as a parameter to the constructor
assertSame(pn, vr.getPolicyTree());
}
use of java.security.cert.PolicyNode in project robovm by robovm.
the class TestUtils method getPolicyTree.
/**
* Creates policy tree stub containing two <code>PolicyNode</code>s
* for testing purposes
*
* @return root <code>PolicyNode</code> of the policy tree
*/
public static PolicyNode getPolicyTree() {
return new PolicyNode() {
final PolicyNode parent = this;
public int getDepth() {
// parent
return 0;
}
public boolean isCritical() {
return false;
}
public String getValidPolicy() {
return null;
}
public PolicyNode getParent() {
return null;
}
public Iterator<PolicyNode> getChildren() {
PolicyNode child = new PolicyNode() {
public int getDepth() {
// child
return 1;
}
public boolean isCritical() {
return false;
}
public String getValidPolicy() {
return null;
}
public PolicyNode getParent() {
return parent;
}
public Iterator<PolicyNode> getChildren() {
return null;
}
public Set<String> getExpectedPolicies() {
return null;
}
public Set<? extends PolicyQualifierInfo> getPolicyQualifiers() {
return null;
}
};
HashSet<PolicyNode> s = new HashSet<PolicyNode>();
s.add(child);
return s.iterator();
}
public Set<String> getExpectedPolicies() {
return null;
}
public Set<? extends PolicyQualifierInfo> getPolicyQualifiers() {
return null;
}
};
}
Aggregations