Package org.switchyard

Examples of org.switchyard.ServiceReference


    @Test
    public void testBeforeProviderErrorInOnly() {
        ErrorInterceptor interceptor = new ErrorInterceptor(false, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("interceptor", interceptor);

        ServiceReference ref = registerInOnlyService("inOnly", new MockHandler());
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertNoCause("Error before on target Provider", exchange);
        Assert.assertEquals(2, interceptor.getCount());
    }
View Full Code Here


    @Test
    public void testAfterProviderErrorInOnly() {
        ErrorInterceptor interceptor = new ErrorInterceptor(true, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("interceptor", interceptor);

        ServiceReference ref = registerInOnlyService("inOnly", new MockHandler());
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertNoCause("Error after on target Provider", exchange);
        Assert.assertEquals(2, interceptor.getCount());
    }
View Full Code Here

    public void testInRuntimeFault() {
        RuntimeErrorInterceptor interceptor = new RuntimeErrorInterceptor(
                false, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("interceptor", interceptor);

        ServiceReference ref = registerInOutService("inOut");
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertCause("RuntimeException before on target Provider", exchange);
        Assert.assertEquals(2, interceptor.getCount());
    }
View Full Code Here

    public void testOutRuntimeFault() {
        RuntimeErrorInterceptor interceptor = new RuntimeErrorInterceptor(
                true, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("interceptor", interceptor);

        ServiceReference ref = registerInOutService("inOut");
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertCause("RuntimeException after on target Provider", exchange);
        Assert.assertEquals(2, interceptor.getCount());
    }
View Full Code Here

    public void testFaultFault() {
        ErrorInterceptor beforeFault = new ErrorInterceptor(false, ExchangeInterceptor.PROVIDER);
        ErrorInterceptor afterFault = new ErrorInterceptor(true, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("beforeFault", beforeFault);
        _camelContext.getWritebleRegistry().put("afterFault", afterFault);
        ServiceReference ref = registerInOutService("inOut");
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertNoCause("Error before on target Provider", exchange);
        Assert.assertEquals(2, beforeFault.getCount());
        Assert.assertEquals(2, afterFault.getCount());
View Full Code Here

            public void notify(Exchange ex, Throwable e) {
                fired.compareAndSet(false, true);
            }
        };
        _camelContext.getWritebleRegistry().put("custom error listener", listener);
        ServiceReference ref = registerInOutService("inOut", new RuntimeErrorInHandler());
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertTrue(fired.get());
        assertCause("Runtime error", exchange);
    }
View Full Code Here

            public void handleMessage(Exchange exchange)
                    throws HandlerException {
                exchange.send(exchange.getMessage().copy());
            }
        };
        ServiceReference ref = registerInOutServiceWithTypes("typesTest", inType, outType, handler);
        sendMessage(ref, TEST_CONTENT);

        Assert.assertEquals(inType, types.getInType());
        Assert.assertEquals(outType, types.getOutType());
    }
View Full Code Here

            public Processor createErrorHandler(RouteContext routeContext, final Processor processor) {
                fired.compareAndSet(false, true);
                return super.createErrorHandler(routeContext, processor);
            }
        });
        ServiceReference ref = registerInOutService("inOut", new RuntimeErrorInHandler());
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertTrue(fired.get());
        assertCause("Runtime error", exchange);
    }
View Full Code Here

        _domain.getTransformerRegistry().addTransformer(helloTransform);

        try {
            // Provide the service
            MockHandler provider = new MockHandler();
            ServiceReference service = _domain.createInOnlyService(serviceName, provider);

            // Create the exchange and invoke the service
            Exchange exchange = service.createExchange();

            // Set the from and to message names.  NOTE: setting to the to message
            // name will not be necessary once the service definition is available
            // at runtime
            Message msg = exchange.createMessage().setContent(input);
View Full Code Here

        final QName expectedDestType = new QName("toB");
        final String input = "Hello";

        // Provide the service
        MockHandler provider = new MockHandler();
        ServiceReference service = _domain.createInOnlyService(serviceName, provider);

        // Create the exchange and invoke the service
        MockHandler invokerHandler = new MockHandler();
        Exchange exchange = service.createExchange(invokerHandler);

        // Set the from and to message names.  NOTE: setting to the to message
        // name will not be necessary once the service definition is available
        // at runtime
        Message msg = exchange.createMessage().setContent(input);
View Full Code Here

TOP

Related Classes of org.switchyard.ServiceReference

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.