Spring Integration DSL HTTPRequest - httprequest

We are evaluating Spring Integration DSL , and came up with a POC where we are sending a HTTP Post request to a Message channe also we have created a PollableChannel to receive.
We started testing with Jmeter by sending concurrent requests but for some reason
the thread which sent http request is receiving response for different thread request.
I tried searching google to find a similar kind of work to get some idea, but no luck.Even Spring Integration DSL does not have any examples on this.
Can anyone guide me through this.
Thanks for your time.

Related

Run ktor test using `testApplication` without a client call

Is it possible to write a ktor test without any client call? We have a ktor kafka consumer service that executes http calls. The shape of our test is:
startAndConfigureWiremock()
testApplication{
application{
changeConfiguration()
}
sendKafkaMessage()
verifyExternalCall()
}
but the tests with any client calls do not work. Test code verifyExternalCall() is executed before the service is up and blocks the startup without any testBlocking.
When we try to add parallelism like GlobalScope.launch it runs the application, but it just starts and stops.
Looks like testApplication needs a client call to work at all and even ktor test relay on it: https://github.com/ktorio/ktor/blob/8b784f45a6339728ce7181498a5854b29bf9d2a5/ktor-server/ktor-server-core/jvmAndNix/test/io/ktor/server/application/HooksTest.kt#L81
This might not be the answer you are looking for but...
This definately looks like the incorrect place and method for performing this test.
Ktor is for building web APIs, it is for dealing with things like routing and serialisation. Why are you testing if an internal service is being started and is polling kafka for messages? This has nothing to do with ktor.
If you really want to do an integration test on this service rather:
do not start ktor
start kafka
start your Kafka polling service
send your message
do your verification
If you really want to check that your kafka service is started by your ktor application just do a verification that some "startKafkaConsumer" function was called in your start up. This should most likely be done on some injected mock of your consuming service.

Karate test framework: besides SOAP and REST also JMS calls? [duplicate]

This question already has an answer here:
How can I integrate socket.io on Karate
(1 answer)
Closed 1 year ago.
We are using ReadyAPI for API testing, Mocking and JMeter for performance testing and looking into the possibility to migrate everything to Karate framework. Would be handy to have all in one open source framework. But the main question is: can Karate framework handle JMS calls? Because 80% of our service testing is via JMS (with Hermes in ReadyAPI). I know SOAP and REST are supported but can't find anything about JMS.
Yes, you have to write a Java adapter (one-time work).
Please look at these 2 references:
https://twitter.com/getkarate/status/1128170638223364097
A great example that shows off Karate's
Java / JS interop - and built-in async support
first we call custom code to listen to an ApacheActiveMQ queue
an HTTP POST is made
we wait for the JMS message
and assert that the message is as expected
https://github.com/intuit/karate/tree/master/karate-netty#consumer-provider-example
https://twitter.com/getkarate/status/1417023536082812935
How Java interop and mocks can come together for advanced async / messaging flows such as JMS or apachekafka
link to full example: https://github.com/intuit/karate/tree/develop/karate-demo/src/test/java/mock/async

How rest assured works internally ? What is the architecture of Rest Assured?

Can someone please explain how rest assured works internally on performing the API testing. I am just aware that it uses Groovy under the hood. Basically, I would like to understand the architecture of Rest Assured in detail. Thanks
The only thing I can tell you for sure - as well as all REST-clients, it uses cURL for request sending.
Rest Assured is a Java library that provides a convenient and easy-to-use API for testing RESTful web services. It's built on top of other popular Java libraries like Apache HTTP Client, Hamcrest, and JSONPath.
Here's a high-level overview of the architecture of Rest Assured:
Request Configuration: In this stage, you can specify the details of the request, such as the HTTP method, endpoint URL, request parameters, headers, and request body.
Request Execution: In this stage, Rest Assured sends the configured request to the server and retrieves the response.
Response Validation: In this stage, Rest Assured provides various methods to validate the response, such as checking the HTTP status code, response headers, and response body.
Result Extraction: In this stage, Rest Assured allows you to extract specific values from the response body and store them in variables for further use.
Overall, Rest Assured provides a simple and straightforward API for testing RESTful web services, making it easier for developers to write and maintain test cases. By abstracting away the underlying complexities of HTTP requests and responses, it enables you to focus on testing the business logic of your application.

Can we use postman to test Corda api

Im a beginner in developing CorDapps, so far I have successfully written flows and such, I am currently learning how to code APIs for Corda, and I'm not sure if I could test Corda APIs in postman like regular APIs, any info would be greatly appreciated.
The Corda Webserver that you're referring to is simply a Jetty server that connects to the Corda node using the CordaRPCClient library, then provides an HTTP API that allows the webserver to map HTTP requests from users to RPC operations on the node. You can test this API in the same way as a regular server (e.g. by using Postman).
Please note that the Corda Webserver is deprecated as of Corda 3 and you are expected to create your own Java webserver mapping HTTP requests to RPC operations instead. See the Spring Webserver sample here for an example.

Implementation of a chat service using Restlet api

First off I'm not too familiar with restlets , just starting out. I wanted to implement a broadcast chatroom where a client sending a message would have the message broadcast to all other clients.
My attempt was to use a resource on the server side where the client would send the message(as a String) using POST. The other clients would constantly have to poll this resource to receive the message. I know this method must be horribly ineffective.
I was wondering if there was a better method where a change on the server side(in this case the sending of the string message) would result in the server alerting the clients of this update.
Some things will come in version 2.1 with the new nio connector. Within web page, you might consider using technologies like Comet or HTML5 web sockets.
See the specification page from the developer wiki of Restlet: http://wiki.restlet.org/developers/172-restlet/g3/354-restlet.html
Thierry