Giter Club home page Giter Club logo

citrus-samples's People

Contributors

christophd avatar dependabot[bot] avatar gucce avatar karnis avatar martinmaher avatar s1hofmann avatar sdenel avatar svettwer avatar turing85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

citrus-samples's Issues

Sample projects don't exist anymore

The sample projects from the table don't exist anymore. I am really interested in the project, can you point me to where the sample-bakery/flightbooking are now?

sample-bakery X X           X X
sample-flightbooking X X         X   X
sample-greeting X     X       X X
sample-bookstore X   X         X  
sample-incident X X X         X X
sample-javaee

Its possible to send payload to different Endpoints using Endpoints ID :

I am trying to send payload to end point using the Id of the end point which specified in the citrus-conext.xml : (using todo-xml sample):

<citrus-http:client id="todoListClient"
   request-url="http://localhost:8080"/>

1-i want to send the payload using the Id , like this code below but it doesn't work :

 http()
            .send("todoListClient")
            .post("/todolist")
            .contentType("application/xml")
            .payload(new ClassPathResource("templates/todo.xml"));

2-I would like to have information if its possible to send data to different end-points using the ids for each one in the test case ? , for the example in the context:xl file add one more end-point

<citrus-http:client id="todoListClient"
    request-url="http://localhost:8080"/>
<citrus-http:client id="nexID"
   request-url="http://localhost:8888"/>

Then in the test case i send to each end point like in the code below :

  http()
            .send("todoListClient")
            .post("/todolist")
            .contentType("application/xml")
            .payload(new ClassPathResource("templates/todo.xml"));

 http()
            .send("nextID")
            .post("/todolist")
            .contentType("application/xml")
            .payload(new ClassPathResource("templates/saied.xml"));

Dependency problem: cucumber-spring sample execution fails

[ERROR] Failed to execute goal on project citrus-sample-cucumber-spring: Could not resolve dependencies for project com.doubleslash:citrus-sample-cucumber-spring:jar:2.8.0: Failure to find com.consol.citrus.samples:citrus-sample-todo:jar:2.8.0 in http://labs.consol.de/maven/snapshots-repository/ was cached in the local repository, resolution will not be reattempted until the update interval of consol-labs-snapshots has elapsed or updates are forced -> [Help 1]

This problem occurs, when I try to execute 'mvn test' on Windows10 PowerShell in sub dir '/samples-cucumber/sample-cucumber-spring'

Update run page

The how to run page states to run one can use the -Dembedded switch:
mvn clean install -Dembedded=true

This didn't work for me and during my research for a solution I stumbled upon a SO post (by yours truly Christoph ;)) that suggested to use another switch:
mvn clean install -Dsystem.under.test.mode=embedded -fae

If you can point me to the file, I'll open a PR to update the page.

On another note, I had to build the todo app separately first:
mvn clean install -pl :citrus-sample-todo

because when I ran mvn clean install as suggested in the page, I got a a test failure in the bakery-web module. It seems that the the connection to the app couldn't be established. Not sure what was the problem there. I ran the tests for the http-samples directly which went fine.

mvn clean install -pl :citrus-sample-http -Dsystem.under.test.mode=embedded

