SecurityEvent securityEvent = receivedSecurityEvents.get(i);
if (securityEvent.getSecurityEventType() == WSSecurityEventConstants.Operation) {
OperationSecurityEvent operationSecurityEvent = (OperationSecurityEvent) securityEvent;
Assert.assertEquals(operationSecurityEvent.getOperation(), new QName("http://schemas.xmlsoap.org/wsdl/", "definitions"));
} else if (securityEvent.getSecurityEventType() == WSSecurityEventConstants.ContentEncrypted) {
ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = (ContentEncryptedElementSecurityEvent) securityEvent;
Assert.assertNotNull(contentEncryptedElementSecurityEvent.getXmlSecEvent());
Assert.assertNotNull(contentEncryptedElementSecurityEvent.getSecurityToken());
Assert.assertNotNull(contentEncryptedElementSecurityEvent.getElementPath());
final QName expectedElementName = new QName("http://www.w3.org/1999/XMLSchema", "simpleType");
Assert.assertEquals(contentEncryptedElementSecurityEvent.getXmlSecEvent().asStartElement().getName(), expectedElementName);
Assert.assertEquals(contentEncryptedElementSecurityEvent.getElementPath().size(), 6);
Assert.assertEquals(contentEncryptedElementSecurityEvent.getElementPath().get(contentEncryptedElementSecurityEvent.getElementPath().size() - 1), expectedElementName);
}
}
List<ContentEncryptedElementSecurityEvent> contentEncryptedElementSecurityEventList = securityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted);
OperationSecurityEvent operationSecurityEvent = securityEventListener.getSecurityEvent(WSSecurityEventConstants.Operation);