Package org.switchyard

Examples of org.switchyard.BaseHandler


        invokerService.operation("invokeWithContent").sendInOut("invokeWithContent");
    }
   
    @Test
    public void setProperty() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            @Override
            public void handleMessage(Exchange exchange) throws HandlerException {
                // Verify that a property was set on the request message by the invoker
                Property inProp = exchange.getContext(exchange.getMessage())
                        .getProperty(TEST_IN_PROPERTY, Scope.MESSAGE);
View Full Code Here


        invokerService.operation("propertyTest").sendInOut("propertyTest");
    }
   
    @Test
    public void declaredException() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            public void handleMessage(Exchange exchange) throws HandlerException {
                Message reply = exchange.createMessage();
                reply.setContent(new DummyException(
                        exchange.getMessage().getContent(String.class)));
                exchange.sendFault(reply);
View Full Code Here

        invokerService.operation("declaredException").sendInOut("declaredException");
    }
   
    @Test
    public void undeclaredException() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            public void handleMessage(Exchange exchange) throws HandlerException {
                throw new HandlerException(new DummyException(
                        exchange.getMessage().getContent(String.class)));
            }
        });
View Full Code Here

    @Test
    public void testInOnlySuccess() throws Exception {
        final QName serviceName = new QName("inOnlySuccess");
       
        // Provide the service
        ExchangeHandler provider = new BaseHandler() {
      public void handleMessage(Exchange event) {
          inEvents.add(event);
      }
        };
View Full Code Here

        _camelContext.getWritebleRegistry().put("types", types);
       
        QName inType = new QName("urn:foo", "in");
        QName outType = new QName("urn:bar", "out");

        ExchangeHandler handler = new BaseHandler() {
            @Override
            public void handleMessage(Exchange exchange)
                    throws HandlerException {
                exchange.send(exchange.getMessage().copy());
            }
View Full Code Here

    }
   
    @Test
    public void faultChainContinuesOnFault() throws Exception {
        // This goes first and throws an exception - bad handler!
        ExchangeHandler badHandler = new BaseHandler() {
            @Override
            public void handleFault(Exchange exchange) {
                throw new RuntimeException("oops!");
            }
        };
View Full Code Here

       
        _replyChain = new DefaultHandlerChain();
        _replyChain.addLast("validation-before-transform", validateHandler);
        _replyChain.addLast("transformation", transformHandler);
        _replyChain.addLast("validation-after-transform", validateHandler);
        _replyChain.addLast(HandlerChain.CONSUMER_HANDLER, new BaseHandler());
    }
View Full Code Here

    @Test
    public void testServiceEvents() {
        _domain.addEventObserver(_observer, ServiceRegistrationEvent.class)
            .addEventObserver(_observer, ServiceUnregistrationEvent.class);
       
        Service service = _domain.registerService(new QName("test"), new InOutService(), new BaseHandler());
        Assert.assertTrue(_observer.serviceRegistrationCalled);
        service.unregister();
        Assert.assertTrue(_observer.serviceUnregistrationCalled);
    }
View Full Code Here

        final String inMsgContent = "in message";
        final String outMsgContent = "out message";
       
        // create a handler to test that the in and out content match
        // expected result from getMessage()
        ExchangeHandler provider = new BaseHandler() {
            public void handleMessage(Exchange exchange) {
                Assert.assertEquals(
                    exchange.getMessage().getContent(),
                        inMsgContent);
               
                Message outMsg = exchange.createMessage();
                outMsg.setContent(outMsgContent);
                try {
                  exchange.send(outMsg);
                }
                catch (Exception ex) {
                    Assert.fail(ex.toString());
                }
            }
        };

        ExchangeHandler consumer = new BaseHandler() {
            public void handleMessage(Exchange exchange) {
                Assert.assertEquals(
                    exchange.getMessage().getContent(),
                        outMsgContent);
            }
View Full Code Here

TOP

Related Classes of org.switchyard.BaseHandler

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.