[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (integration-tests) @ citrus-sample-http ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ citrus-sample-http ---
[INFO] Installing C:\Users\oderm\IdeaProjects\citrus-samples\samples-http\sample-http\target\citrus-sample-http-3.0.0-M2.jar to C:\Users\oderm\.m2\repository\com\consol\citrus\samples\citrus-sample-http\3.0.0-M2\citrus-sample-http-3
.0.0-M2.jar
[INFO] Installing C:\Users\oderm\IdeaProjects\citrus-samples\samples-http\sample-http\pom.xml to C:\Users\oderm\.m2\repository\com\consol\citrus\samples\citrus-sample-http\3.0.0-M2\citrus-sample-http-3.0.0-M2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  32.620 s
[INFO] Finished at: 2021-01-30T14:48:55+01:00
[INFO] ------------------------------------------------------------------------

mvn clean install output:

14:43:32,447 INFO  port.LoggingReporter|
14:43:32,447 INFO  port.LoggingReporter| TOTAL: 4
14:43:32,447 DEBUG port.LoggingReporter| SKIPPED:       0 (0.0%)
14:43:32,447 INFO  port.LoggingReporter| FAILED:        4 (100.0%)
14:43:32,447 INFO  port.LoggingReporter| SUCCESS:       0 (0.0%)
14:43:32,448 INFO  port.LoggingReporter|
14:43:32,448 INFO  port.LoggingReporter| ------------------------------------------------------------------------
14:43:32,448 DEBUG  report.HtmlReporter| Generating HTML test report
14:43:32,450 DEBUG       util.FileUtils| Reading file resource: 'test-detail.html' (encoding is 'windows-1252')
14:43:32,506 DEBUG       util.FileUtils| Reading file resource: 'test-report.html' (encoding is 'windows-1252')
14:43:32,511 INFO  ctOutputFileReporter| Generated test report: target\citrus-reports\citrus-test-results.html
14:43:32,512 DEBUG report.JUnitReporter| Generating JUnit test report
14:43:32,533 DEBUG       util.FileUtils| Reading file resource: 'junit-test-failed.xml' (encoding is 'windows-1252')
14:43:32,566 DEBUG       util.FileUtils| Reading file resource: 'junit-report.xml' (encoding is 'windows-1252')
[ERROR] Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 18.055 s <<< FAILURE! - in TestSuite
[ERROR] routeMessagesContentBased(com.consol.citrus.samples.bakery.RouteMessagesHttpIT)  Time elapsed: 4.4 s  <<< FAILURE!
com.consol.citrus.exceptions.TestCaseFailedException: I/O error on POST request for "http://localhost:18001/bakery/services/order": Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refus
ed: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeMessagesContentBased(RouteMessagesHttpIT.java:55)
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:18001/bakery/services/order": Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Con
nection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeMessagesContentBased(RouteMessagesHttpIT.java:55)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeMessagesContentBased(RouteMessagesHttpIT.java:55)
Caused by: java.net.ConnectException: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeMessagesContentBased(RouteMessagesHttpIT.java:55)

[ERROR] routeUnknownOrderType(com.consol.citrus.samples.bakery.RouteMessagesHttpIT)  Time elapsed: 3.878 s  <<< FAILURE!
com.consol.citrus.exceptions.TestCaseFailedException: I/O error on POST request for "http://localhost:18001/bakery/services/order": Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refus
ed: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeUnknownOrderType(RouteMessagesHttpIT.java:109)
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:18001/bakery/services/order": Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Con
nection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeUnknownOrderType(RouteMessagesHttpIT.java:109)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:18001 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeUnknownOrderType(RouteMessagesHttpIT.java:109)
Caused by: java.net.ConnectException: Connection refused: connect
        at com.consol.citrus.samples.bakery.RouteMessagesHttpIT.routeUnknownOrderType(RouteMessagesHttpIT.java:109)

[ERROR] routeMessagesContentBased(com.consol.citrus.samples.bakery.RouteMessagesJmsIT)  Time elapsed: 1.789 s  <<< FAILURE!
com.consol.citrus.exceptions.TestCaseFailedException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.Conne
ctException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeMessagesContentBased(RouteMessagesJmsIT.java:51)
Caused by: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.n
et.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeMessagesContentBased(RouteMessagesJmsIT.java:51)
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeMessagesContentBased(RouteMessagesJmsIT.java:51)
Caused by: java.net.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeMessagesContentBased(RouteMessagesJmsIT.java:51)

[ERROR] routeUnknownOrderType(com.consol.citrus.samples.bakery.RouteMessagesJmsIT)  Time elapsed: 2.399 s  <<< FAILURE!
com.consol.citrus.exceptions.TestCaseFailedException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.Conne
ctException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeUnknownOrderType(RouteMessagesJmsIT.java:78)
Caused by: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.n
et.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeUnknownOrderType(RouteMessagesJmsIT.java:78)
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeUnknownOrderType(RouteMessagesJmsIT.java:78)
Caused by: java.net.ConnectException: Connection refused: no further information
        at com.consol.citrus.samples.bakery.RouteMessagesJmsIT.routeUnknownOrderType(RouteMessagesJmsIT.java:78)

14:43:33,677 DEBUG icApplicationContext| Closing org.springframework.context.support.GenericApplicationContext@15043a2f, started on Sat Jan 30 14:43:17 CET 2021
14:43:33,679 DEBUG ntLifecycleProcessor| Destroying component 'workerChocolateEndpoint'
14:43:33,679 DEBUG ntLifecycleProcessor| Destroying component 'workerBlueberryEndpoint'
14:43:33,679 DEBUG ntLifecycleProcessor| Destroying component 'workerCaramelEndpoint'
14:43:33,679 DEBUG ntLifecycleProcessor| Destroying component 'bakeryOrderEndpoint'
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures: 
[ERROR]   RouteMessagesHttpIT>TestNGCitrusTest.run:58->TestNGCitrusTest.run:109->TestNGCitrusTest.invokeTestMethod:130 » TestCaseFailed
[ERROR]   RouteMessagesHttpIT>TestNGCitrusTest.run:58->TestNGCitrusTest.run:109->TestNGCitrusTest.invokeTestMethod:130 » TestCaseFailed
[ERROR]   RouteMessagesJmsIT>TestNGCitrusTest.run:58->TestNGCitrusTest.run:109->TestNGCitrusTest.invokeTestMethod:130 » TestCaseFailed
[ERROR]   RouteMessagesJmsIT>TestNGCitrusTest.run:58->TestNGCitrusTest.run:109->TestNGCitrusTest.invokeTestMethod:130 » TestCaseFailed
[INFO]
[ERROR] Tests run: 4, Failures: 4, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (integration-tests) @ citrus-bakery-web ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Citrus Samples:: Parent 3.0.0-M2:
[INFO]
[INFO] Citrus Samples:: Bakery ............................ SUCCESS [  0.458 s]
[INFO] Citrus Samples:: Bakery Web ........................ FAILURE [ 29.459 s]
[INFO] Citrus Samples:: Bakery Worker ..................... SKIPPED
[INFO] Citrus Samples:: Bakery Report ..................... SKIPPED
[INFO] Citrus Samples:: Bakery Integration ................ SKIPPED
[INFO] Citrus Samples:: Java EE ........................... SKIPPED
[INFO] Citrus Samples:: Flightbooking ..................... SKIPPED
[INFO] Citrus Samples:: Greeting: Java .................... SKIPPED
[INFO] Citrus Samples:: Bookstore ......................... SKIPPED
[INFO] Citrus Samples:: Incident .......................... SKIPPED
[INFO] Citrus Samples:: Demos ............................. SKIPPED
[INFO] Citrus Samples:: Todo App .......................... SKIPPED
[INFO] Citrus Samples:: Apache Camel Context .............. SKIPPED
[INFO] Citrus Samples:: Behaviors ......................... SKIPPED
[INFO] Citrus Samples:: Dictionaries ...................... SKIPPED
[INFO] Citrus Samples:: Message Store ..................... SKIPPED
[INFO] Citrus Samples:: Docker ............................ SKIPPED
[INFO] Citrus Samples:: Kubernetes ........................ SKIPPED
[INFO] Citrus Samples:: Cucumber BDD ...................... SKIPPED
[INFO] Citrus Samples:: Cucumber BDD Spring ............... SKIPPED
[INFO] Citrus Samples:: Cucumber BDD Spring 2 ............. SKIPPED
[INFO] Citrus Samples:: Cucumber Samples .................. SKIPPED
[INFO] Citrus Samples:: Annotation Config ................. SKIPPED
[INFO] Citrus Samples:: Java Config ....................... SKIPPED
[INFO] Citrus Samples:: Mail .............................. SKIPPED
[INFO] Citrus Samples:: Selenium .......................... SKIPPED
[INFO] Citrus Samples:: FTP ............................... SKIPPED
[INFO] Citrus Samples:: SFTP .............................. SKIPPED
[INFO] Citrus Samples:: SCP ............................... SKIPPED
[INFO] Citrus Samples:: FTP Samples ....................... SKIPPED
[INFO] Citrus Samples:: TestNG ............................ SKIPPED
[INFO] Citrus Samples:: Dataprovider ...................... SKIPPED
[INFO] Citrus Samples:: TestNG Samples .................... SKIPPED
[INFO] Citrus Samples:: JUnit ............................. SKIPPED
[INFO] Citrus Samples:: JUnit5 ............................ SKIPPED
[INFO] Citrus Samples:: JUnit Samples ..................... SKIPPED
[INFO] Citrus Samples:: Http :: Swagger API ............... SKIPPED
[INFO] Citrus Samples:: Http .............................. SKIPPED
[INFO] Citrus Samples:: Http Loadtest ..................... SKIPPED
[INFO] Citrus Samples:: Http Static Response .............. SKIPPED
[INFO] Citrus Samples:: Http Query Parameter .............. SKIPPED
[INFO] Citrus Samples:: Http Form Data .................... SKIPPED
[INFO] Citrus Samples:: Http Basic Auth ................... SKIPPED
[INFO] Citrus Samples:: Https ............................. SKIPPED
[INFO] Citrus Samples:: Http Samples ...................... SKIPPED
[INFO] Citrus Samples:: RMI ............................... SKIPPED
[INFO] Citrus Samples:: Reporting ......................... SKIPPED
[INFO] Citrus Samples:: XHTML ............................. SKIPPED
[INFO] Citrus Samples:: XML ............................... SKIPPED
[INFO] Citrus Samples:: OXM ............................... SKIPPED
[INFO] Citrus Samples:: XML Samples ....................... SKIPPED
[INFO] Citrus Samples:: JSON .............................. SKIPPED
[INFO] Citrus Samples:: Databind .......................... SKIPPED
[INFO] Citrus Samples:: Json Samples ...................... SKIPPED
[INFO] Citrus Samples:: Hamcrest .......................... SKIPPED
[INFO] Citrus Samples:: JMS ............................... SKIPPED
[INFO] Citrus Samples:: Kafka ............................. SKIPPED
[INFO] Citrus Samples:: Dynamic Endpoints ................. SKIPPED
[INFO] Citrus Samples:: Binary ............................ SKIPPED
[INFO] Citrus Samples:: WSDL .............................. SKIPPED
[INFO] Citrus Samples:: SOAP .............................. SKIPPED
[INFO] Citrus Samples:: SOAP MTOM ......................... SKIPPED
[INFO] Citrus Samples:: SOAP Attachments .................. SKIPPED
[INFO] Citrus Samples:: SOAP WsSecurity ................... SKIPPED
[INFO] Citrus Samples:: SOAP WsAddressing ................. SKIPPED
[INFO] Citrus Samples:: SOAP SSL .......................... SKIPPED
[INFO] Citrus Samples:: SOAP Static Response .............. SKIPPED
[INFO] Citrus Samples:: SOAP Samples ...................... SKIPPED
[INFO] Citrus Samples:: SQL ............................... SKIPPED
[INFO] Citrus Samples:: JDBC .............................. SKIPPED
[INFO] Citrus Samples:: JDBC Transactions ................. SKIPPED
[INFO] Citrus Samples:: JDBC Callable Statements .......... SKIPPED
[INFO] Citrus Samples:: DB Samples ........................ SKIPPED
[INFO] Citrus Samples:: Test JAR .......................... SKIPPED
[INFO] Citrus Samples:: Test WAR .......................... SKIPPED
[INFO] Citrus Samples:: Remote Samples .................... SKIPPED
[INFO] Citrus Samples:: Parent ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31.650 s
[INFO] Finished at: 2021-01-30T14:43:34+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.2:verify (integration-tests) on project citrus-bakery-web: There are test failures.

Need sample code for connecting to TIBCO EMS

I could able to prepare and run the testcases successfully by connecting to the Active MQ based on the sample code provided. For our project we need to connect to TIBCO EMS server for testing the application. But there is no sample code available how to connect to the TIBCO EMS server and configure the EMS endpoints. Please provide sample code for the same.

Alternatives to @MessageCreator

In the older version (2.8) there was an option create messages with methods annotated with MessageCreator. In the latest versions of citrus and cucumber what are the alternatives to declare and dynamically use such messages?

Need solution for Java way of testing direct camel component

Based on XML way of sample code given at below link for direct camel component, I tried changing it in Java way as below and ran the test case. But test case is not working. Please suggest how it can be written in Java.

Link for Sample code written in XML
https://labs.consol.de/citrus/development/2015/05/28/testing-apache-camel-part-2.html

Implemented code in Java as below.

EndPointConfig.java

import org.apache.camel.CamelContext;
import org.apache.camel.ExchangePattern;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.spring.SpringCamelContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import com.consol.citrus.channel.ChannelSyncEndpoint;
import com.consol.citrus.dsl.endpoint.CitrusEndpoints;

@configuration
@propertysource("citrus.properties")
public class EndPointConfig {

@Bean
public ChannelSyncEndpoint directHelloEndpoint() {
    return CitrusEndpoints
    		.channel()
    		.synchronous()
    		.name("direct:hello")
    	.build();
       
}
 
@Bean
public ChannelSyncEndpoint sedaHelloEndpoint() {
    return CitrusEndpoints
    		.channel()
    		.synchronous()
    		.name("seda:sayHello")
    	.build();
       
}

@Bean
public CamelContext camelContext() throws Exception {
    SpringCamelContext context = new SpringCamelContext();
    context.addRouteDefinition(new RouteDefinition()
        .from("direct:hello").routeId("helloRoute")
        .log("body after hello: ${body}")
        .to("seda:sayHello")
        .log("body after say hello: ${body}")
        .setExchangePattern(ExchangePattern.InOut)
        );
    return context;
}

}


Test case

import org.junit.Test;

import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.dsl.junit.JUnit4CitrusTestRunner;
import com.consol.citrus.message.MessageType;

public class SayHelloTest extends JUnit4CitrusTestRunner {

@Test
@CitrusTest
public void testMessage() {
    
    send(sendMessageBuilder -> sendMessageBuilder
            .endpoint("camel:sync:direct:input")
            .fork(true)
	        .messageType(MessageType.PLAINTEXT)
            .payload("Hello Camel!"));

	receive(receiveMessageBuilder -> receiveMessageBuilder
             .endpoint("camel:sync:seda:sayHello")
             .messageType(MessageType.PLAINTEXT)
             .payload("Hello Camel!"));
}

}


Console log trace with error details

00:16:07,396 INFO port.LoggingReporter|
00:16:07,396 DEBUG port.LoggingReporter| TEST STEP 1: send
00:16:07,401 DEBUG faultEndpointFactory| Found cached endpoint for uri 'camel:sync:direct:input'
00:16:07,401 DEBUG ns.SendMessageAction| Forking message sending action ...
00:16:07,407 INFO port.LoggingReporter|
00:16:07,408 DEBUG port.LoggingReporter| TEST STEP 1 SUCCESS
00:16:07,411 INFO port.LoggingReporter|
00:16:07,411 DEBUG port.LoggingReporter| TEST STEP 2: receive
00:16:07,414 DEBUG faultEndpointFactory| Found cached endpoint for uri 'camel:sync:seda:sayHello'
00:16:07,421 DEBUG nt.CamelSyncProducer| Sending message to camel endpoint: 'direct:input'
00:16:07,422 DEBUG ltCorrelationManager| Saving correlation key for 'citrus_message_correlator_CamelSyncEndpoint:producer'
00:16:07,422 DEBUG context.TestContext| Setting variable: citrus_message_correlator_CamelSyncEndpoint:producer with value: 'citrus_message_id = '162463a3-ae22-453b-b1d2-27c954804628''
00:16:07,423 DEBUG Logger.Message_OUT| DEFAULTMESSAGE [id: 162463a3-ae22-453b-b1d2-27c954804628, payload: Hello Camel!][headers: {citrus_message_type=PLAINTEXT, citrus_message_id=162463a3-ae22-453b-b1d2-27c954804628, citrus_message_timestamp=1626201967398}]
00:16:07,425 DEBUG nt.CamelSyncConsumer| Receiving message from camel endpoint: 'seda:sayHello'
00:16:07,431 DEBUG impl.ConsumerCache| <<<< seda://sayHello
00:16:07,431 DEBUG mpl.DefaultComponent| Creating endpoint uri=[direct://input], path=[input]
00:16:07,433 DEBUG impl.ConsumerCache| Adding to consumer cache with key: seda://sayHello for consumer: PollingConsumer on seda://sayHello
00:16:07,433 DEBUG g.SpringCamelContext| direct://input converted to endpoint: direct://input by component: org.apache.camel.component.direct.DirectComponent@5626d18c
00:16:07,436 DEBUG rectBlockingProducer| Starting producer: Producer[direct://input]
00:16:07,437 DEBUG impl.ProducerCache| Adding to producer cache with key: direct://input for producer: Producer[direct://input]
00:16:07,445 INFO nt.CamelSyncProducer| Message was sent to camel endpoint: 'direct:input'
00:16:07,445 DEBUG impl.ProducerCache| >>>> direct://input Exchange[]
00:16:07,950 DEBUG rectBlockingProducer| Waited 500 for consumer to be ready
00:16:08,451 DEBUG rectBlockingProducer| Waited 1001 for consumer to be ready
00:16:08,951 DEBUG rectBlockingProducer| Waited 1501 for consumer to be ready
00:16:09,451 DEBUG rectBlockingProducer| Waited 2001 for consumer to be ready
00:16:09,951 DEBUG rectBlockingProducer| Waited 2501 for consumer to be ready
00:16:10,452 DEBUG rectBlockingProducer| Waited 3002 for consumer to be ready
00:16:10,952 DEBUG rectBlockingProducer| Waited 3502 for consumer to be ready
00:16:11,453 DEBUG rectBlockingProducer| Waited 4003 for consumer to be ready
00:16:11,953 DEBUG rectBlockingProducer| Waited 4503 for consumer to be ready
00:16:12,436 INFO port.LoggingReporter|
00:16:12,437 ERROR port.LoggingReporter| TEST FAILED SayHelloTest.testMessage <com.telia.citrus.camel.direct> Nested exception is:
com.consol.citrus.exceptions.TestCaseFailedException: Action timed out while receiving message from camel endpoint 'seda:sayHello'
at com.consol.citrus.TestCase.executeAction(TestCase.java:227)
at com.consol.citrus.dsl.runner.DefaultTestRunner.run(DefaultTestRunner.java:188)
at com.consol.citrus.dsl.runner.DefaultTestRunner.receive(DefaultTestRunner.java:309)
at com.consol.citrus.dsl.junit.JUnit4CitrusTestRunner.receive(JUnit4CitrusTestRunner.java:210)
at com.telia.citrus.camel.direct.SayHelloTest.testMessage(SayHelloTest.java:21)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223)
at com.consol.citrus.dsl.junit.JUnit4CitrusTest.invokeTestMethod(JUnit4CitrusTest.java:99)
at com.consol.citrus.dsl.junit.JUnit4CitrusTest.run(JUnit4CitrusTest.java:70)
at com.consol.citrus.junit.CitrusJUnit4Runner$InvokeRunMethod.evaluate(CitrusJUnit4Runner.java:217)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:768)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: com.consol.citrus.exceptions.ActionTimeoutException: Action timed out while receiving message from camel endpoint 'seda:sayHello'
at com.consol.citrus.camel.endpoint.CamelSyncConsumer.receive(CamelSyncConsumer.java:70)
at com.consol.citrus.actions.ReceiveMessageAction.receive(ReceiveMessageAction.java:141)
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:120)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.TestCase.executeAction(TestCase.java:220)
... 36 more
00:16:12,441 INFO port.LoggingReporter| ------------------------------------------------------------------------
00:16:12,441 INFO port.LoggingReporter|
00:16:12,453 DEBUG rectBlockingProducer| Waited 5003 for consumer to be ready
00:16:12,455 INFO port.LoggingReporter|
00:16:12,455 INFO port.LoggingReporter| ------------------------------------------------------------------------
00:16:12,455 DEBUG port.LoggingReporter| AFTER TEST SUITE
00:16:12,455 INFO port.LoggingReporter|
00:16:12,455 INFO port.LoggingReporter|
00:16:12,456 INFO port.LoggingReporter| AFTER TEST SUITE: SUCCESS
00:16:12,456 INFO port.LoggingReporter| ------------------------------------------------------------------------
00:16:12,456 INFO port.LoggingReporter|
00:16:12,456 INFO port.LoggingReporter| ------------------------------------------------------------------------
00:16:12,456 INFO port.LoggingReporter|
00:16:12,456 INFO port.LoggingReporter| CITRUS TEST RESULTS
00:16:12,456 INFO port.LoggingReporter|
00:16:12,456 DEBUG g.SpringCamelContext| onApplicationEvent: org.springframework.context.event.ContextClosedEvent[source=org.springframework.context.support.GenericApplicationContext@6cc4cdb9: startup date [Wed Jul 14 00:16:03 IST 2021]; root of context hierarchy]
00:16:12,472 INFO port.LoggingReporter| SayHelloTest.testMessage ....................................... FAILED
00:16:12,473 INFO port.LoggingReporter| FAILURE: Caused by: TestCaseFailedException: Action timed out while receiving message from camel endpoint 'seda:sayHello'
00:16:12,474 INFO port.LoggingReporter|
00:16:12,474 INFO port.LoggingReporter| TOTAL: 1
00:16:12,474 DEBUG port.LoggingReporter| SKIPPED: 0 (0.0%)
00:16:12,474 INFO port.LoggingReporter| FAILED: 1 (100.0%)
00:16:12,474 INFO port.LoggingReporter| SUCCESS: 0 (0.0%)
00:16:12,475 INFO port.LoggingReporter|
00:16:12,475 INFO port.LoggingReporter| ------------------------------------------------------------------------
00:16:12,475 DEBUG report.HtmlReporter| Generating HTML test report

