Package org.switchyard

Examples of org.switchyard.ServiceReference


        _camelContext.stop();
    }

    @Test
    public void testCopyFromExchange() throws Exception {
        ServiceReference inOnly = new ServiceReferenceImpl(
            new QName("exchange-copy"), new InOnlyService(), _domain, null);
        ExchangeDispatcher dispatch = _provider.createDispatcher(inOnly);
       
        Exchange ex = dispatch.createExchange(null, ExchangePattern.IN_ONLY);
        Context ctx = ex.getContext();
View Full Code Here


        _domain.getValidatorRegistry().addValidator(helloValidate);

        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 message name.  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

        };
        _domain.getValidatorRegistry().addValidator(failValidate);

        // 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 message name.  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

        _domain.getTransformerRegistry().addTransformer(transformBtoC);
       
        try {
            // Provide the service
            TestTransformHandler serviceHandler = new TestTransformHandler();
            ServiceReference service = _domain.createInOnlyService(serviceName, serviceHandler);
       
            // 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

    }

    @Test
    public void testCreateDispatcher() throws Exception {
        // verify that dispatchers can be created for an InOnly service
        ServiceReference inOnly = new ServiceReferenceImpl(
            new QName("inOnly"), new InOnlyService(), _domain, null);
        assertNotNull(_provider.createDispatcher(inOnly));

        // verify that dispatchers can be created for an InOut service
        ServiceReference inOut = new ServiceReferenceImpl(
            new QName("inOut"), new InOutService(), _domain, null);
        assertNotNull(_provider.createDispatcher(inOut));
    }
View Full Code Here

        assertNotNull(_provider.createDispatcher(inOut));
    }

    @Test
    public void testGetDispatcher() throws Exception {
        ServiceReference ref = new ServiceReferenceImpl(
            new QName("testGetDispatcher"), new InOnlyService(), null, null);
        Dispatcher dispatch = _provider.createDispatcher(ref);

        assertEquals(dispatch, _provider.getDispatcher(ref));
    }
View Full Code Here

    /**
     * Basic dispatcher test which verifies erroneous response from service.
     */
    @Test
    public void testServiceFault() {
        ServiceReference ref = registerInOutService("inOut", new ErrorExchangeHandler());
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertNoCause("Service is not implemented", exchange);
    }
View Full Code Here

    /**
     * Verify consumer callback is called when fault occurs on InOnly.
     */
    @Test
    public void testFaultReportedOnInOnly() {
        ServiceReference ref = registerInOnlyService("inOut", new ErrorExchangeHandler());
        MockHandler consumer = new MockHandler();
        Exchange exchange = ref.createExchange(consumer);
        exchange.send(exchange.createMessage().setContent("test"));
       
        Assert.assertEquals(1, consumer.waitForFaultMessage().getFaults().size());
    }
View Full Code Here

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

        ServiceReference ref = registerInOutService("inOut");
        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 testAfterProviderErrorInOut() {
        ErrorInterceptor interceptor = new ErrorInterceptor(true, ExchangeInterceptor.PROVIDER);
        _camelContext.getWritebleRegistry().put("interceptor", interceptor);
       
        ServiceReference ref = registerInOutService("inOut");
        Exchange exchange = sendMessage(ref, TEST_CONTENT);

        assertNoCause("Error after on target Provider", exchange);
        Assert.assertEquals(2, interceptor.getCount());
    }
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.