Package org.switchyard.metadata

Examples of org.switchyard.metadata.InOutService


        CompositeServiceModel compositeService = composite.getServices().get(0);
        HttpBindingModel config = (HttpBindingModel)compositeService.getBindings().get(0);

        // Massive hack for Test Runner. Register both a service and a reference binding.
        _domain.registerService(config.getServiceName(), new InOutService(), mockService);
        _domain.registerServiceReference(config.getServiceName(), new HelloInterface());
        _httpInbound = new InboundHandler(config, _domain);
        _httpInbound.start();

        compositeService = composite.getServices().get(1);
View Full Code Here


            }
        };
        myMessageComposer.setContextMapper(new CamelContextMapper());
        QName serviceName = new QName(_serviceDomain.getName().getNamespaceURI(), "MessageComposerService");
        _serviceDomain.registerService(serviceName,
            new InOutService(),
            new OutboundHandler(bindingModel, (SwitchYardCamelContext) context, myMessageComposer, _serviceDomain) {
            {
                setState(State.STARTED);
            }
        }
        );
        _service = _serviceDomain.registerServiceReference(serviceName, new InOutService());
        Exchange exchange = _service.createExchange();
        exchange.send(exchange.createMessage().setContent("foo"));
        assertThat((Boolean)exchange.getContext().getProperty("decomposeInvoked").getValue(), is(true));
        assertThat((Boolean)exchange.getContext().getProperty("composeInvoked").getValue(), is(true));
    }
View Full Code Here

                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
        });
        serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(FAULT_RESULT_PROCESS_BPMN), ResourceType.BPMN2);
        KieBase kbase = kbuilder.newKnowledgeBase();
        KieSession ksession = kbase.newKieSession();
        SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
View Full Code Here

                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
        });
        serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(FAULT_EVENT_PROCESS_BPMN), ResourceType.BPMN2);
        KieBase kbase = kbuilder.newKnowledgeBase();
        KieSession ksession = kbase.newKieSession();
        SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
View Full Code Here

                if (bomb) {
                    throw new HandlerException("BOOM!");
                }
            }
        });
        serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(FAULT_BOUNDARY_PROCESS_BPMN), ResourceType.BPMN2);
        KieBase kbase = kbuilder.newKnowledgeBase();
        KieSession ksession = kbase.newKieSession();
        SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
View Full Code Here

            public void handleMessage(Exchange exchange) throws HandlerException {
                Holder h = exchange.getMessage().getContent(Holder.class);
                testAssertionMap.put("ServiceOne", h.getValue());
            }
        });
        Service serviceTwo = serviceDomain.registerService(new QName("ServiceTwo"), new InOutService(), new BaseHandler(){
            public void handleMessage(Exchange exchange) throws HandlerException {
                Holder h = exchange.getMessage().getContent(Holder.class);
                testAssertionMap.put("ServiceTwo", h.getValue());
            }
        });
View Full Code Here

    @Test
    public void sendToSwitchyardInOut() throws Exception {
        final String expectedResponse = "replacedContent";
        final String payload = "bajja";

        _serviceDomain.registerService(new QName(_serviceName), new InOutService(),
            new ResponseService(expectedResponse));
        _serviceDomain.registerServiceReference(new QName(_serviceName), new InOutService("process"));

        final String response = (String) template.requestBody("direct:input", payload);
        assertThat(response, is(equalTo(expectedResponse)));
    }
View Full Code Here

    private HTTPMixIn httpMixIn;

    @Test
    public void testWrapUnwrap() throws Exception {
        MockHandler provider = new MockHandler().forwardInToOut();
        testKit.registerInOutService("Payments", provider, new InOutService("submit"));
        String reply = httpMixIn.postResource("http://localhost:18001/Payments", "wrappedRequest.xml");
        String receivedPayload = provider.getMessages().poll(300, TimeUnit.MILLISECONDS)
                .getMessage().getContent(String.class);
       
        // verify request is unwrapped
View Full Code Here

    public Service registerService(QName serviceName,
            ServiceInterface contract, ExchangeHandler handler, ServiceMetadata metadata) {
       
        // If no service interface is provided, we default to InOutService
        if (contract == null) {
            contract = new InOutService();
        }
        // Create the service
        Service service = new ServiceImpl(serviceName, contract, this, handler, metadata);
        // register the service
        _serviceRegistry.registerService(service);
View Full Code Here

        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

TOP

Related Classes of org.switchyard.metadata.InOutService

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.