Unable to get the static SOAP Response

Issue:
I have my client at 9080 and my server at 9090. all my beans get initialized correctly, but my SOAP response is received at the same port as my request. Please help me correct my mistake. I need to hit a WS and receive a static response for it, and assert them.

Error:


15:35:30,770 INFO ent.WebServiceClient| SOAP message was sent to endpoint: 'http://localhost:9080/domain/customer/business/sca/xxxxxxWS'
15:35:30,770 INFO ent.WebServiceClient| Received SOAP response on endpoint: 'http://localhost:9080/domain/customer/business/sca/xxxxxWS'

15:42:11,444 DEBUG ltCorrelationManager| Saving correlated object for 'citrus_message_id = 'b3ed7860-580b-45fd-b48d-45ce99d60295''
15:42:11,444 INFO port.LoggingReporter|
15:42:11,444 DEBUG port.LoggingReporter| TEST STEP 1/2 SUCCESS
15:42:11,444 INFO port.LoggingReporter|
15:42:11,444 DEBUG port.LoggingReporter| TEST STEP 2/2: send
15:42:11,444 INFO port.LoggingReporter|
15:42:11,444 ERROR port.LoggingReporter| TEST FAILED MockTestIT.testDetermineInsuranceScoreMock <com.liberty.grm.products.citrus.integrationTest> Nested exception is:
com.consol.citrus.exceptions.CitrusRuntimeException: Unable to create endpoint for static endpoint adapter type 'class com.consol.citrus.endpoint.adapter.RequestDispatchingEndpointAdapter'

My Test File:


public class MockTestIT extends TestNGCitrusTestDesigner {

@Autowired
private WebServiceClient customerInformationMarketService;

@Autowired
private WebServiceServer mockServer;

@Test
@CitrusTest
public void testDetermineInsuranceScoreMock() {		
	
	soap()
	.client(customerInformationMarketService)
	.send()
	.soapAction("determineInsuranceScore")
	.payload(new ClassPathResource("templates/zzz.xml"));
	
	
soap()
	.server(mockServer)
	.send()
	.xpath("//IsSuccess", "true")
	.xpath("//RequestStatusCode", "AA");

}
}


My Config file


