Package org.switchyard

Examples of org.switchyard.Message


    }

    @Test
    public void unknownHost() throws Exception {
        try {
            Message responseMsg = _proxyConsumerService1.operation(METHOD_NAME).sendInOut(INPUT);
        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("org.apache.http.NoHttpResponseException: unreachablehost")
                    || baos.toString().contains("UnknownHostException: unreachablehost"));
View Full Code Here


    }

    @Test
    public void authenticationMissing() throws Exception {
        try {
            Message responseMsg = _proxyConsumerService2.operation(METHOD_NAME).sendInOut(INPUT);
        } catch (Exception e) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            e.printStackTrace(new PrintStream(baos));
            Assert.assertTrue(baos.toString().contains("Error status 407 null returned"));
            // Newer version returns correct string e.g. WildFly's RESTEasy
View Full Code Here

    }

    @Ignore // Can be tested offline.
    @Test
    public void allIsWell() throws Exception {
        Message responseMsg = _proxyConsumerService3.operation(METHOD_NAME).sendInOut(INPUT);
        String response = responseMsg.getContent(String.class);
    }
View Full Code Here

        try {
            Object response =_implModel.injectExchange()
                    ? _var.invoke(exchange)
                    : _var.invoke(exchange.getMessage().getContent());
            if (response != null) {
                Message message = exchange.createMessage().setContent(response);
                exchange.send(message);
            }
               
        } catch (final Exception e) {
            QName declaredFault = exchange.getContract().getProviderOperation().getFaultType();
            if (declaredFault != null && QNameUtil.isJavaMessageType(declaredFault)
                    && QNameUtil.toJavaMessageType(declaredFault).isAssignableFrom(e.getClass())) {
                Message msg = exchange.createMessage().setContent(e);
                exchange.sendFault(msg);
            } else {
                throw new HandlerException(e);
            }
        }
View Full Code Here

        final String propertyKey = "testProp";
        final String propertyValue = "dummyValue";
        final Exchange exchange = _service.createExchange();
        exchange.getContext().setProperty(propertyKey, propertyValue, Scope.EXCHANGE);

        Message message = exchange.createMessage();
        message.getContext().setProperty(propertyValue, propertyKey);
        exchange.send(message);

        assertThat(camelEndpoint.getReceivedCounter(), is(1));
        org.apache.camel.Exchange ex = camelEndpoint.getReceivedExchanges().get(0);
        final String actualPropertyValue = (String) ex.getProperty(propertyKey);
View Full Code Here

    @Test
    public void routeInOutToCamel() throws Exception {
        final String body = "inOut test string";
        final Exchange exchange = _service.createExchange();
        final Message message = createMessageWithBody(exchange, body);

        exchange.send(message);

        final String payload = (String) exchange.getMessage().getContent();
        assertThat(payload, is(equalTo(body)));
View Full Code Here

     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    @Override
    public MappedRecordBindingData decompose(Exchange exchange, MappedRecordBindingData target) throws Exception {
        Message sourceMessage = exchange.getMessage();

        getContextMapper().mapTo(exchange.getContext(), target);
        final Map<?,?> content = sourceMessage.getContent(Map.class);
        target.getRecord().putAll(content);
        return target;
    }
View Full Code Here

                        Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
        if (getState() != State.STARTED) {
            throw JCAMessages.MESSAGES.referenceBindingNotStarted(_referenceName, _bindingName);
        }

        Message out = _processor.process(exchange);
        if (exchange.getContract().getProviderOperation().getExchangePattern() == ExchangePattern.IN_OUT) {
            exchange.send(out);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public StreamableRecordBindingData decompose(Exchange exchange, StreamableRecordBindingData target) throws Exception {
        Message sourceMessage = exchange.getMessage();

        getContextMapper().mapTo(exchange.getContext(), target);
        final InputStream content = sourceMessage.getContent(InputStream.class);
        target.getRecord().read(content);
        return target;
    }
View Full Code Here

        BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
        Service controlService = serviceDomain.registerService(serviceName, JavaService.fromClass(ControlProcess.class), handler);
        serviceDomain.registerServiceReference(controlService.getName(), controlService.getInterface(), controlService.getProviderHandler());
        handler.start();
        Invoker processInvoker = new Invoker(serviceDomain, serviceName);
        Message processResponse = processInvoker.operation("process").sendInOut(null);
        Long processInstanceId = (Long)processResponse.getContext().getPropertyValue(PROCESSS_INSTANCE_ID_PROPERTY);
        Invoker signalInvoker = new Invoker(serviceDomain, serviceName);
        signalInvoker.operation("signal").property(PROCESSS_INSTANCE_ID_PROPERTY, processInstanceId).sendInOut(null);
        handler.stop();
        Assert.assertEquals("message handled", holder.getValue());
    }
View Full Code Here

TOP

Related Classes of org.switchyard.Message

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.