Package org.switchyard.internal

Examples of org.switchyard.internal.ServiceReferenceImpl


                qualified.getLocalPart());
    }
   
    @Test
    public void testUnqualifyReference() {
        ServiceReference reference = new ServiceReferenceImpl(
                ComponentNames.qualify(COMPONENT_NAME, SERVICE_NAME), null, null, null);
       
        QName unqualified = ComponentNames.unqualify(reference);
       
        Assert.assertEquals(COMPONENT_NAME.getNamespaceURI(), unqualified.getNamespaceURI());
View Full Code Here


        long afterStop = System.currentTimeMillis();
        Assert.assertTrue((afterStop - beforeStop) < 6000);
    }
   
    private ServiceReference registerInOutService(String name, ExchangeHandler handler) {
        ServiceReferenceImpl reference = new ServiceReferenceImpl(
                new QName(name), new InOutService(), _domain, null);
        _domain.registerService(new QName(name), new InOutService(), handler);
        reference.setDispatcher(_provider.createDispatcher(reference));
        return reference;
    }
View Full Code Here

        _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

    }

    @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

    private ServiceReference registerInOutService(String name) {
        return registerInOutService(name, new MockHandler().forwardInToOut());
    }

    private ServiceReference registerInOnlyService(String name, ExchangeHandler handler) {
        ServiceReferenceImpl reference = new ServiceReferenceImpl(new QName(name), new InOnlyService(), _domain, null);
        _domain.registerService(new QName(name), new InOnlyService(), handler);
        reference.setDispatcher(_provider.createDispatcher(reference));
        return reference;
    }
View Full Code Here

        reference.setDispatcher(_provider.createDispatcher(reference));
        return reference;
    }
   
    private ServiceReference registerInOutService(String name, ExchangeHandler handler) {
        ServiceReferenceImpl reference = new ServiceReferenceImpl(
                new QName(name), new InOutService(), _domain, null);
        _domain.registerService(new QName(name), new InOutService(), handler);
        reference.setDispatcher(_provider.createDispatcher(reference));
        return reference;
    }
View Full Code Here

   
    private ServiceReference registerInOutServiceWithTypes(
            String serviceName, QName inputType, QName outputType, ExchangeHandler handler) {
       
        InOutService intf = new InOutService(new InOutOperation("process", inputType, outputType));
        ServiceReferenceImpl reference = new ServiceReferenceImpl(
                new QName(serviceName),  intf, _domain, null);
        _domain.registerService(new QName(serviceName),  intf, handler);
        reference.setDispatcher(_provider.createDispatcher(reference));
        return reference;
    }
View Full Code Here

        _domain.addEventObserver(counter, ExchangeCompletionEvent.class);
       
        QName name = new QName("testDispatchInOnly");
        ExchangeSink sink = new ExchangeSink();
        Service service = new MockService(name, new InOnlyService(), sink);
        ServiceReference reference = new ServiceReferenceImpl(name, new InOnlyService(), null, null);
        ExchangeDispatcher dispatch = _provider.createDispatcher(reference);

        Exchange exchange = new CamelExchange(dispatch, new DefaultExchange(_camelContext), sink);
        exchange.consumer(reference, reference.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
        exchange.provider(service, service.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
        Message message = exchange.createMessage();
        exchange.send(message);
        Thread.sleep(200);
View Full Code Here

        ExchangeSink inHandler = new ExchangeSink(true);
        // consumer handler
        ExchangeSink outHandler = new ExchangeSink();

        Service service = new MockService(name, new InOutService(), inHandler);
        ServiceReference reference = new ServiceReferenceImpl(name, new InOutService(), null, null);
        Dispatcher dispatch = _provider.createDispatcher(reference);

        Exchange exchange = dispatch.createExchange(outHandler, ExchangePattern.IN_OUT);
        exchange.consumer(reference, reference.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
        exchange.provider(service, service.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION));
        Message message = exchange.createMessage();
        exchange.send(message.setContent(REQUEST));
        Thread.sleep(400);
View Full Code Here

TOP

Related Classes of org.switchyard.internal.ServiceReferenceImpl

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.