@configuration
public class MockConfig {

@Bean
public SoapMessageFactory messageFactory() {
	return new SaajSoapMessageFactory();
}



@Bean
public WebServiceClient customerInformationMarketService() {
	return CitrusEndpoints.soap().client()
			.defaultUri("http://localhost:9080/domain/customer/business/sca/xxxxWS")
		
			.build();
}

@Bean
public WebServiceServer wpsServer() throws Exception {
	return CitrusEndpoints.soap()
            .server()
            .port(9090)
            .endpointAdapter(dispatchingEndpointAdapter())
            .timeout(10000)
            .autoStart(true)
            .build();
}

@Bean
public RequestDispatchingEndpointAdapter dispatchingEndpointAdapter() {
    RequestDispatchingEndpointAdapter dispatchingEndpointAdapter = new RequestDispatchingEndpointAdapter();
    dispatchingEndpointAdapter.setMappingKeyExtractor(mappingKeyExtractor());
    dispatchingEndpointAdapter.setMappingStrategy(mappingStrategy());
    return dispatchingEndpointAdapter;
}

@Bean
public HeaderMappingKeyExtractor mappingKeyExtractor() {
    return new SoapActionMappingKeyExtractor();
}


@Bean
public SimpleMappingStrategy mappingStrategy() {
    SimpleMappingStrategy mappingStrategy = new SimpleMappingStrategy();

    Map<String, EndpointAdapter> mappings = new HashMap<>();

    mappings.put("determineInsuranceScore", determineInsuranceScoreResponseAdapter());
    
    mappingStrategy.setAdapterMappings(mappings);
    return mappingStrategy;
}

@Bean
public EndpointAdapter determineInsuranceScoreResponseAdapter() {
    StaticResponseEndpointAdapter endpointAdapter = new StaticResponseEndpointAdapter();
    endpointAdapter.setMessagePayload("<se:determineInsuranceScoreResponse\r\n" + 
			"	xmlns:se=\"http://pi.lmig.com/customerInformationMarketService\">" 
			+ "<response>"
			+ "<ID>-9.99999999734E11</ID>" 
			+ "<TrackingInformation>"
			+ "<ClientCorrelationID>123456789</ClientCorrelationID>"
			+ "<ServerAssignedID>b39f1275-99f2-4a5c-9bfc-10ac3d46b035" 
			+ "</ServerAssignedID>"
			+ "</TrackingInformation>"
			+ "<VersionInformation>"
			+ "<Description>CUSDBSPSV_2014_02_B1_TEST 11/21/2013 09:25AM and"
			+ "SHAREDPSV_2011_11_DEFAULT_B1</Description>" 
			+ "<Major>1</Major>" 
			+ "<Minor>0</Minor>"
			+ "</VersionInformation>" 
			+ "<IsSuccess>true</IsSuccess>" 
			+ "<InsuranceScore>"
			**+ "<RequestStatusCode>AA</RequestStatusCode>"** 
			+ "</InsuranceScore>" 
			+ "</response>"
			+ "</se:determineInsuranceScoreResponse");
    return endpointAdapter;
}   

}


Switching between environments eng. Dev, TEST

I am new to citrus and currently evaluating it's suitability for our project. I have created a sample project but I got stuck how I can switch between different environments like Spring-Boot has spring profiles. Is there any example of it switching between environment?

Cucumber and Http

I'm using cucumber and xml step definitions with the http module. I can send a request just fine, however in my second step when I have a <http:receive-response /> I cannot validate headers. I explicitly set a header to an expected value which is not returned and the test still passes.

version: 2.6.2

<http:receive-response client="myClient">
  <http:headers status="201" /> <!-- should fail, returned code is 200 -->
</http:receive-response>

Am I not using this correctly?

No example for procedure call using callable statement

Current callable example use JdbcServer and I got a requirement of connecting to Database and execute stored procedure but I don't know how that can be done without JdbcServer as I just need Datasource to do it.

Please point me if you have any example completely based on DataSource rather than JdbcServer which is what I have seen in your examples

Citrus - Soap request not getting sent

Hi,

I am new to Citrus Framework and exploring options to send SOAP API calls via Citrus Java DSL. I spent a lot of time and not being successful in sending the message. Can anyone please help?

This error has been a permanent one the whole day today - "com.consol.citrus.exceptions.TestCaseFailedException: org.springframework.ws.client.WebServiceTransportException: Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'. [415]" - Tried changing to SOAP 1.2 as well. I believe the problem is with namespace prefix!!

The request works fine in Postman -
It is a POST Request - https://..com/API/PromocodeService.svc
Headers include
Content-Type - application/soap+xml
SoapAction - http://tempuri.org/PCService_Def/GetPromocode
To - https://
*.********.com/API/promocodeservice.svc

<soap:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" >
soap:Header
<a:Action>http://tempuri.org/PCService_Def/GetPromocode</a:Action>
<a:To>https://.***.com/API/promocodeservice.svc</a:To>
</soap:Header>
soap:Body
<ns1:GetPromocode xmlns:ns1="http://tempuri.org/">
ns1:request
<ns2:Amount xmlns:ns2="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes">0.01</ns2:Amount>

                <ns3:Address1 xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:Address1>
                <ns3:Address2 xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:Address2>
                <ns3:City xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:City>
                <ns3:CountryCode xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:CountryCode>
                <ns3:EmailAddress xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary">{{email}}</ns3:EmailAddress>
                <ns3:FirstName xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary">{{firstName}}</ns3:FirstName>
                <ns3:LastName xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary">{{lastName}}</ns3:LastName>
                <ns3:PhoneNumber xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:PhoneNumber>
                <ns3:PostalCode xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"/>
                <ns3:State xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"/>
            </ns2:Customer>
            <ns2:EndClientId xmlns:ns2="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes"></ns2:EndClientId>
           <ns2:LocationId xmlns:ns2="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes">{{locationId}}</ns2:LocationId>
           
            <ns3:DistributionTemplate xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:DistributionTemplate>
            <ns3:ParticipantId xmlns:ns3="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary"></ns3:ParticipantId>
        </ns1:request>
    </ns1:GetPromocode>
</soap:Body>

</soap:Envelope>

The Response look like below -

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/PCService_Def/GetPromocodeResponse</a:Action>
00000000-0000-0000-0000-000000000000
</s:Header>
<s:Body>


0.01
2018-11-30T23:59:59
23wefswfjdsfn3432

            <ResponseCode xmlns="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes"/>
            <ResponseMessage xmlns="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes"/>
            <Status xmlns="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes">Valid</Status>
            <ErrorReason xmlns="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes"/>
            <TransactionId xmlns="http://schemas.datacontract.org/2004/07/PromcodeServiceLibrary.Classes">anfmanfda122343245</TransactionId>
        </GetPromocodeResult>
    </GetPromocodeResponse>
</s:Body>

</s:Envelope>

I need the value and the value from the response. The Steps I tried are taking soap samples java dsl.

Need solution for resolving the build issues for Camel spring boot application

Error and test case and POM flle details are as below. Please suggest solution for resolving this error.

Error details:

[ERROR] symbol: method camel()
[ERROR] location: class com.consol.citrus.HelloGreetingIT
[ERROR] /C:/suresh Devaki/D Drive/Suresh/Devaki/Telia/Misc/Tasks/Citus and Apache camel support/Source code-Citrus/citrus-sample-camel-context1/citrus-sample-camel-context1/src/test/java/com/consol/citrus/HelloGreetingIT.java:[25,39] cannot find symbol
[ERROR] symbol: method direct(java.lang.String)
[ERROR] location: class com.consol.citrus.HelloGreetingIT
[ERROR] /C:/suresh Devaki/D Drive/Suresh/Devaki/Telia/Misc/Tasks/Citus and Apache camel support/Source code-Citrus/citrus-sample-camel-con


EndpointConfig.java

/*

  • Copyright 2006-2017 the original author or authors.
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  • http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    */

package com.consol.citrus;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@configuration
@propertysource("citrus.properties")
public class EndpointConfig {

@Bean
public CamelContext camelContext() throws Exception {
    CamelContext context = new DefaultCamelContext();

    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:hello")
                .routeId("helloRoute")
                .to("log:com.consol.citrus.camel?level=INFO")
                .to("seda:greetings");
        }
    });

    return context;
}

}

HelloGreetingIT.java
package com.consol.citrus;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
//import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;

import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.camel.message.CamelMessageProcessor;
import com.consol.citrus.camel.message.CamelRouteProcessor;
import com.consol.citrus.message.MessageType;
import com.consol.citrus.testng.spring.TestNGCitrusSpringSupport;

