Package org.switchyard

Examples of org.switchyard.BaseHandler


    private ServiceDomain serviceDomain;

    @Test
    public void testCallService() throws Exception {
        final Holder holder = new Holder();
        serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                holder.setValue("message handled");
            }
        });
        serviceDomain.registerServiceReference(new QName("CallService"), new InOnlyService());
View Full Code Here


    }

    @Test
    public void testControlProcess() throws Exception {
        final Holder holder = new Holder();
        Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                holder.setValue("message handled");
            }
        });
        serviceDomain.registerServiceReference(callService.getName(), callService.getInterface(), callService.getProviderHandler());
View Full Code Here

    }

    private void runCorrelateProcess(final boolean bomb) throws Exception {
        final AtomicInteger counter = new AtomicInteger();
        final Holder holder = new Holder();
        Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                int count = counter.incrementAndGet();
                holder.setValue(String.valueOf(count));
            }
        });
View Full Code Here

    @Test
    public void testSignalAllProcesses() throws Exception {
        final AtomicInteger counter = new AtomicInteger();
        final Holder holder = new Holder();
        Service callService = serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                int count = counter.incrementAndGet();
                holder.setValue(String.valueOf(count));
            }
        });
View Full Code Here

    public void testFaultResultProcessFailure() throws Exception {
        runFaultResultProcess(true);
    }

    private void runFaultResultProcess(final boolean bomb) throws Exception {
        serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
View Full Code Here

    public void testFaultEventProcessFailure() throws Exception {
        runFaultEventProcess(true);
    }

    private void runFaultEventProcess(final boolean bomb) throws Exception {
        serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
View Full Code Here

    public void testFaultBoundaryProcessFailure() throws Exception {
        runFaultBoundaryProcess(true);
    }

    private void runFaultBoundaryProcess(final boolean bomb) throws Exception {
        serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
View Full Code Here

    }

    @Test
    public void testSignalProcess() throws Exception {
        final Map<String,String> testAssertionMap = new HashMap<String,String>();
        Service serviceOne = serviceDomain.registerService(new QName("ServiceOne"), new InOnlyService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                Holder h = exchange.getMessage().getContent(Holder.class);
                testAssertionMap.put("ServiceOne", h.getValue());
            }
        });
        Service serviceTwo = serviceDomain.registerService(new QName("ServiceTwo"), new InOutService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                Holder h = exchange.getMessage().getContent(Holder.class);
                testAssertionMap.put("ServiceTwo", h.getValue());
            }
        });
View Full Code Here

        invokerService.operation("getContract").sendInOut("getContract");
    }
   
    @Test
    public void messageTest() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            @Override
            public void handleMessage(Exchange exchange) throws HandlerException {
                // Verify that the content was set on the request message by the invoker
                Assert.assertNotNull(exchange.getMessage().getContent());
                Assert.assertEquals("message-test-in", exchange.getMessage().getContent());
View Full Code Here

        invokerService.operation("messageTest").sendInOut("messageTest");
    }
   
    @Test
    public void invokeWithContent() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            @Override
            public void handleMessage(Exchange exchange) throws HandlerException {
                // Verify that the content was set on the request message by the invoker
                Assert.assertNotNull(exchange.getMessage().getContent());
                Assert.assertEquals("content-test-in", exchange.getMessage().getContent());
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.