}
@Test
public void configFromFileWithoutSecurityHeader() throws Exception
{
final Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-saml-injector.xml"));
final String soap = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-no-security-header.xml"), "UTF-8");
final StringSource source = new StringSource(soap);
final StringResult result = new StringResult();
final SamlCredential samlPrincipal = new SamlCredential("<dummyAssertion/>");
final Subject subject = new Subject();
subject.getPublicCredentials().add(samlPrincipal);
final String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("saml-inject-expected.xml"), "UTF-8");
final String actual = (String) Subject.doAs(subject, new PrivilegedAction<String>()
{
public String run()
{
smooks.filterSource(source, result);
return result.toString();
}
});
assertTrue(XMLHelper.compareXMLContent(expected, actual));