@SuppressWarnings("deprecation")
public class HelloGreetingIT extends TestNGCitrusSpringSupport {

//Endpoint DSL support
@CitrusTest(name = "HelloGreeting_Ok_IT")
public void helloGreeting_Ok_1_Test() {
   
	send(camel().endpoint(direct("hello")::getUri))
    .message()
    .body("Hello from Citrus!");

	receive(camel().endpoint(seda("greetings")::getUri))
    .message()
    .type(MessageType.PLAINTEXT)
    .body("Hello from Citrus!");
	
}


@Autowired
private CamelContext camelContext;


//Camel processor support
@Test
@CitrusTest
public void shouldProcessMessages() {
    CamelMessageProcessor.Builder toUppercase = camel(camelContext)
            .process(exchange -> exchange
                    .getMessage()
                    .setBody(exchange.getMessage().getBody(String.class).toUpperCase()));

    $(send(camel().endpoint(seda("test")::getUri))
            .message()
            .body("Citrus rocks!")
            .process(toUppercase)
    );
    
    $(receive(camel().endpoint(seda("test")::getUri))
            .process(toUppercase)
            .message()
            .type(MessageType.PLAINTEXT)
            .body("CITRUS ROCKS!"));
}


//support to apply transformations
@Test
@CitrusTest
public void shouldTransformMessageReceived() {
    $(send(camel().endpoint(seda("hello")::getUri))
            .message()
            .body("{\"message\": \"Citrus rocks!\"}")
    );

    $(receive(camel().endpoint(seda("hello")::getUri))
            .transform(
                camel()
                    .camelContext(camelContext)
                    .transform()
                    .jsonpath("$.message"))
            .message()
            .type(MessageType.PLAINTEXT)
            .body("Citrus rocks!"));
}

//message processor  - able to apply a complete route logic as part of the test action.
@Test
@CitrusTest
public void shouldProcessRoute() {
    CamelRouteProcessor.Builder beforeReceive = camel(camelContext).route(route ->
            route.choice()
                .when(jsonpath("$.greeting[?(@.language == 'EN')]"))
                    .setBody(constant("Hello!"))
                .when(jsonpath("$.greeting[?(@.language == 'DE')]"))
                    .setBody(constant("Hallo!"))
                .otherwise()
                    .setBody(constant("Hi!")));

    $(send(camel().endpoint(seda("greetings")::getUri))
            .message()
            .body("{" +
                    "\"greeting\": {" +
                        "\"language\": \"EN\"" +
                    "}" +
                  "}")
    );

    $(receive("camel:" + camel().endpoints().seda("greetings").getUri())
            .process(beforeReceive)
            .message()
            .type(MessageType.PLAINTEXT)
            .body("Hello!"));
}


//Camel data format support
@org.testng.annotations.Test
@CitrusTest
public void shouldApplyDataFormat() {
    when(send(camel().endpoint(seda("data")::getUri))
            .message()
            .body("Citrus rocks!")
            .transform(camel(camelContext)
                    .marshal()
                    .base64())
    );

    then(receive("camel:" + camel().endpoints().seda("data").getUri())
            .transform(camel(camelContext)
                    .unmarshal()
                    .base64())
            .transform(camel(camelContext)
                    .convertBodyTo(String.class))
            .message()
            .type(MessageType.PLAINTEXT)
            .body("Citrus rocks!"));
}


@Test
@CitrusTest
public void createCamelRoute() {
    $(camel().camelContext(camelContext)
        .route()
        .create(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:messages")
                    .routeId("message-tokenizer")
                    .split().tokenize(" ")
                    .to("seda:words");
            }
        }));
}

}

pom.xml

4.0.0

com.consol.citrus.samples
citrus-sample-camel-context1
3.0.0
Citrus Samples:: Apache Camel Context

UTF-8 UTF-8 5.3.6 3.0.10.RELEASE 2.4.8.RELEASE 3.9.0 5.16.2 1.7.30 3.1.0 embedded 7.4.0 org.apache.maven.plugins maven-compiler-plugin 3.8.1 ${project.build.sourceEncoding} 11 11
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.2</version>
  </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.2</version>
    <configuration>
      <failIfNoTests>false</failIfNoTests>
      <workingDirectory>${project.build.directory}</workingDirectory>
    </configuration>
  </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.22.2</version>
    <executions>
      <execution>
        <id>integration-tests</id>
        <goals>
          <goal>integration-test</goal>
          <goal>verify</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

  <plugin>
    <groupId>org.apache.activemq.tooling</groupId>
    <artifactId>activemq-maven-plugin</artifactId>
    <version>${activemq.version}</version>
    <configuration>
      <fork>false</fork>
      <systemProperties>
        <property>
          <name>log4j.configuration</name>
          <value>log4j.properties</value>
        </property>
      </systemProperties>
    </configuration>
  </plugin>
