Package org.springframework.ws

Examples of org.springframework.ws.MockWebServiceMessageFactory


    }

    @Test
    public void testGetQNameNameNamespace() throws Exception {
        MockWebServiceMessage request = new MockWebServiceMessage("<prefix:localname xmlns:prefix=\"namespace\"/>");
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        QName qName = mapping.resolveQName(context);
        Assert.assertNotNull("mapping returns null", qName);
        Assert.assertEquals("mapping returns invalid method name", new QName("namespace", "localname", "prefix"), qName);
    }
View Full Code Here


        assertTrue("resolver does not support MessageContext", resolver.supportsParameter(supported));
    }

    @Test
    public void resolveArgument() throws Exception {
        MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());

        MessageContext result = resolver.resolveArgument(messageContext, supported);
        assertSame("Invalid message context returned", messageContext, result);
    }
View Full Code Here

    }

    @Test
    public void resolveArgument() throws JAXBException {
        WebServiceMessage request = new MockWebServiceMessage("<myType xmlns='http://springframework.org'><string>Foo</string></myType>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        JAXBElement<?> result = processor.resolveArgument(messageContext, supportedParameter);
        assertTrue("result not a MyType", result.getValue() instanceof MyType);
        MyType type = (MyType) result.getValue();
        assertEquals("invalid result", "Foo", type.getString());
View Full Code Here

        assertEquals("invalid result", "Foo", type.getString());
    }

    @Test
    public void handleReturnValue() throws Exception {
        MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());

        MyType type = new MyType();
        type.setString("Foo");
        JAXBElement<MyType> element = new JAXBElement<MyType>(new QName("http://springframework.org", "type"), MyType.class, type);
        processor.handleReturnValue(messageContext, supportedReturnType, element);
View Full Code Here

        assertXMLEqual("<type xmlns='http://springframework.org'><string>Foo</string></type>", response.getPayloadAsString());
    }

    @Test
    public void handleReturnValueString() throws Exception {
        MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());

        String s = "Foo";
        JAXBElement<String> element = new JAXBElement<String>(new QName("http://springframework.org", "string"), String.class, s);
        processor.handleReturnValue(messageContext, stringReturnType, element);
        assertTrue("context has no response", messageContext.hasResponse());
View Full Code Here

    }

  @Test
  public void handleNullReturnValue() throws Exception {
    MessageContext messageContext =
        new DefaultMessageContext(new MockWebServiceMessageFactory());

    processor.handleReturnValue(messageContext, stringReturnType, null);
    assertFalse("context has response", messageContext.hasResponse());
  }
View Full Code Here

    private MessageContext messageContext;

    @Before
    public void setUp() throws Exception {
        messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());
    }
View Full Code Here

        interceptor = new PayloadLoggingInterceptor();
        appender = new CountingAppender();
        BasicConfigurator.configure(appender);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        MockWebServiceMessage request = new MockWebServiceMessage("<request/>");
        messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        appender.reset();
    }
View Full Code Here

    @Test
    public void testHandleRequest() throws Exception {
        interceptor.setRequestXslt(xslt);
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(input);
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected);
View Full Code Here

    @Test
    public void testHandleRequestNoXslt() throws Exception {
        interceptor.setResponseXslt(xslt);
        interceptor.afterPropertiesSet();
        MockWebServiceMessage request = new MockWebServiceMessage(input);
        MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid interceptor result", result);
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(input)), expected);
View Full Code Here

TOP

Related Classes of org.springframework.ws.MockWebServiceMessageFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.