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(SecurityContextTokenTest.class);
return suite;
|
protected void | tearDown()
|
public void | testSecurityContextToken1()
String fileName = "security/SecurityContextTokenAssertions1.xml";
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","SecurityContextToken",assertion.getName().getLocalPart());
SecurityContextToken st = (SecurityContextToken)assertion;
assertTrue(st.isRequireDerivedKeys());
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testSecurityContextToken2()
String fileName = "security/SecurityContextTokenAssertions2.xml";
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","SecurityContextToken",assertion.getName().getLocalPart());
SecurityContextToken st = (SecurityContextToken)assertion;
Iterator itrst = st.getTokenRefernceType();
if(itrst.hasNext()) {
assertTrue(((String)itrst.next()).equals(com.sun.xml.ws.security.impl.policy.SecurityContextToken.REQUIRE_EXTERNAL_URI_REFERENCE));
}
}
} else {
throw new Exception("No Assertions found!. Unmarshalling of "+fileName+" failed!");
}
|
public void | testSecurityContextToken3()
String fileName = "security/SecurityContextTokenAssertions3.xml";
Policy policy = unmarshalPolicy(fileName);
Iterator <AssertionSet> itr = policy.iterator();
if(itr.hasNext()) {
AssertionSet as = itr.next();
for(PolicyAssertion assertion : as) {
assertEquals("Invalid assertion","SecurityContextToken",assertion.getName().getLocalPart());
SecurityContextToken st = (SecurityContextToken)assertion;
assertTrue(st.getTokenType().equals(com.sun.xml.ws.security.impl.policy.SecurityContextToken.SC10_SECURITYCONTEXT_TOKEN));
}
} 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;
|