Package com.consol.citrus.exceptions

Examples of com.consol.citrus.exceptions.CitrusRuntimeException


        log.info("Receiving message from: " + destinationChannelName);

        Message message;
        if (StringUtils.hasText(selector)) {
            if (!(destinationChannel instanceof MessageSelectingQueueChannel)) {
                throw new CitrusRuntimeException("Message channel type '" + endpointConfiguration.getChannel().getClass() +
                        "' does not support selective receive operations.");
            }

            MessageSelector messageSelector = new DispatchingMessageSelector(selector, endpointConfiguration.getBeanFactory());
            MessageSelectingQueueChannel queueChannel = ((MessageSelectingQueueChannel) destinationChannel);

            if (timeout <= 0) {
                message = endpointConfiguration.getMessageConverter().convertInbound(queueChannel.receive(messageSelector), endpointConfiguration);
            } else {
                message = endpointConfiguration.getMessageConverter().convertInbound(queueChannel.receive(messageSelector, timeout), endpointConfiguration);
            }
        } else {
            if (!(destinationChannel instanceof PollableChannel)) {
                throw new CitrusRuntimeException("Invalid destination channel type " + destinationChannel.getClass().getName() +
                        " - must be of type PollableChannel");
            }

            endpointConfiguration.getMessagingTemplate().setReceiveTimeout(timeout);
            message = endpointConfiguration.getMessageConverter().convertInbound(
View Full Code Here


        if (endpointConfiguration.getChannel() != null) {
            return endpointConfiguration.getChannel();
        } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) {
            return resolveChannelName(endpointConfiguration.getChannelName());
        } else {
            throw new CitrusRuntimeException("Neither channel name nor channel object is set - " +
                    "please specify destination channel");
        }
    }
View Full Code Here

        if (endpointConfiguration.getChannel() != null) {
            return endpointConfiguration.getChannel().toString();
        } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) {
            return endpointConfiguration.getChannelName();
        } else {
            throw new CitrusRuntimeException("Neither channel name nor channel object is set - " +
                    "please specify destination channel");
        }
    }
View Full Code Here

                JSONObject tempControl = new JSONObject();
                tempControl.put("array", controlJson);
               
                validateJson(tempReceived, tempControl, context);
            } else {
                throw new CitrusRuntimeException("Unsupported json type " + receivedJson.getClass());
            }
        } catch (IllegalArgumentException e) {
            throw new ValidationException("Failed to validate JSON text:\n" + receivedJsonText, e);
        } catch (ParseException e) {
            throw new CitrusRuntimeException("Failed to parse JSON text", e);
        }
       
        log.info("JSON message validation finished successfully: All values OK");
    }
View Full Code Here

            groovyObject = (GroovyObject) groovyClass.newInstance();
           
            if (groovyObject instanceof TestCaseBuilder) {
                return ((TestCaseBuilder)groovyObject).build(applicationContext);
            } else {
                throw new CitrusRuntimeException("Unable to parse groovy script. Script must implement TestCaseBuilder.");
            }
        } catch (InstantiationException e) {
            throw new CitrusRuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new CitrusRuntimeException(e);
        } catch (CompilationFailedException e) {
            throw new CitrusRuntimeException(e);
        } catch (IOException e) {
            throw new CitrusRuntimeException(e);
        } finally {
            try {
                if (templateReader != null) {
                    templateReader.close();
                }
View Full Code Here

            for (SequenceBeforeTest sequenceBeforeTest : beforeTest) {
                try {
                    if (sequenceBeforeTest.shouldExecute(getName(), getPackageName(), null)) //TODO provide test group information
                        sequenceBeforeTest.execute(context);
                } catch (Exception e) {
                    throw new CitrusRuntimeException("Before test failed with errors", e);
                }
            }
        }
    }
View Full Code Here

            helloMarshaller.marshal(sayHello(helloRequest).getPayload(), result);
           
            return MessageBuilder.withPayload(result.toString()).copyHeaders(request.getHeaders()).build();
           
        } catch (XmlMappingException e) {
            throw new CitrusRuntimeException("Failed to marshal/unmarshal XML", e);
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed due to IO error", e);
        }
    }
View Full Code Here

     * @param parameterNames the parameter names to set
     * @param parameterValues the parameters to set
     */
    public void setParameters(String[] parameterNames, Object[] parameterValues) {
        if (parameterNames.length != parameterValues.length) {
            throw new CitrusRuntimeException(String.format("Invalid test parameter usage - received '%s' parameters with '%s' values",
                    parameterNames.length, parameterValues.length));
        }

        for (int i = 0; i < parameterNames.length; i++) {
            this.parameters.put(parameterNames[i], parameterValues[i]);
View Full Code Here

     */
    public RootQNameMessageSelector(String qNameString) {
        if (QNameUtils.validateQName(qNameString)) {
            this.rootQName = QNameUtils.parseQNameString(qNameString);
        } else {
            throw new CitrusRuntimeException("Invalid root QName string '" + qNameString + "'");
        }
    }
View Full Code Here

     */
    protected TestContext createTestContext() {
        try {
            return testContextFactory.getObject();
        } catch (Exception e) {
            throw new CitrusRuntimeException("Failed to create test context", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.exceptions.CitrusRuntimeException

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.