Methods Summary |
---|
private java.io.Reader | getResourceReader(java.lang.String resourceName)
return new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName));
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(X509TokenTest.class);
return suite;
|
protected void | tearDown()
|
public void | testX509TokenAssertionsReference(java.lang.String fileName, java.lang.String referenceType)
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","X509Token",assertion.getName().getLocalPart());
X509Token xt = (X509Token)assertion;
Iterator itrref = xt.getTokenRefernceType().iterator();
assertTrue(xt.getTokenRefernceType().contains(referenceType));
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testX509TokenAssertionsType(java.lang.String fileName, java.lang.String tokenType)
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","X509Token",assertion.getName().getLocalPart());
X509Token xt = (X509Token)assertion;
assertTrue(tokenType.equals(xt.getTokenType()));
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testX509TokensAssertions_Reference_4()
testX509TokenAssertionsReference("security/X509TokenAssertions9.xml", X509Token.REQUIRE_KEY_IDENTIFIER_REFERENCE);
testX509TokenAssertionsReference("security/X509TokenAssertions10.xml", X509Token.REQUIRE_ISSUER_SERIAL_REFERENCE);
testX509TokenAssertionsReference("security/X509TokenAssertions11.xml", X509Token.REQUIRE_EMBEDDED_TOKEN_REFERENCE);
testX509TokenAssertionsReference("security/X509TokenAssertions12.xml", X509Token.REQUIRE_THUMBPRINT_REFERENCE);
|
public void | testX509TokensAssertions_Types_8()
testX509TokenAssertionsType("security/X509TokenAssertions1.xml", X509Token.WSSX509V1TOKEN10);
testX509TokenAssertionsType("security/X509TokenAssertions2.xml", X509Token.WSSX509V3TOKEN10);
testX509TokenAssertionsType("security/X509TokenAssertions3.xml", X509Token.WSSX509PKCS7TOKEN10);
testX509TokenAssertionsType("security/X509TokenAssertions4.xml", X509Token.WSSX509PKIPATHV1TOKEN10);
testX509TokenAssertionsType("security/X509TokenAssertions5.xml", X509Token.WSSX509V1TOKEN11);
testX509TokenAssertionsType("security/X509TokenAssertions6.xml", X509Token.WSSX509V3TOKEN11);
testX509TokenAssertionsType("security/X509TokenAssertions7.xml", X509Token.WSSX509PKCS7TOKEN11);
testX509TokenAssertionsType("security/X509TokenAssertions8.xml", X509Token.WSSX509PKIPATHV1TOKEN11);
|
public com.sun.xml.ws.policy.Policy | unmarshalPolicy(java.lang.String xmlFile)
PolicySourceModel model = unmarshalPolicyResource(
xmlFile);
Policy mbp = PolicyModelTranslator.getTranslator().translate(model);
return mbp;
|
private com.sun.xml.ws.policy.sourcemodel.PolicySourceModel | unmarshalPolicyResource(java.lang.String resource)
Reader reader = getResourceReader(resource);
PolicySourceModel model = PolicyModelUnmarshaller.getXmlUnmarshaller().unmarshalModel(reader);
reader.close();
return model;
|