@Test
public void performanceExtractSecurityInfo() throws Exception
{
final UsernameTokenExtractor extractor = new UsernameTokenExtractor("http://schemas.xmlsoap.org/ws/2002/04/secext");
final String soap = createUserPassSoapString("soap-userpass-example.xml");
AuthenticationRequest authRequest = null;
// warm up
for (int i = 0; i < 5000; i++)
{
authRequest = extractor.extractSecurityInfo(soap);
}
int iterations = 1000000;
long start = System.nanoTime();
for (int i = 0; i < iterations; i++)
{
authRequest = extractor.extractSecurityInfo(soap);
}
long duration = System.nanoTime() - start;
System.out.println(iterations + " took : " + NANOSECONDS.toSeconds(duration) + " s");
assertNotNull(authRequest);
assertEquals( "Clark", authRequest.getPrincipal().getName());
}