Package org.switchyard.metadata

Examples of org.switchyard.metadata.InOnlyService


    @Test
    public void testReuseHandler() throws Exception {
        BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(ReuseHandlerProcess.class).getImplementation();
        QName serviceName = new QName("ReuseHandler");
        BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
        Service service = serviceDomain.registerService(serviceName, new InOnlyService("process"), handler);
        serviceDomain.registerServiceReference(service.getName(), service.getInterface(), service.getProviderHandler());
        handler.start();
        new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(null);
        handler.stop();
        Assert.assertEquals("handler executed", ReuseHandler._holder.getValue());
View Full Code Here


    public void testRulesFired() throws Exception {
        final Holder holder = new Holder();
        BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(RulesFiredProcess.class).getImplementation();
        QName serviceName = new QName("RulesFired");
        BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
        Service service = serviceDomain.registerService(serviceName, new InOnlyService("process"), handler);
        serviceDomain.registerServiceReference(service.getName(), service.getInterface(), service.getProviderHandler());
        handler.start();
        new Invoker(serviceDomain, serviceName).operation("process").sendInOnly(holder);
        handler.stop();
        Assert.assertEquals("rules fired", holder.getValue());
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());
            }
        });
View Full Code Here

        invoker.start();

        // Serivce A is for app 1, Service B is for app 2
        final QName SERVICE_A = new QName("urn:test", "ServiceA");
        final QName SERVICE_B = new QName("urn:test", "ServiceB");
        ServiceReference referenceA = _domain.registerServiceReference(SERVICE_A, new InOnlyService());
        _domain.registerServiceReference(SERVICE_B, new InOnlyService());
        Service serviceA = _domain.registerService(SERVICE_A, new InOnlyService(), new MockHandler());
        _domain.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
View Full Code Here

       
        // two domains
        MockDomain domain1 = _domain;
        MockDomain domain2 = new MockDomain(domain1.getServiceRegistry());

        ServiceReference referenceA = domain1.registerServiceReference(SERVICE_A, new InOnlyService());
        Service serviceA = domain1.registerService(SERVICE_A, new InOnlyService(), new MockHandler());
        domain2.registerServiceReference(SERVICE_B, new InOnlyService());
        domain2.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
View Full Code Here

        SCAInvoker invoker = new SCAInvoker(config);
        invoker.start();

        // Create one valid but unregistered reference
        final QName SERVICE_A = new QName("urn:test", "ServiceA");
        ServiceReference referenceA = _domain.registerServiceReference(SERVICE_A, new InOnlyService());      

        Service serviceA = _domain.registerService(SERVICE_A, new InOnlyService(), null);
        _domain.registerService(SERVICE_A, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
View Full Code Here

        invoker.start();

        // urn:app1 is for app 1, urn:app2 is for app 2
        final QName SERVICE_A = new QName("urn:app1", "ServiceA");
        final QName SERVICE_B = new QName("urn:app2", "ServiceA");
        ServiceReference referenceA = _domain.registerServiceReference(SERVICE_A, new InOnlyService());
        _domain.registerServiceReference(SERVICE_B, new InOnlyService());
        Service serviceA = _domain.registerService(SERVICE_A, new InOnlyService(), new MockHandler());
        _domain.registerService(SERVICE_B, new InOnlyService(), _provider);
       
        MockExchange ex = new MockExchange();
        Message msg = ex.createMessage().setContent("TEST");
        ex.setMessage(msg);
        ex.consumer(referenceA, new InOnlyOperation(null));
View Full Code Here

        }
    }
   
    @Test
    public void noOperationName() throws Exception {
        domain.registerServiceReference(TEST_SERVICE, new InOnlyService());
        domain.registerService(TEST_SERVICE, new InOnlyService(), new MockHandler());
        RemoteMessage msg = new RemoteMessage()
            .setService(TEST_SERVICE);
        setRequestMessage(msg);
        servlet.doPost(request, response);
    }
View Full Code Here

    @Test
    public void sendToSwitchyardInOnly() throws Exception {
        final String payload = "bajja";
        final MockHandler mockService = new MockHandler();
        _serviceDomain.registerService(new QName(_serviceName), new InOnlyService(), mockService);
        _serviceDomain.registerServiceReference(new QName(_serviceName), new InOnlyService("process"));

        template.sendBody("direct:input", payload);

        assertThat(mockService.getMessages().size(), is(1));
        final String actualPayload = mockService.getMessages().iterator().next().getMessage().getContent(String.class);
View Full Code Here

        final String payload = "bajja";

        MockEndpoint endpoint = getMockEndpoint("mock:result");
        endpoint.expectedBodiesReceived(payload);
        final MockHandler mockService = new MockHandler().forwardInToOut();
        _serviceDomain.registerService(new QName(_serviceName), new InOnlyService(), mockService);
        _serviceDomain.registerServiceReference(new QName(_serviceName), new InOnlyService("process"));

        template.sendBody("direct:input", payload);

        assertThat(mockService.getMessages().size(), is(1));
        final String actualPayload = mockService.getMessages().iterator().next().getMessage().getContent(String.class);
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.