citrusframework / citrus-simulator Goto Github PK
View Code? Open in Web Editor NEWStandalone simulator for different messaging transports such as Http REST, SOAP WebService, JMS, RMI, mail messaging and more
License: Apache License 2.0
Standalone simulator for different messaging transports such as Http REST, SOAP WebService, JMS, RMI, mail messaging and more
License: Apache License 2.0
Add Spring Boot health indicators for simulator related components
As a user of the simulator GUI I would like the filters to be preserved when switching between pages
so that I don't have to re-enter the filters each time the page is loaded
Hi we are using IBM MQ as one of the message queues infrastructure. Is it possible to use custom endpoint configuration and listen to IBM MQ?
Please consider adding spring-boot-configuration-processor
to simulator-starter
to generate proper metadata for @ConfigurationProperties
annotated type.
Also, it would be nice if each field exposed has proper documentation (this shows up in the IDE). Perhaps you could try first and see what happens when you autocomplete citrus
in application.properties
?
Thanks!
My JMS Simulator needs to keep polling on topic instead of Queue.
From Citrus Framework Documentation it has been mentioned to set pub-sub-domain
to true
on the JMS Endpoint.
I wish to know how this can be done while starting a JMS Simulator , as SimulatorJmsAdapter
doesn't provide any provision to do so
As a user of the simulator GUI I would like to see all time displayed in my timezone and the time should include milliseconds so that the time is displayed consistently within and across all GUI pages
and so it is possible to reason about the order of messages and actions when the milliseconds are outputted.
Background:
I had a query regarding a problem that I am facing while executing a soap request against Citrus Simulator. Following are the stepwise process I have followed
<citrus:schema-repository id="schemaRepository">
<citrus:schemas>
<citrus:schema id="userSchema" location="classpath:xsd/WebServices.wsdl" />
</citrus:schemas>
</citrus:schema-repository>
<xs:import schemaLocation="User.xsd" namespace="http://xml.example.com/User_v1" />
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:user_ct="http://xml.sample.com/Types_v1" xmlns="http://xml.sample.com/Hosted_v1" targetNamespace="http://xml.sample.com/Security_v1" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.000" id="USERB">
<xs:import namespace="http://xml.sample.com/Types_v1" schemaLocation="SimpleTypes.xsd"/>
<xs:element name="HostedUser">
<xs:complexType>
<xs:complexContent>
<xs:extension base="user_ct:SaleType">
<xs:attribute name="RequestorType" type="ota:AlphaLength1" use="required">
<xs:annotation>
<xs:documentation>Sample docs.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
2018-06-01 12:14:42.120 ERROR 11560 --- [/USERRET] c.c.c.s.s.ScenarioExecutionService : Scenario completed with error: 'User' com.consol.citrus.exceptions.TestCaseFailedException: Could not create Schema: src-resolve: Cannot resolve the name 'user_ct:SaleType' to a(n) 'type definition' component.; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 52; src-resolve: Cannot resolve the name 'user_ct:SaleType' to a(n) 'type definition' component. at com.consol.citrus.TestCase.executeAction(TestCase.java:237) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.TestCase.doExecute(TestCase.java:149) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.Citrus.run(Citrus.java:290) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$null$4(ScenarioExecutionService.java:139) ~[citrus-simulator-starter-1.0.2.jar:na] at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:492) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$startScenarioAsync$5(ScenarioExecutionService.java:113) ~[citrus-simulator-starter-1.0.2.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:1.8.0_152] at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_152] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:1.8.0_152] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:1.8.0_152] at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_152] Caused by: org.springframework.xml.validation.XmlValidationException: Could not create Schema: src-resolve: Cannot resolve the name 'user_ct:SaleType' to a(n) 'type definition' component.; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 52; src-resolve: Cannot resolve the name 'user_ct:SaleType' to a(n) 'type definition' component. at org.springframework.xml.validation.Jaxp13ValidatorFactory.createValidator(Jaxp13ValidatorFactory.java:45) ~[spring-xml-2.4.0.RELEASE.jar:2.4.0.RELEASE] at org.springframework.xml.validation.XmlValidatorFactory.createValidator(XmlValidatorFactory.java:92) ~[spring-xml-2.4.0.RELEASE.jar:2.4.0.RELEASE] at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateXMLSchema(DomXmlMessageValidator.java:207) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessage(DomXmlMessageValidator.java:91) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessage(DomXmlMessageValidator.java:68) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:46) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:226) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.ws.actions.ReceiveSoapMessageAction.validateMessage(ReceiveSoapMessageAction.java:57) ~[citrus-ws-2.7.3.jar:na] at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:127) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.7.3.jar:na] at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na] at com.consol.citrus.TestCase.executeAction(TestCase.java:230) ~[citrus-core-2.7.3.jar:na] ... 11 common frames omitted 2018-06-01 12:14:46.737 WARN 11560 --- [nio-8080-exec-2] c.c.c.s.e.SimulatorEndpointAdapter : No response for scenario 'User'
Is there a way we can get around this problem?
User story
As a Citrus simulator user, I would like to record the communication between my SUT and a third party system, so that this recorded communication can be replayed to simulate the third party system for my SUT.
Hello all! I'm trying to implement the script in the simulator. The script should accept the request by http and make a request to the database. This is for starters, generally it should call the procedure in oracle.
`@Scenario("Send charge submit")
@RequestMapping(value = "/simulator/callchargesubmit", method = RequestMethod.GET)
public class SendChargeSubmitSMtoBeebee extends AbstractSimulatorScenario {
@Autowired
private DataSource dataSource;;
@Override
public void run(ScenarioDesigner scenario) {
scenario.http()
.receive()
.get()
;
scenario.query(dataSource).statement("SELECT * FROM SUBSAPI_OTA_BEENUMS sob WHERE sob.BEENUM =555555101;");
}`
I get the following response to a query on my url:
{"timestamp":1530112285869,"status":500,"error":"Internal Server Error","exception":"org.springframework.dao.InvalidDataAccessResourceUsageException","message":"could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement","path":"/simulator/callchargesubmit"}
And in logs I see : java.sql.SQLSyntaxErrorException: ORA-00942
In fact, the view exists and the query works.
Can this action not be supported?
As a simulator user, I want the simulator to not run into a out of memory on heavy load, so that I can use a deployed simulator instance for a long period of time without redeployment.
As reported in citrusframework/citrus#447, the simulator runs out of memory under heavy load. This is because the results of every request/response is stored in memory that's why it will run out of memory.
Current situation
When building the project with maven each sample-simulator project is started, tested and finally stopped with the help of the spring-boot maven plugin. On some environments, in particular the travis-ci env, the build always fails after the 3rd sample project is built since the previous sample did not shutdown cleanly and ports are still reserved. to add to this it is very difficult to reproduce the problem on a local dev env and no shell access is available for the travis-ci VM.
Proposal
#1
Start each sample project in a docker container in the pre-integration phase and stop the container in the post-integration phase. The fabric8io docker-maven-plugin could be used and configured with a special maven profile that can be activated on demand - for example when building on travis-ci env.
#2
Introduce a build pipeline on travis. First step just runs the unit tests (without samples) for fail fast feedback. Then each sample is executed in a separate build step (maybe parallel if possible).
It would be nice if the REST simulator had support for mocking / doing CORS.
It's easy enough to do it now by registering a HandlerInterceptor, but it would be nice if this kind of thing could be provided out-of-the-box:
public class CorsHandlerInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (CorsUtils.isCorsRequest(request)) {
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "*");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "*");
if (CorsUtils.isPreFlightRequest(request)) {
return false;
}
}
return true;
}
}
As a user of the simulator GUI I would like to be able to kill active scenarios so that scenarios that are waiting indefinitely or very long on an event (eg. for a message) or are not terminating for some other reason (bug in scenario code) can be stopped.
Stopping could be done explicitly or after configurable threshold has been exceeded.
As a user of the simulator GUI I would like to be able to expand and collapse the tables displayed on the activity page (parameters, actions and messages) so that it is easy to zoom in to a particular table of interest without having to scroll down through multiple pages to find what I'm interested in.
For particularly complex simulator scenarios this is even more important.
Currently JMS Simulator can be configured with only one inbound queue or topic, how can I make it listen to multiple queues/topics?
Citrus's TestDesigner will be eventually removed from Citrus. As a result the ScenarioDesigner will have to be removed too. To avoid future migration problems it would be better to deprecate this class now and remove it completely in one of the next releases.
What has to be done:
How to send and receive java objects by jms. Using a simulator? Detailed description of the stack overflow case: https://stackoverflow.com/questions/51264390/citrus-simulator-how-to-send-and-receive-java-object-in-different-queue
.
Simulator scenarios are loaded as Java classes only. Also apply scenarios defined using the Citrus XML DSL.
As a developer of simulator scenarios I would like to develop simulator scenarios that can interact with apache kafka so that scenarios can be triggered by a kafka message or can send messages to a kafka topic.
On simulator startup simulator should be able to load a git repo that defines the scenarios.
TODO: Find out how we can load Java scenario code at runtime.
When using WSA the simulator.soap().receive() fails with a NPE when the ReplyTo element content is not formatted (only elements, no white-spaces). When the ReplyTo element contains whitespaces all works as expected. This in the scenario, the ScenarioMapper (where we check for sync or async soap) works fine.
2019-07-23 12:35:55.012 ERROR --- [pool-2-thread-1] c.c.citrus.report.LoggingReporter - TEST FAILED ScenarioRunner <com.consol.citrus.simulator.scenario> Nested exception is:
java.lang.NullPointerException: null
at com.consol.citrus.simulator.service.MessageService.lambda$saveMessage$0(MessageService.java:60)
at com.consol.citrus.simulator.service.MessageService$$Lambda$50.0000000064120160.accept(Unknown Source)
at java.util.Iterator.forEachRemaining(Iterator.java:127)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1812)
It seems that all header handling for SOAPHeaders doesn't look at nested elements.
The ScenarioRunner and ScenarioDesigner classes only support http and soap operations on the default simulator endpoint:
Scenarios that wish to interact with other endpoints cannot do so.
What is required:
Add simulator related actuator endpoints so users can access the information via Spring Boot actuator philosophy
We're currently starting examples via Maven:
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
<fork>true</fork>
<wait>${spring.boot.start.wait}</wait>
<maxAttempts>${spring.boot.start.maxAttempts}</maxAttempts>
</configuration>
</execution>
Instead of using @SpringBootTest
for each integration test. This would ensure a correct context handling according to the Spring Boot Test Doc. It will resolve the issues reported in #39 as well.
Relates to spring-projects/spring-boot#13510
We are reviewing our community starters list and a quick look here suggests that this starter doesn’t yet support Spring Boot 2.
Can you please let us know if/when you plan to support Spring Boot 2?
Thanks!
Hi,
I'm trying to use the Citrus Simulator with my project. I've just started from scratch by creating a new Spring Boot app to acts as a simulator. The snippet below is my build.gradle
. When I run gradle assemble
I'm getting an error as below. Looks like version 1.1.0-SNAPSHOT is not in Maven central repository. I've already tried version 1.0.3 but there is an issue in com.consol.citrus.simulator.service.ActivityService
class that use scenarioExecutionRepository.findOne
when used with Spring 5 which has been changed to scenarioExecutionRepository.findById
in version 1.1.0-SNAPSHOT.
Could you please help?
build.gradle
`plugins {
id 'org.springframework.boot' version '2.1.5.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'idea'
group = 'com.example.simulator'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-starter-web")
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile("com.consol.citrus:citrus-simulator-starter:1.1.0-SNAPSHOT")
compile("com.consol.citrus:citrus-simulator-ui:1.1.0-SNAPSHOT")
}`
Error
`> Task :compileJava FAILED
FAILURE: Build failed with an exception.
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.consol.citrus:citrus-simulator-starter:1.1.0-SNAPSHOT.
Required by:
project :
Could not find com.consol.citrus:citrus-simulator-ui:1.1.0-SNAPSHOT.
Required by:
project :
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
1 actionable task: 1 executed
Could not find com.consol.citrus:citrus-simulator-starter:1.1.0-SNAPSHOT.
Required by:
project :
17:50:45: Task execution finished 'assemble'.`
As a user of the simulator GUI I would like to see a graphic visualisation of the scenario
so that I can get a quick overview of all actions and interactions with endpoints.
Background: Something like puml or html that could be included within the scenario java code and exposed in the GUI.
Simulator shows exchanged messages and executed scenarios. Would be nice to combine those information so user can see exchanged messages for a scenario and vice versa.
Hello,
I'm trying to create an abstract scenario (we could call it CustomAbstractSimulatorScenario) which extends the AbstractSimulatorScenario
. CustomAbstractSimulatorScenario
overrides the run method for defining a workflow of a lot of tests which is different only for stuff like the Validator (I'm using my custom XMLValidator) and the client used in an HTTP test.
Now, for example, I create a concrete Scenario ScenarioA
which extends CustomAbstractSimulatorScenario
. On top of this scenario, I define the @Scenario
and @RequestMapping
annotations, but then I call the URL the ScenarioA
I see the following log:
2019-01-23 10:49:16.118 INFO 7515 --- [nio-8080-exec-3] c.c.c.s.s.ScenarioExecutionService : Starting scenario : ScenarioA
2019-01-23 10:49:21.123 WARN 7515 --- [nio-8080-exec-3] c.c.c.s.e.SimulatorEndpointAdapter : No response for scenario 'ScenarioA'
Here it's what I'm trying to do
public abstract class CustomAbstractSimulatorScenario extends AbstractSimulatorScenario {
private static final String uri = '/..../';
@Autowired
private HttpClient client;
@Override
public void run(ScenarioDesigner designer) {
designer
.http()
.receive()
.post();
designer
.http()
.send()
.response(HttpStatus.ACCEPTED)
.payload("Test Running");
final HttpClientRequestActionBuilder sendActionBuilder = designer
.http()
.client(client)
.send()
.get(uri)
.header("USer-Agent", getAgent());
getQueryParams().forEach(sendActionBuilder::queryParam);
designer
.http()
.client(client)
.receive()
.response(HttpStatus.OK);
}
protected abstract String getAgent();
protected abstract Map<String, String> getQueryParams();
}
@Scenario("ScenarioA")
@RequestMapping(value = "/services/rest/test/agent/a", method = RequestMethod.POST)
public class ScenarioA extends CustomAbstractSimulatorScenario {
@Override
protected String getAgent() {
return "A";
}
@Override
protected Map<String, String> getQueryParams() { return new HashMap<>(); }
}
Using 1.1.0-SNAPSHOT, I have successfully implemented a “dummy” service. I want it to behave as a “mock”, that is, where its behavior is directed from the test driver. For instance, could the driver call a REST service on the Simulator saying “use scenario Foo”, and then the Simulator would choose the scenario not from the root element of the SOAP message from the SUT, but from this previously sent command. Any advice and guidance is greatly appreciated!
User interface should be able to show the scenario code (Java and XML).
Given the following Test of sample-combined
:
@CitrusTest
public void testInterveningRequest() {
variable("correlationId", "citrus:randomNumber(10)");
//GoodNightScenario
http().client(simulatorClient)
.send()
.post("goodnight")
.payload("<GoodNight xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Go to sleep!" +
"</GoodNight>")
.header("x-correlationid", "${correlationId}");
http().client(simulatorClient)
.receive()
.response(HttpStatus.OK)
.payload("<GoodNightResponse xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Good Night!" +
"</GoodNightResponse>");
//DefaultScenario
http().client(simulatorClient)
.send()
.post()
.payload("<InterveningRequest>In between!</InterveningRequest>");
http().client(simulatorClient)
.receive()
.response(HttpStatus.OK)
.payload(defaultResponse);
//GoodNightScenario
http().client(simulatorClient)
.send()
.post()
.payload("<InterveningRequest>In between!</InterveningRequest>")
.header("x-correlationid", "${correlationId}");
http().client(simulatorClient)
.receive()
.response(HttpStatus.OK)
.payload("<InterveningResponse>In between!</InterveningResponse>");
//Should be DefaultScenario (Race condition here)
http().client(simulatorClient)
.send()
.put("goodnight")
.payload("<InterveningRequest>In between!</InterveningRequest>")
.header("x-correlationid", "${correlationId}");
http().client(simulatorClient)
.receive()
.response(HttpStatus.OK)
.payload(defaultResponse);
}
If the test runs "fast enough", the GoodNightScenario
is still active in the CorrelationHandlerRegistry
, because doFinally().actions(builder.stop())
of the ScenarioDesigner
, containing the StopCorrelationHandlerAction
to stop the scenario, has not been finished, until the next request, that matches the x-correlationid
header condition, arrives.
BR,
Sven
When building warnings and errors are outputted to the console -
[WARNING] npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
[WARNING] npm WARN deprecated [email protected]: Use uuid module instead
[WARNING] npm WARN deprecated [email protected]: angular-cli has been renamed to @angular/cli. Please update your dependencies.
[WARNING] npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[WARNING] npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[WARNING] npm WARN prefer global [email protected] should be installed with -g
..
[WARNING] npm WARN [email protected] requires a peer of [email protected] but none was installed.
..
[ERROR] As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
[ERROR] which will only support Node 6.9 and greater. This package will be officially deprecated
[ERROR] shortly after.
[ERROR]
[ERROR] To disable this warning use "ng set --global warnings.packageDeprecation=false".
[ERROR]
[ERROR] fallbackLoader option has been deprecated - replace with "fallback"
[ERROR] loader option has been deprecated - replace with "use"
[ERROR] fallbackLoader option has been deprecated - replace with "fallback"
[ERROR] loader option has been deprecated - replace with "use"
[ERROR] fallbackLoader option has been deprecated - replace with "fallback"
[ERROR] loader option has been deprecated - replace with "use"
[ERROR] fallbackLoader option has been deprecated - replace with "fallback"
[ERROR] loader option has been deprecated - replace with "use"
Todo:
It appears the simulator will always time out correlation after 5 seconds. For certain test scenarios this is not long enough. I have attempted to set the default time out property, but it appears that this is not used for timing out correlated requests. Please consider making this timeout value configurable via a property.
I had cloned and set up the sample-rest project. The Citrus Simulator application is running at port 9091 successfully. I am not able to run my test from Citrus test file or from postman. Please help me understand the mistake in setting up the project.
Error from running the TestNG Test
FAILED: testHelloRequest
java.lang.NoSuchMethodError: com.consol.citrus.http.message.HttpMessage.getQueryParams()Ljava/lang/String;
From Postman:
POST
http://10.172.12.194:9091/services/rest/simulator/hello
Request Header: content-type application/xml
Request Body
<Hello xmlns= "http://citrusframework.org/schemas/hello">Say Hello!</Hello>
Response:
{
"timestamp": 1548165980312,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.ws.soap.SoapMessageCreationException",
"message": "Could not create message from InputStream: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?",
"path": "/services/rest/simulator/hello"
}
Scenario File:
@Scenario("Hello")
@RequestMapping(value = "/services/rest/simulator/hello", method = RequestMethod.POST)
public class HelloScenario extends AbstractSimulatorScenario {
@Override
public void run(ScenarioRunner scenario) {
scenario.echo("Simulator: ${simulator.name}");
scenario
.http()
.receive(builder -> builder
.post()
.payload("<Hello xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Say Hello!" +
"</Hello>")
.extractFromPayload("//hello:Hello", "greeting")
);
scenario.echo("Received greeting: ${greeting}");
scenario
.http()
.send((builder -> builder
.response(HttpStatus.OK)
.payload("<HelloResponse xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Hi there!" +
"</HelloResponse>"))
);
}
}
Citrus Test: SimulatorIT
private HttpClient simulatorClient;
/**
* Sends a hello request to server expecting positive response message.
*/
@CitrusTest
public void testHelloRequest() {
http().client(simulatorClient)
.send()
.post("hello")
.contentType(MediaType.APPLICATION_XML_VALUE)
.payload("<Hello xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Say Hello!" +
"</Hello>");
http().client(simulatorClient)
.receive()
.response(HttpStatus.OK)
.payload("<HelloResponse xmlns=\"http://citrusframework.org/schemas/hello\">" +
"Hi there!" +
"</HelloResponse>");
}
Error from the
Also display all message headers in user interface when opening the message details page. Especially when viewing message details for Http REST calls the headers hold essential information such as request method, path, and response status code. Maybe give those headers a special style layout in page view.
As a user of the simulator GUI I would like to filter the scenarios based on the scenario type (Starter, Non-starter) so that I can group the scenarios by type.
Background: the filters for the scenario page do the opposite to what the user expects. When "Starter" is selected then "Non-Starter" scenarios are displayed.
As a developer of simulator scenarios I would like to develop scenarios that
can process messages from more than one endpoint
so that scenarios that can be triggered are not restricted to a single endpoint per simulator instance
As a user of the simulator GUI I would like to see the echo "text" rather than the action name "echo" when viewing the simulator actions on the activity page so that the scenario can output important information or dynamic information to the user during scenario execution
Hello,
I can't build the project because I receive this error in my IDE:
The constructor ScenarioController.Scenario(String, ScenarioController.Scenario.ScenarioType) is > undefined ScenarioController.java /citrus-simulator-> starter/src/main/java/com/consol/citrus/simulator/controller
line 60
I can't see any construct for Scenario class, anyone could help me? Or is it a bug?
I am trying to follow the below example to simulate one of our SOAP endpoints.
http://citrusframework.org/citrus-simulator/#web-service-response
For eg: I have a Create, Get and Delete customer SOAP actions and I wish to simulate positive scenarios + the fault scenarios. Will each of the scenarios require a new class file?
As a user of the simulator GUI I would like to preserve the form values I enter before launching a scenario so that I can reuse the form values from a previous launch later on without having to re-enter all the data again
Background:
The user interface provides filtering and paging of lists (e.g. activities, messages). When filter is active the paging is broken as the paging is done before filters are applied. This should be the other way round so filter is applied to the database query and after that paging is done.
Hi guys
We started using Citrus in a project I'm working on and quickly noticed the models not supporting Oracle databases. As sad as it is, we have no way to select another database.
There are several problems when it comes to using the existing models within Oracle. For example com/consol/citrus/simulator/model/Message.java
-> Message
is a reserved name.
Or the Hibernate-generated relation name for private ScenarioExecution scenarioExecution;
being scenario_execution_execution_id NUMBER (19, 0),
and thus more than 30 characters long.
I can think of two solutions:
@Table
& @Column
to the models and defining unique namesNone of them is really satisfying. The first one brings along a big risk if someone is already using anything else than H2 somewhere. And adding migration scripts would bind you to a database - As far as I see, this is exactly what you tried to prevent.
Because of that, the second "solution" seems better. It includes moving models into a separate artifact and using an interface-pattern (factories) to instanciate entities. But neither is this a perfect approach.
I'd be very interested in your opinion on this. Maybe you guys have any other ideas? Or you do not want to support Oracle at all - I don't know.
Of course we would collaborate on the implementation - no matter which approach, if any, we finally choose.
Thank you for your feedback.
Best regards
application.properties file have below settings
citrus.simulator.ws.enabled=true
citrus.simulator.rest.enabled=true
citrus.simulator.defaultScenario=DEFAULT
Simulator log shows below details on startup
Using the simulator configuration: SimulatorRestConfigurationProperties{enabled='true', urlMapping='/services/rest/**'}
Using the simulator configuration: SimulatorConfigurationProperties{enabled='true', templatePath='com/consol/citrus/simulator/templates', defaultScenario='DEFAULT', defaultTimeout=60000, exceptionDelay=5000, templateValidation=true, inboundXmlDictionary=inbound-xml-dictionary.xml, outboundXmlDictionary=outbound-xml-dictionary.xml, inboundJsonDictionary=inbound-json-dictionary.properties, outboundJsonDictionary=outbound-json-dictionary.properties}
Using the simulator configuration: SimulatorWebServiceConfigurationProperties{enabled='true', servletMapping='/services/ws/*'}
Currently there is only one Default Scenario configured. I expect default scenario to catch both the rest and soap scenarios, but when I make a call on http://localhost:8080/services/rest/
, it never reaches DefaultScenario.
405 - Method Not Allowed
{
"timestamp": "2019-01-17T06:25:08.595+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Could not create message from InputStream: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?",
"path": "/services/rest/ikykikikikikiukk"
}
What exactly is the difference between those two? It seems like the TestContext context
in MessageListener#onInboundMessage
or MessageListener#onInboundMessage
is null. Maybe I am doing something wrong? I've registered a custom implementation of MessageListener.class
via MessageListeners#addMessageListener
.
But then again EndpointMessageHandler.class
which would receive the correct TestContext context
is already a registered bean. An overriding it with @Primary
seems very ugly to me.
What is the preferred way of getting inbound and outbound message bodies and the test context?
From my current point of knowledge it seems that EndpointMessageHandler.class
should be registered as a MessageListener.class
? And that both interceptors should call the Listeners?
I have SOAP client written in Java DSL which is able to receive the response and do the validation on the response by traversing through the XPATH of the response XML. But I want the entire response SOAP XML to be stored in a new variable for another validation outside. So how to extract the SOAP response XML from the received response and store it another String variable.
In hight level my receive part looks like this:
receive("End point").schemavalidation("validation details").validate("XPATH vlaidation");
Is there any utility function to extract the entire response. I got some functions like extractfrompayload but still, I am not able to achieve my goal of storing my response to another variable.
Please assist me in this. Thanks.
Hi, When I try to start the simulator app for ws I get the below error:
The bean 'messageDispatcherServlet', defined in class path resource [org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/consol/citrus/simulator/ws/SimulatorWebServiceAutoConfiguration.class] and overriding is disabled.
Below is my pom.xml file
https://github.com/coding-yogi/edmi-citrus-simulator/blob/master/pom.xml
Hi, Can I have the same simulator handle all type of requests including SOAP, JMS and HTTP?
I had a look at sample-combined project but didnt get much idea.
Can I have different default scenarios for each one of them (SOAP, JMS, REST) ?
I send java object in the queue. After that I see this exeption:
2018-07-18 16:29:58.788 ERROR 1244 --- [enario:JMS_SEND] c.consol.citrus.report.LoggingReporter : TEST FAILED ScenarioDesigner <com.consol.citrus.simulator.scenario> Nested exception is:
com.consol.citrus.exceptions.CitrusRuntimeException: Could not find proper message validator for message type 'XML', please define a capable message validator for this message type
at com.consol.citrus.validation.MessageValidatorRegistry.findMessageValidators(MessageValidatorRegistry.java:83) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:210) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:127) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) [citrus-core-2.7.3.jar:na]
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) [citrus-core-2.7.3.jar:na]
at com.consol.citrus.TestCase.executeAction(TestCase.java:230) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.TestCase.doExecute(TestCase.java:149) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) [citrus-core-2.7.3.jar:na]
at com.consol.citrus.Citrus.run(Citrus.java:290) [citrus-core-2.7.3.jar:na]
at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$null$4(ScenarioExecutionService.java:139) [citrus-simulator-starter-1.0.2.jar:na]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:492) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$startScenarioAsync$5(ScenarioExecutionService.java:113) [citrus-simulator-starter-1.0.2.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_172]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_172]
2018-07-18 16:29:58.788 INFO 1244 --- [enario:JMS_SEND] c.consol.citrus.report.LoggingReporter : ------------------------------------------------------------------------
2018-07-18 16:29:58.788 INFO 1244 --- [enario:JMS_SEND] c.consol.citrus.report.LoggingReporter :
2018-07-18 16:29:58.790 ERROR 1244 --- [enario:JMS_SEND] c.c.c.s.s.ScenarioExecutionService : Scenario completed with error: 'JMS_SEND'
com.consol.citrus.exceptions.TestCaseFailedException: Could not find proper message validator for message type 'XML', please define a capable message validator for this message type
at com.consol.citrus.TestCase.executeAction(TestCase.java:237) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.TestCase.doExecute(TestCase.java:149) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.Citrus.run(Citrus.java:290) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$null$4(ScenarioExecutionService.java:139) ~[citrus-simulator-starter-1.0.2.jar:na]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:492) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at com.consol.citrus.simulator.service.ScenarioExecutionService.lambda$startScenarioAsync$5(ScenarioExecutionService.java:113) ~[citrus-simulator-starter-1.0.2.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_172]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_172]
Caused by: com.consol.citrus.exceptions.CitrusRuntimeException: Could not find proper message validator for message type 'XML', please define a capable message validator for this message type
at com.consol.citrus.validation.MessageValidatorRegistry.findMessageValidators(MessageValidatorRegistry.java:83) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:210) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:127) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.7.3.jar:na]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.3.jar:na]
at com.consol.citrus.TestCase.executeAction(TestCase.java:230) ~[citrus-core-2.7.3.jar:na]
... 11 common frames omitted
2018-07-18 16:30:03.695 WARN 1244 --- [cTaskExecutor-1] c.c.c.s.e.SimulatorEndpointAdapter : No response for scenario 'JMS_SEND'
2018-07-18 16:30:03.695 DEBUG 1244 --- [cTaskExecutor-1] c.c.c.s.e.SimulatorEndpointAdapter : Did not receive reply message - delegating to fallback endpoint adapter
How I can to solve this problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.