</plugins>
org.springframework.ws spring-ws-core ${spring.ws.version} org.springframework.webflow spring-js ${spring.webflow.js.version} org.springframework spring-core ${spring.version} org.springframework spring-beans ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-aop ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-orm ${spring.version} org.springframework spring-oxm ${spring.version}
<!-- ActiveMQ broker-->
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-broker</artifactId>
  <version>${activemq.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-spring</artifactId>
  <version>${activemq.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.xbean</groupId>
  <artifactId>xbean-spring</artifactId>
  <version>4.5</version>
</dependency>

<!-- Apache Camel -->
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-spring-ws</artifactId>
  <version>${apache.camel.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jms</artifactId>
  <version>${apache.camel.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<!-- Logging -->
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
  <version>${slf4j.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>${slf4j.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <version>1.2</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-test</artifactId>
  <version>${spring.version}</version>
  <scope>provided</scope>
</dependency>

<!-- Citrus -->
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-api</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-base</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-spring</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-endpoint-catalog</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-testng</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-jms</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-http</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-ws</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-camel</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
    <groupId>com.consol.citrus</groupId>
    <artifactId>citrus-junit</artifactId>
    <version>3.0.0-M3</version>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-validation-xml</artifactId>
  <version>${citrus.version}</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-core</artifactId>
  <version>${citrus.version}</version>
</dependency><dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-java-dsl</artifactId>
  <version>${citrus.version}</version>
</dependency>
 <dependency>
  <groupId>com.consol.citrus</groupId>
  <artifactId>citrus-http</artifactId>
  <version>${citrus.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-endpointdsl</artifactId>
  <scope>provided</scope>
  <version>${apache.camel.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jms</artifactId>
  <version>${apache.camel.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>${testng.version}</version>
  <scope>test</scope>
</dependency>
consol-labs-snapshots http://labs.consol.de/maven/snapshots-repository/ true interval:10080 activemq-embedded system.under.test.mode embedded com.consol.citrus.mvn citrus-maven-plugin ${citrus.version} org.apache.activemq.tooling activemq-maven-plugin start-activemq pre-integration-test run true stop-activemq post-integration-test stop ---------------------------------------- citrus-application.properties citrus.spring.java.config=com.consol.citrus.EndpointConfig ----------------------------------------

Test case fails with not clear reason "expected 'true' but was 'true'" with enabled global dictionary

Hi,
I have enabled global dictionary:

<citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary" global-scope="true">
    <citrus:mappings>
        <citrus:mapping path="title" value="citrus:concat('Dictionary1_', citrus:randomNumber(4))"/>
        <citrus:mapping path="body" value="${body}"/>
        <citrus:mapping path="labels[0]" value="dictionary1.test"/>
        <citrus:mapping path="labels[1]" value="dictionary1.bug"/>
        <citrus:mapping path="labels[2]" value="dictionary1.feature"/>
    </citrus:mappings>
</citrus:json-data-dictionary>`

and the test case:

@CitrusTest @Parameters("designer")
public void DesignerSendJSONGetTest(@Optional @CitrusResource TestDesigner designer){
    designer.send("gitHubHttpClientJSON");
    designer.receive("gitHubHttpClientJSON")
            .messageType("json")
            .header("Status", "200 OK")
            .payload("{\n" +
                    "  \"login\": \"defunkt\",\n" +
                    "  \"id\": 2,\n" +
                    "  \"avatar_url\": \"https://avatars.githubusercontent.com/u/2?v=3\",\n" +
                    "  \"gravatar_id\": \"\",\n" +
                    "  \"url\": \"https://api.github.com/users/defunkt\",\n" +
                    "  \"html_url\": \"https://github.com/defunkt\",\n" +
                    "  \"followers_url\": \"https://api.github.com/users/defunkt/followers\",\n" +
                    "  \"following_url\": \"https://api.github.com/users/defunkt/following{/other_user}\",\n" +
                    "  \"gists_url\": \"https://api.github.com/users/defunkt/gists{/gist_id}\",\n" +
                    "  \"starred_url\": \"https://api.github.com/users/defunkt/starred{/owner}{/repo}\",\n" +
                    "  \"subscriptions_url\": \"https://api.github.com/users/defunkt/subscriptions\",\n" +
                    "  \"organizations_url\": \"https://api.github.com/users/defunkt/orgs\",\n" +
                    "  \"repos_url\": \"https://api.github.com/users/defunkt/repos\",\n" +
                    "  \"events_url\": \"https://api.github.com/users/defunkt/events{/privacy}\",\n" +
                    "  \"received_events_url\": \"https://api.github.com/users/defunkt/received_events\",\n" +
                    "  \"type\": \"User\",\n" +
                    "  \"site_admin\": true,\n" +
                    "  \"name\": \"Chris Wanstrath\",\n" +
                    "  \"company\": \"@github \",\n" +
                    "  \"blog\": \"http://chriswanstrath.com/\",\n" +
                    "  \"location\": \"San Francisco\",\n" +
                    "  \"email\": \"[email protected]\",\n" +
                    "  \"hireable\": true,\n" +
                    "  \"bio\": \"\uD83C\uDF54 \",\n" +
                    "  \"public_repos\": 107,\n" +
                    "  \"public_gists\": 273,\n" +
                    "  \"followers\": 15803,\n" +
                    "  \"following\": 208,\n" +
                    "  \"created_at\": \"2007-10-20T05:24:19Z\",\n" +
                    "  \"updated_at\": \"2016-09-13T19:41:49Z\"\n" +
                    "}")
            .ignore("bio")
            .ignore("followers");
}

And with enabled global dictionary ( global-scope="true") this test fails with strange reason

Values not equal for entry: 'site_admin', expected 'true' but was 'true'

The log:

TEST FAILED TestMessages_1.DesignerSendJSONGetTest2 <com.revenue.integration> Nested exception is: 
com.consol.citrus.exceptions.ValidationException: Failed to validate JSON text:
{"login":"defunkt","id":2,"avatar_url":"https://avatars.githubusercontent.com/u/2?v=3","gravatar_id":"","url":"https://api.github.com/users/defunkt","html_url":"https://github.com/defunkt","followers_url":"https://api.github.com/users/defunkt/followers","following_url":"https://api.github.com/users/defunkt/following{/other_user}","gists_url":"https://api.github.com/users/defunkt/gists{/gist_id}","starred_url":"https://api.github.com/users/defunkt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/defunkt/subscriptions","organizations_url":"https://api.github.com/users/defunkt/orgs","repos_url":"https://api.github.com/users/defunkt/repos","events_url":"https://api.github.com/users/defunkt/events{/privacy}","received_events_url":"https://api.github.com/users/defunkt/received_events","type":"User","site_admin":true,"name":"Chris Wanstrath","company":"@github ","blog":"http://chriswanstrath.com/","location":"San Francisco","email":"[email protected]","hireable":true,"bio":"🍔 ","public_repos":107,"public_gists":273,"followers":15816,"following":208,"created_at":"2007-10-20T05:24:19Z","updated_at":"2016-09-13T19:41:49Z"} Values not equal for entry: 'site_admin', expected 'true' but was 'true'
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:98)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:52)
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:65)
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:50)
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:203)
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:133)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.TestCase.executeAction(TestCase.java:214)
at com.consol.citrus.TestCase.doExecute(TestCase.java:142)
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
at com.consol.citrus.Citrus.run(Citrus.java:254)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.invokeTestMethod(TestNGCitrusTest.java:124)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:100)
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:58)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:209)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.IllegalArgumentException: Values not equal for entry: 'site_admin', expected 'true' but was 'true'
at org.springframework.util.Assert.isTrue(Assert.java:68)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateJson(JsonTextMessageValidator.java:195)
at com.consol.citrus.validation.json.JsonTextMessageValidator.validateMessagePayload(JsonTextMessageValidator.java:86)
... 39 more

With disabled global dictionary (global-scope="false") test case passes. So how can I have test case passed with enabled global dictionary?

Compilation failure in citrus-sample-soap-wssecurity

I tried to move my Citrus testcase to Java configuration based on a sample but always got a compiler error. Finally I found that the sample itself does not compile.

The interceptors method on WebServiceServerBuilder wants a List of org.springframework.web.servlet.HandlerInterceptor but instead get a List of org.springframework.ws.server.EndpointInterceptor

Compilation failure [ERROR] citrus-samples/sample-soap-wssecurity/src/test/java/com/consol/citrus/samples/todolist/EndpointConfig.java:[99,49] incompatible types: java.util.List<org.springframework.ws.server.EndpointInterceptor> cannot be converted to java.util.List<org.springframework.web.servlet.HandlerInterceptor>

Citrus-Version set to 2.7.2 release since the consol repository is not reachable due to network restrictions.

Missed info about oxm sample

At the https://github.com/christophd/citrus-samples/tree/master/sample-oxm page and at the online help some important info is missed:

  1. together with adding marshaller bean we need to add into citrus-context.xml file in the xsi:schemaLocation section this info:
    "http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-4.3.xsd"
  2. it would be nice to have info that except the message object class we also need ObjectFactory class at the model package (I'm novice in java so for now I simply copied it into my project from this sample to have my test working. But I still don't understand the logic)

Reduce/review Citrus samples

The Citrus samples repository contains a vast amount of sample projects using Citrus’s Java and XML DSLs. The goal of these sample projects is to demonstrate how the functionality should be used . Over time the number of samples has grown so large that it is now quite confusing for new users. That is why we want to review the Citrus samples completely and create a set that reflects the main functionality of the framework while making them easy to understand and a good point to start from. To achieve this, we will focus on samples for the high priority modules and reduce the number of samples for low priority modules.

sample-http-loadtest fails most of the time with ConcurrentModificationException

Citrus Version
2.8.0

Expected behavior
Test should pass.

Actual behavior
~10% of the time, the test will actually pass. In the other cases, the test will fail with:

[ERROR] testAddTodo(com.consol.citrus.samples.todolist.TodoListLoadTestIT)  Time elapsed: 0.535 s  <<< FAILURE!
com.consol.citrus.exceptions.TestCaseFailedException: Test case failed
Caused by: java.util.ConcurrentModificationException

Test case sample

> cd /path/to/citrus-samples
> mvn verify -Dembedded -pl :citrus-java-sample-http-loadtest
> mvn verify -Dembedded -pl :citrus-xml-sample-http-loadtest

Autowire doesn't work

Hi
I've created an application similar to it. But autowire doesn't work in my application. And also when I use citrusReporter as a plugin I'm getting exception.

My definitions look as below

@RunWith(Cucumber.class)
@CucumberOptions(
		strict = true,
        features = "classpath:Features",
        plugin = {/*"com.consol.citrus.cucumber.CitrusReporter",*/"pretty", "junit:target/cucumber.xml", "json:target/cucumber.json" },
        glue = {"com.consol.citrus.cucumber.step.designer.core","com.consol.citrus.cucumber.step.designer.http","com.................cucumber.stepDefinition"})
public class CucumberClientIT {
}

@SuppressWarnings("SpringJavaAutowiringInspection")
@ContextConfiguration(classes = CitrusSpringConfig.class)
public class Steps {
	
	@CitrusResource
    private TestDesigner designer;

    @Autowired
	//@CitrusEndpoint  -->WHEN I use this instead autowiring it gives me null pointer when I make a call at designer.http
    private HttpClient todoListClient;
    
@And("^I make a \"([^\"]*)\" request to the \"([^\"]*)\"$")
	public void i_make_a_request_to_the(String requestType, String URL) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
		designer.http()
			.client(todoListClient)
			.send()
			.get("/demo/?name=jc&city=laramie&stateProvince=WY");	
	}
}
@Configuration
@PropertySource("citrus.properties")
public class EndpointConfig {

    @Bean
    public GlobalVariables globalVariables() {
        GlobalVariables variables = new GlobalVariables();
        variables.getVariables().put("project.name", "Citrus Integration Tests");
        return variables;
    }

    @Bean
    public HttpClient todoListClient() {
        return CitrusEndpoints.http()
                .client()
                .requestUrl("http://localhost:8080")
                .build();
    }
}
Cucumber.properties:
cucumber.api.java.ObjectFactory=cucumber.runtime.java.spring.CitrusSpringObjectFactory

https://github.com/citrusframework/citrus-samples/blob/master/samples-cucumber/sample-cucumber-spring/java-dsl/src/test/java/todo/TodoSteps.java

cucumber.runtime.CucumberException: Error creating bean with name 'com.............cucumber.stepDefinition.Steps': Unsatisfied dependency expressed through field 'todoListClient'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.consol.citrus.http.client.HttpClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
	at cucumber.runtime.java.spring.SpringFactory.getInstance(SpringFactory.java:251)
	at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
	at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
	at cucumber.runtime.Runtime.runStep(Runtime.java:299)
	at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
	at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
	at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
	at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.api.junit.Cucumber.run(Cucumber.java:98)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.esrx.eds.location.cucumber.stepDefinition.Steps': Unsatisfied dependency expressed through field 'todoListClient'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.consol.citrus.http.client.HttpClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:351)
	at cucumber.runtime.java.spring.GlueCodeScope.get(GlueCodeScope.java:14)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:346)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:220)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1018)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:345)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
	at cucumber.runtime.java.spring.SpringFactory.getInstance(SpringFactory.java:249)
	... 31 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.consol.citrus.http.client.HttpClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
	... 44 more

2.8.0-SNAPSHOT

Seems like the 2.8.0-SNAPSHOT samples are not present in the repository.Can you please add them?

Error: Invalid or corrupt jarfile /app/app.jar

Following the steps to run sample-docker:
https://github.com/citrusframework/citrus-samples/tree/master/sample-docker/java-dsl

I was ok up until mvn docker:start

This is what I'm seeing:
[INFO] --- docker-maven-plugin:0.26.0:start (default-cli) @ citrus-java-sample-docker ---
[INFO] DOCKER> [citrusframework/todo-demo-app:1.1.0] "todo-app": Start container 5f93a0f729f4
[INFO] DOCKER> [citrusframework/todo-demo-app:1.1.0] "todo-app": Waiting on url http://localhost:8080/todolist with method GET for status 200.
11:17:18.304 todo-app> Error: Invalid or corrupt jarfile /app/app.jar
Error: Invalid or corrupt jarfile /app/app.jar
5f93a0Error: Invalid or corrupt jarfile /app/app.jar

[ERROR] DOCKER> [citrusframework/todo-demo-app:1.1.0] "todo-app": Container stopped with exit code 1 unexpectedly after 801 ms while waiting on url http://localhost:8080/todolist
[ERROR] DOCKER> Error occurred during container startup, shutting down...

Remove unnecessary surefire excludes

The maven-surefire documentation states:

By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:

* "**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
* "**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
* "**/*Tests.java" - includes all of its subdirectories and all Java filenames that end with "Tests".
* "**/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".

Therefore it's not required to exclude (^IT.*|.*IT)\.java tests in the configuration.

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.</version>
  <configuration>
    <forkMode>once</forkMode>
    <failIfNoTests>false</failIfNoTests>
    <!-- Not required -->
    <!-- <excludes> -->
      <!-- <exclude>**/IT*.java</exclude> -->
      <!-- <exclude>**/*IT.java</exclude> -->
    <!-- </excludes> -->
    <workingDirectory>${project.build.directory}</workingDirectory>
  </configuration>
</plugin>

Could not resolve dependencies for samples project

Failed to execute goal on project citrus-bakery-web: Could not resolve dependencies for project com.consol.citrus.samples:citrus-bakery-web:war:2.6.3-SNAPSHOT

Any help?? I just followed the instructions

FTP Remote Dir

Hello,

I would like to get help on Citrus-ftp:client remote directory function. I can not find any option where the remote directory name can be specified while FTP.

thanks

Is it possible to use test variables in Assert.assertEquals method?

Hi,
I'm trying to validate received response using defined test variable as expected result, but it is not recognized as variable in Assert.assertEquals method (test variable name is taken as string). I've already solved this problem using java variables (commented within provided code), but would like to know if it is possible to use test variables anyway.

    @CitrusTest
        public void createIssue(){
        String user = "olha-bastieieva"; 

        /*int append = new Random().nextInt(9999);
        String tmp = "Title";
        tmp = tmp + append;
        final String title = tmp;*/

        variable("title", "citrus:concat('Title', citrus:randomNumber(4))");
        variable("body", "citrus:randomString(10)");
        String[] labels = new String[]{"label", "bug"};

        http()
                .client(jsonClientLogged)
                .send()
                .post("/repos/" + user + "/Citrus_test/issues")
                .contentType("application/json")
                .messageType(MessageType.JSON)
                //.payload(new IssueEntry(title, "${body}", labels), mapper);
                .payload(new IssueEntry("${title}", "${body}", labels), mapper);

        http()
                .client(jsonClientLogged)
                .receive()
                .response(HttpStatus.CREATED)
                .statusCode(201)
                .messageType(MessageType.JSON)
                .validationCallback(new JsonMappingValidationCallback<IssueResponse>(IssueResponse.class, mapper) {
                    @Override
                    public void validate(IssueResponse ir_payload, Map<String, Object> headers, TestContext context) {
                        Assert.assertNotNull(ir_payload);
                        //Assert.assertEquals(ir_payload.getTitle(), title);
                        Assert.assertEquals(ir_payload.getTitle(), "${title}"); //variable title is not recognized as variable, taken as string
                        Assert.assertEquals(ir_payload.user.getLogin(), user);
                    }
                });

How to mock service correctly?

Hi,
I want to mock different services in my test case, with validation of received request and response with certain payload. For now I tried with small test client which sends request to my Citrus http-server, receives response and sends back response with received payload.
When I'm using static-response-adapter, seems that everything works correctly. But when I'm trying to use http-server methods in my test case, test case fails at the last step (receive response from client) with error

[Fatal Error] :-1 :-1 : Premature end of file.

Could you please advice how should I set up my mocked service correctly?

My failed test case is:

    @CitrusTest
    public void testRequest2(){
        http()
                .client("sandboxClient")
                .get("/");

        http()
                .server("sandboxServer2")
                .receive()
                .get();
        http()
                .server("sandboxServer2")
                .send()
                .response(HttpStatus.OK)
                .payload("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "            <message>\n" +
                        "                <body>\n" +
                        "                    <StartResponse xmlns=\"http://www.revenue.ie/schemas/customs/evr/processes/v1/processes/core/MSRefProRata/MSRefProRata\">WTF</StartResponse>\n" +
                        "                </body>\n" +
                        "            </message>")
                .contentType("application/xml");

        http()
                .client("sandboxClient")
                .response()
                .messageType("xml")
                .payload("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "            <message>\n" +
                        "                <body>\n" +
                        "                    <StartResponse xmlns=\"http://www.revenue.ie/schemas/customs/evr/processes/v1/processes/core/MSRefProRata/MSRefProRata\">WTF</StartResponse>\n" +
                        "                </body>\n" +
                        "            </message>");

}

Configured client and server:

 <citrus-http:server id="sandboxServer2"

                    resource-base="test1/"
                    port="8080"
                    auto-start="true"/>
<citrus-http:client id="sandboxClient"
                    request-url="http://localhost:9090/sandbox_client.php"
                    request-method="GET"
                    content-type="application/xml"
                    timeout="60000"/>`

Working test case:

@CitrusTest
public void testRequest1() {
    http()
            .client("sandboxClient")
            .get("/");

    http()
            .client("sandboxClient")
            .response()
            .messageType("xml")
            .payload("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "            <message>\n" +
                    "                <body>\n" +
                    "                    <StartResponse xmlns=\"http://www.revenue.ie/schemas/customs/evr/processes/v1/processes/core/MSRefProRata/MSRefProRata\">WTF</StartResponse>\n" +
                    "                </body>\n" +
                    "            </message>");

} 

and declared adapter:

<citrus:static-response-adapter id="sandboxEndpointAdapter">
    <citrus:payload>
        <![CDATA[
        <?xml version="1.0" encoding="UTF-8"?>
        <message>
            <body>
                <StartResponse xmlns="http://www.revenue.ie/schemas/customs/evr/processes/v1/processes/core/MSRefProRata/MSRefProRata">WTF</StartResponse>
            </body>
        </message>
        ]]>
    </citrus:payload>
</citrus:static-response-adapter>`

citrus and smpp

Is it possible to implement using citrus support with the smpp protocol?

how to send large bytes to http endpoint

hi, i'm looking for how to send a large number of bytes to an endpoint to test the max threshhold on the api. currently, api accepts 100k, but would like to have a test showing it can accept 1mb post. i've been struggling with coding a simple example.

Data dictionary - is it possible to define different amount of array items?

Hi,
I have payload template like:
{
"title": "New title",
"body": "Issue is present",
"labels": ["test"]
}

and in my test case I want to use dictionary to re-assign "labels" value with another amount of items (dictionary:

<citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary" global-scope="true">
    <citrus:mappings>
        <citrus:mapping path="title" value="citrus:concat('Dictionary1_', citrus:randomNumber(4))"/>
        <citrus:mapping path="body" value="${body}"/>
        <citrus:mapping path="labels[0]" value="dictionary1.test"/>
        <citrus:mapping path="labels[1]" value="dictionary1.bug"/>
        <citrus:mapping path="labels[2]" value="dictionary1.feature"/>
    </citrus:mappings>
</citrus:json-data-dictionary>`

However during test case execution only one label is being assigned (so "test" from template is being replaced with "dictionary1.test"). Is it possible to have several items added without adding their placeholders into template?

Issues while Mock SOAP response - Static response adapter

Issues : I am following the sample in the Soap-static-response, to mock on of my service response. I am trying to mock the response form a IBM BPM server on port 9080. I have the same port for the client and server as in the example. I am unable to run my test. I find the same error when i run the sample test too. I am running the test on Win 7 machine.

Error:
icApplicationContext| Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wpsServer' defined in class path resource [com/consol/citrus/samples/bpm/MockConfig.class]: Invocation of init method failed; nested exception is com.consol.citrus.exceptions.CitrusRuntimeException: java.net.BindException: Address already in use: bind
15:45:53,332 ERROR t.TestContextManager| Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5bd03f44] to prepare test instance [com.liberty.grm.products.citrus.integrationTest.MockTestIT@76508ed1]
java.lang.IllegalStateException: Failed to load ApplicationContext

Config file :

@configuration
public class MockConfig {

@Bean
public SoapMessageFactory messageFactory() {
	return new SaajSoapMessageFactory();
}

@Bean
public WebServiceServer wpsServer() throws Exception {
    return CitrusEndpoints.soap()
            .server()
            .port(9080)
            .endpointAdapter(dispatchingEndpointAdapter())
            .timeout(10000)
            .autoStart(true)
            .build();
}

@Bean
public WebServiceClient customerInformationMarketService() {
	return CitrusEndpoints.soap().client()
			.defaultUri("http://localhost:9080/domain/cccc/cccc/sca/zzzzzzzzServiceWS")
			.build();
}

@Bean
public RequestDispatchingEndpointAdapter dispatchingEndpointAdapter() {
    RequestDispatchingEndpointAdapter dispatchingEndpointAdapter = new RequestDispatchingEndpointAdapter();
    dispatchingEndpointAdapter.setMappingKeyExtractor(mappingKeyExtractor());
    dispatchingEndpointAdapter.setMappingStrategy(mappingStrategy());
    return dispatchingEndpointAdapter;
}

@Bean
public HeaderMappingKeyExtractor mappingKeyExtractor() {
    return new SoapActionMappingKeyExtractor();
}



@Bean
public SimpleMappingStrategy mappingStrategy() {
    SimpleMappingStrategy mappingStrategy = new SimpleMappingStrategy();

    Map<String, EndpointAdapter> mappings = new HashMap<>();

    mappings.put("getInsScore", getInsScoreResponseAdapter());
    mappingStrategy.setAdapterMappings(mappings);
    return mappingStrategy;
}

@Bean
public EndpointAdapter getInsScoreResponseAdapter() {
    StaticResponseEndpointAdapter endpointAdapter = new StaticResponseEndpointAdapter();
    endpointAdapter.setMessagePayload("<se:determineInsuranceScoreResponse\r\n" + 
			"	xmlns:se=\"http://pi.lmig.com/customerInformationMarketService\">" 
			+ "<response>"
			+ "<ID>-9.99999999734E11</ID>" 
			+ "<TrackingInformation>"
			+ "<ClientCorrelationID>123456789</ClientCorrelationID>"
			+ "<ServerAssignedID>b39f1275-99f2-4a5c-9bfc-10ac3d46b035" 
			+ "</ServerAssignedID>"
			+ "</TrackingInformation>"
			+ "<VersionInformation>"
			+ "<Description>CUSDBSPSV_2014_02_B1_TEST 11/21/2013 09:25AM and"
			+ "SHAREDPSV_2011_11_DEFAULT_B1</Description>" 
			+ "<Major>1</Major>" 
			+ "<Minor>0</Minor>"
			+ "</VersionInformation>" 
			+ "<IsSuccess>true</IsSuccess>" 
			+ "<InsuranceScore>"
			+ "<RequestStatusCode>NE</RequestStatusCode>" 
			+ "</InsuranceScore>" 
			+ "</response>"
			+ "</se:determineInsuranceScoreResponse");
    return endpointAdapter;
}

}


Test file :

@Autowired
private WebServiceClient customerInformationMarketService;

@Test
@CitrusTest
public void testTodo() {
	soap()
	.client(customerInformationMarketService)
	.send()
	.soapAction("myAction")
	.payload(new ClassPathResource("templates/myRequest.xml"));

	soap()
	.client(customerInformationMarketService)
	.receive()
			.payload("<se:determineInsuranceScoreResponse\r\n" + 
					"	xmlns:se=\"http://pi.lmig.com/customerInformationMarketService\">" 
					+ "<response>"
					+ "<ID>-9.99999999734E11</ID>" 
					+ "<TrackingInformation>"
					+ "<ClientCorrelationID>123456789</ClientCorrelationID>"
					+ "<ServerAssignedID>b39f1275-99f2-4a5c-9bfc-10ac3d46b035" 
					+ "</ServerAssignedID>"
					+ "</TrackingInformation>"
					+ "<VersionInformation>"
					+ "<Description>CUSDBSPSV_2014_02_B1_TEST 11/21/2013 09:25AM and"
					+ "SHAREDPSV_2011_11_DEFAULT_B1</Description>" 
					+ "<Major>1</Major>" 
					+ "<Minor>0</Minor>"
					+ "</VersionInformation>" 
					+ "<IsSuccess>true</IsSuccess>" 
					+ "<InsuranceScore>"
					+ "<RequestStatusCode>NE</RequestStatusCode>" 
					+ "</InsuranceScore>" 
					+ "</response>"
					+ "</se:determineInsuranceScoreResponse");
}

}

Question regrading reporting in Citrus

Citrus Version
2.8.0

Question
Let's say that I have a custom report class:

public class MyCustomTestReporter extends AbstractTestReporter implements TestSuiteListener, TestListener, TestActionListener, MessageListener, TestReporter {
...
}

and my test class looks something like this:

public class MyTestIT extends TestNGCitrusTestRunner {
private TestData testData;

public TestData getTestData() {
		return testData;
	}

...
}

Can I somehow access to testData (for eg. using getTestData()) from MyCustomTestReporter?

What I've tried so far
I tried to use test (type: TestCase) from the method public void onTestStart(TestCase test).
Unfortunately, I couldn't access this variable.

Can you please advise?

Additional information

Is there some way to write the template in Java ?

In the user guide the example about Template Cheaper 13 , show how can create template using Xml then call the template in Java , i am wondering if there some way to create the template in Java (the same way as behavior ) then apply this template in any test case(as a test) ?

Error creating bean with name 'todoJmsResource'

Hi,

Am trying to do spring-boot:run to run the sample todo application to explore xml validations in sample xml app. The build is success but the todo application is not running. I see the below issue in the console and the effort that tried to fix this is ended up in vein. Can pls help me to resolve this issue?

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-12-13 18:49:12.066 ERROR 11552 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoJmsResource': Unsatisfied dependency expressed through field 'todoListService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoListService': Unsatisfied dependency expressed through field 'todoListDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoListJdbcDao': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'database' defined in class path resource [com/consol/citrus/samples/todolist/dao/JdbcApplicationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hsqldb.server.Server]: Factory method 'database' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at com.consol.citrus.samples.todolist.TodoApplication.main(TodoApplication.java:66) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.10.RELEASE.jar:1.5.10.RELEASE]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoListService': Unsatisfied dependency expressed through field 'todoListDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoListJdbcDao': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'database' defined in class path resource [com/consol/citrus/samples/todolist/dao/JdbcApplicationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hsqldb.server.Server]: Factory method 'database' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoListJdbcDao': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'database' defined in class path resource [com/consol/citrus/samples/todolist/dao/JdbcApplicationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hsqldb.server.Server]: Factory method 'database' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 37 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'database' defined in class path resource [com/consol/citrus/samples/todolist/dao/JdbcApplicationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hsqldb.server.Server]: Factory method 'database' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 50 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.hsqldb.server.Server]: Factory method 'database' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 64 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.util.Hashtable.put(Hashtable.java:459) ~[na:1.8.0_102]
at org.hsqldb.persist.HsqlProperties.setProperty(Unknown Source) ~[hsqldb-2.3.4.jar:2.3.4]
at com.consol.citrus.samples.todolist.dao.JdbcApplicationConfig.database(JdbcApplicationConfig.java:44) ~[classes/:na]
at com.consol.citrus.samples.todolist.dao.JdbcApplicationConfig$$EnhancerBySpringCGLIB$$4ea27a4a.CGLIB$database$0() ~[classes/:na]
at com.consol.citrus.samples.todolist.dao.JdbcApplicationConfig$$EnhancerBySpringCGLIB$$4ea27a4a$$FastClassBySpringCGLIB$$78309fa3.invoke() ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at com.consol.citrus.samples.todolist.dao.JdbcApplicationConfig$$EnhancerBySpringCGLIB$$4ea27a4a.database() ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 65 common frames omitted

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.752 s
[INFO] Finished at: 2019-12-13T18:49:12+05:30
[INFO] Final Memory: 24M/227M
[INFO] --------------------------

Execution generate-tests of goal com.consol.citrus.mvn:citrus-maven-plugin:2.8.0:generate-tests failed: String index out of range: -216

When i execute sample-wsdl file by giving command mvn clean verify, test generation is failing with message
"[ERROR] Failed to execute goal com.consol.citrus.mvn:citrus-maven-plugin:2.8.0:generate-tests (generate-tests) on project citrus-java-sample-wsdl: Execution generate-tests of goal com.consol.citrus.mvn:citrus-maven-plugin:2.8.0:generate-tests failed: String index out of range: -216 -> [Help 1]"

Please help me how to resolve this issue.

Explicit dictionary doesn't override message values in case of global dictionary presence?

Hi,
I have two dictionaries, global and not global, and it seems that at first explicit one is applied, and after that - global (while from user guide I understood that explicit should be the final). What I'm doing wrong?

Dictionaries at citrus-context.xml:

 <citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary" global-scope="true">
    <citrus:mappings>
        <citrus:mapping path="title" value="citrus:concat('Dictionary1_', citrus:randomNumber(4))"/>
        <citrus:mapping path="body" value="${body}"/>
        <citrus:mapping path="labels[0]" value="dictionary1.test"/>
        <citrus:mapping path="labels[1]" value="dictionary1.bug"/>
        <citrus:mapping path="labels[2]" value="dictionary1.feature"/>
    </citrus:mappings>
</citrus:json-data-dictionary>
<citrus:json-data-dictionary id="jsonCreateIssueGitHubDictionary2" global-scope="false">
    <citrus:mapping-file path="classpath:com/revenue/integration/sample.dictionary"/>
</citrus:json-data-dictionary>`

Test case:

@CitrusTest
public void TestDictionary_test2(){
    String user = "olha-bastieieva";
    http()
            .client(jsonClientLogged)
            .send()
            .post("/repos/" + user + "/Citrus_test/issues")
            .contentType("application/json")
            .messageType(MessageType.JSON)
            .payload(new ClassPathResource("create_issue_payload.json", getClass()))
            .dictionary("jsonCreateIssueGitHubDictionary2");
    http()
            .client(jsonClientLogged)
            .receive()
            .response(HttpStatus.CREATED)
            .statusCode(201)
            .messageType(MessageType.JSON);
}

Content of sample.dictionary:

title = citrus:concat('Title', citrus:randomNumber(4))
labels[0] = dictionary2.test
labels[1] = dictionary2.bug`

Part of log where message values assignment is tracked:

14:48:07,709 DEBUG        citrus.Citrus| TEST STEP 1/2: send
14:48:07,804 DEBUG appingDataDictionary| Data dictionary setting element 'title' with value: citrus:concat('Title', citrus:randomNumber(4))
14:48:07,806 DEBUG appingDataDictionary| Data dictionary setting element 'labels[0]' with value: dictionary2.test
14:48:07,808 DEBUG appingDataDictionary| Data dictionary setting element 'title' with value: citrus:concat('Dictionary1_', citrus:randomNumber(4))
14:48:07,808 DEBUG appingDataDictionary| Data dictionary setting element 'body' with value: Body
14:48:07,809 DEBUG appingDataDictionary| Data dictionary setting element 'labels[0]' with value: dictionary1.test
14:48:08,135 DEBUG ltCorrelationManager| Saving correlation key for 'citrus_message_correlator_gitHubLogged'
14:48:08,135 DEBUG  context.TestContext| Setting variable: citrus_message_correlator_gitHubLogged with value: 'citrus_message_id = '69207068-7bb1-44c1-b04b-8fab59e06d26''
14:48:08,135 DEBUG    client.HttpClient| Sending HTTP message to: 'https://api.github.com/repos/olha-bastieieva/Citrus_test/issues'
14:48:08,135 DEBUG    client.HttpClient| Message to send:

{"title":"Dictionary1_2515","body":"Body","labels":["dictionary1.test"]}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.