Search in sources :

Example 1 with SoapVersion

use of org.springframework.ws.soap.SoapVersion in project newrelic-java-agent by newrelic.

the class SpringWSUtilsTest method testAddCustomAttributes.

@Test
public void testAddCustomAttributes() {
    SoapVersion mockSoapVersion = Mockito.mock(SoapVersion.class);
    SoapMessage mockSoapMessage = Mockito.mock(SoapMessage.class);
    Mockito.when(mockSoapVersion.getContentType()).thenReturn("application/soap+xml");
    Mockito.when(mockSoapVersion.toString()).thenReturn("1.2");
    Mockito.when(mockSoapMessage.getSoapAction()).thenReturn("MySoapAction");
    Mockito.when(mockSoapMessage.getVersion()).thenReturn(mockSoapVersion);
    SpringWSUtils.addCustomAttributes(mockSoapMessage);
    Mockito.verify(mockPrivateApi, Mockito.times(1)).addCustomAttribute(SpringWSUtils.PARAM_CATEGORY + "Content", "application/soap+xml");
    Mockito.verify(mockPrivateApi, Mockito.times(1)).addCustomAttribute(SpringWSUtils.PARAM_CATEGORY + "SOAP Version", "1.2");
    Mockito.verify(mockPrivateApi, Mockito.times(1)).addCustomAttribute(SpringWSUtils.PARAM_CATEGORY + "SOAP Action", "MySoapAction");
}
Also used : SoapVersion(org.springframework.ws.soap.SoapVersion) SoapMessage(org.springframework.ws.soap.SoapMessage) AxiomSoapMessage(org.springframework.ws.soap.axiom.AxiomSoapMessage) SaajSoapMessage(org.springframework.ws.soap.saaj.SaajSoapMessage) Test(org.junit.Test)

Example 2 with SoapVersion

use of org.springframework.ws.soap.SoapVersion in project newrelic-java-agent by newrelic.

the class SpringWSUtils method addCustomAttributes.

public static void addCustomAttributes(SoapMessage message) {
    SoapVersion version = message.getVersion();
    String contentType = version.getContentType();
    String soapAction = message.getSoapAction();
    AgentBridge.privateApi.addCustomAttribute(PARAM_CATEGORY + "SOAP Version", version.toString());
    AgentBridge.privateApi.addCustomAttribute(PARAM_CATEGORY + "Content", contentType);
    AgentBridge.privateApi.addCustomAttribute(PARAM_CATEGORY + "SOAP Action", soapAction);
}
Also used : SoapVersion(org.springframework.ws.soap.SoapVersion)

Aggregations

SoapVersion (org.springframework.ws.soap.SoapVersion)2 Test (org.junit.Test)1 SoapMessage (org.springframework.ws.soap.SoapMessage)1 AxiomSoapMessage (org.springframework.ws.soap.axiom.AxiomSoapMessage)1 SaajSoapMessage (org.springframework.ws.soap.saaj.SaajSoapMessage)1