use of org.apache.cxf.wsdl.interceptors.BareInInterceptor in project cxf by apache.
the class BareInInterceptorTest method testInterceptorInbound.
@Test
public void testInterceptorInbound() throws Exception {
setUpUsingHelloWorld();
BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(getTestStream(getClass(), "resources/GreetMeDocLiteralReq.xml")));
message.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
interceptor.handleMessage(message);
assertNull(message.getContent(Exception.class));
List<?> parameters = message.getContent(List.class);
assertEquals(1, parameters.size());
Object obj = parameters.get(0);
assertTrue(obj instanceof GreetMe);
GreetMe greet = (GreetMe) obj;
assertEquals("TestSOAPInputPMessage", greet.getRequestType());
}
use of org.apache.cxf.wsdl.interceptors.BareInInterceptor in project cxf by apache.
the class BareInInterceptorTest method testInterceptorInboundBareNoParameter.
@Test
public void testInterceptorInboundBareNoParameter() throws Exception {
setUpUsingDocLit();
BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(getTestStream(getClass(), "resources/bareNoParamDocLitBareReq.xml")));
XMLStreamReader reader = message.getContent(XMLStreamReader.class);
// skip to the end element of soap body, so that we can serve an empty request to
// interceptor
StaxUtils.skipToStartOfElement(reader);
StaxUtils.nextEvent(reader);
message.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
interceptor.handleMessage(message);
assertNull(message.getContent(Exception.class));
List<?> parameters = message.getContent(List.class);
assertNull(parameters);
}
Aggregations