Package org.switchyard.metadata

Examples of org.switchyard.metadata.InOnlyService


    public void customBindingData() throws Exception {
        List<Policy> policies = Arrays.<Policy>asList(SecurityPolicy.CONFIDENTIALITY);
        final MockHandler mockService = new MockHandler();
        _serviceDomain.registerService(
                new QName(_serviceName),
                new InOnlyService(),
                mockService,
                ServiceMetadataBuilder.create().security(_serviceDomain.getServiceSecurity(null))
                        .requiredPolicies(policies).registrant(new Binding(new ArrayList<BindingModel>())).build());
        _serviceDomain.registerServiceReference(new QName(_serviceName), new InOnlyService("process"));
        _camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("netty://foo").to("switchyard://" + _serviceName + "?operationName=process");
            }
View Full Code Here


        _mock.assertIsSatisfied();
    }

    public Exchange createExchange(MessageComposer<CamelBindingData> messageComposer) {
        QName serviceName = new QName("urn:test", "Service");
        ServiceInterface metadata = new InOnlyService(OPERATION_NAME);

        OutboundHandler handler = new OutboundHandler(_bindingModel, _camelContext, messageComposer, null) {
            {
                setState(State.STARTED);
            }
View Full Code Here

    private QName _serviceName;
    private ServiceInterface _serviceInterface;
    private ExchangeHandler _handler;
   
    public MockService(QName serviceName, ExchangeHandler handler) {
        this(serviceName, new InOnlyService(), handler);
    }
View Full Code Here

    }

    @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();
        ctx.setProperty("message-prop", "message-val", Scope.MESSAGE);
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);
View Full Code Here

    }

    @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

        _domain.addEventObserver(counter, ExchangeInitiatedEvent.class);
        _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));
View Full Code Here

    }
   
    @Test
    public void testUnregister() {
        Service service = _domain.registerService(new QName("TestService"),
                new InOnlyService(), new MockHandler());
        // test that it was added to the registry
        Assert.assertEquals(1, _domain.getServiceRegistry().getServices().size());
        service.unregister();
        // confirm that it was removed
        Assert.assertEquals(0, _domain.getServiceRegistry().getServices().size());
View Full Code Here

    private DomainImpl _domain;
   
    @Before
    public void setUp() throws Exception {
        _domain = new DomainImpl(new QName("test"));
        _domain.registerService(IN_ONLY_SERVICE, new InOnlyService(), new MockHandler());
        _domain.registerService(IN_OUT_SERVICE, new InOutService(), new MockHandler());
        _inOnlyReference = _domain.registerServiceReference(IN_ONLY_SERVICE, new InOnlyService());
        _inOutReference = _domain.registerServiceReference(IN_OUT_SERVICE, new InOutService());
    }
View Full Code Here

TOP

Related Classes of org.switchyard.metadata.InOnlyService

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.