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(RelTokenTest.class);
return suite;
|
protected void | tearDown()
|
public void | testRelToken1()
testRelToken_Keys_Reference("security/RelToken1.xml", "");
testRelToken_Keys_Reference("security/RelToken2.xml", "RequireKeyIdentifierReference");
|
public void | testRelToken2()
testRelTokenType("security/RelToken1.xml", com.sun.xml.ws.security.policy.RelToken.WSS_REL_V10_TOKEN10);
testRelTokenType("security/RelToken2.xml", com.sun.xml.ws.security.policy.RelToken.WSS_REL_V20_TOKEN10);
testRelTokenType("security/RelToken3.xml", com.sun.xml.ws.security.policy.RelToken.WSS_REL_V10_TOKEN11);
testRelTokenType("security/RelToken4.xml", com.sun.xml.ws.security.policy.RelToken.WSS_REL_V20_TOKEN11);
|
public void | testRelTokenType(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","RelToken",assertion.getName().getLocalPart());
assertion = (PolicyAssertion)assertion;
com.sun.xml.ws.security.impl.policy.RelToken rt = (com.sun.xml.ws.security.impl.policy.RelToken)assertion;
assertTrue(rt.getTokenType().equals(tokenType));
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testRelToken_Keys_Reference(java.lang.String fileName, java.lang.String param)
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","RelToken",assertion.getName().getLocalPart());
com.sun.xml.ws.security.impl.policy.RelToken rt=(com.sun.xml.ws.security.impl.policy.RelToken)assertion;
if(param.equals(""))
assertTrue(rt.isRequireDerivedKeys());
else {
Iterator itrRt = rt.getTokenRefernceType();
if(itrRt.hasNext()) {
assertTrue(((String)itrRt.next()).equals(com.sun.xml.ws.security.policy.RelToken.REQUIRE_KEY_IDENTIFIER_REFERENCE));
}
}
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
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;
|