How to test a QuickFIXJ application [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have implemented a QuickFIX/J application (the J stands for Java). Now I consider how to set up fixed test cases.
I am a little bit familiar with JUnit but I don't know if it's the right one for that issue, because QuickFIX/J has callbacks (fromApp-method of the Application class for example).
Maybe there is someone out there who has had the same problem and found a nice solution for that issue. ;)

I have used JUnit with QuickFIX/J tests. For call backs you can use a BlockingQueue<Message> so you can check in your main thread that you get the messages you expect. Or you can use a BlockingQueue of a data type of your choice.

If you're testing the responses of a QuickFix application, then you're really into integration testing rather than unit testing.
So as you've already written one QuickfixJ application, you could write a testing application that connects to it. So if your application is a Fix acceptor, write one that is an initiator.
Now you can send messages from your test application to your real application. Any responses from your real application will call onMessage() in your test application.
You can capture these callbacks and then you can verify that they match certain patterns (e.g., the application returns the same Client order id that the test sent). You can certainly use JUnit for this.

Related

Simulate external webservice for integration test [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have to simulate external webservice, specially SOAP webservice, to run integration test in java.
Any suggestion?
There are two approaches to this:
Run your integrations tests against the real external webservice, or a test version of it.
Write your own test webservice that simulates the subset of the external service's behavior required for your integration tests.
Note that depending on the nature of the service you are trying to simulate, your test service could be pretty dumb; e.g. providing pre-computed / hard-wired responses to expected requests.
There is no magic here. Just common sense and hard work.

What is the best approach in java to call a C function running on another server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
What is the best approach in java to call a C function running on another server? My application written in Java and running on an application server on server 'A' and I need to call a C function running on another server 'B' that doesn't have java installed.
Should we build a web service on server B to accept requests from my Web application on server A? or just call it remotely using RPC? and what is the performance of both?
First of all:
Just call it using RPC
There is no such thing as "just" when talking RPC. Unless you already have some CORBA or whatever solution in place, you will have to invest a serious amount of time to get this working.
Using a web service adds multiple layers of abstraction, which can affect latency. But of course, that is the more flexible solution.
I think it is fair (in 2018) to state: a reasonable architecture would provide some sort of (restful) HTTPS service on B. You should only look into other options if there are hard pressing reasons.

Will WebSocket achieve what I'm trying to do? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm creating a simple java application made in swing that communicates with a database. Multiple people will be using the application at the same time. As they are able to change things at the same time, if someone for example, adds a new user, and a different person is on that same page, I want the person who did not make the change to be notified that changes were made to the database since they last loaded it.
My lecturer in college advised me that WebSockets would be the way to go to achieve this, however after some reading about WebSockets in Java, it seems it is based to work with web browsers instead of between Java applications.
Can using WebSockets achieve what I am trying? Or, if not, what would be a way to achieve this?
Simple answer is Yes you can achieve what you needed
WebSocket is a communication protocol(#see RFC 6455) & it is not a must to use a Web browser.
You can achieve what you want to do with your app, it is just a matter of writing a custom WebSocket server to facilitate your requirements in your case sending database changes to the other clients(Which is called Server push)
There are several java libraries to get the work done,
netty WebSocket (My favorite)
jWebsocket
Atmosphere
Webbit
Netty WebSocket is a good one to start with and you can find examples in its project to write a custom client and a server

How do JUnit and TestNG work? I wonder the theory [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new in Java programming. I started to learn java recently. Everything works fine and my question is not about a code. I wonder mechanisms, how does JUniut "understand" how to use classes of my program?
Normal program has a flow and it starts from Main()... and what is about JUnit? has it its own flow? Could you please explain it to me?
What is a program on JUnit? what does make it work? netbeans or maven\ant??
Can I create unit tests without maven\ant?
Are there some design patterns? I would like to read about it.
Thanks!!
Every Java application you launch from the command line or from a script will have a main class and it will have a main() method.*
It's just that in the case of JUnit and TestNG these main classes are part of the JUnit and TestNG libraries themselves. That main class in turn is responsible for loading your unit test classes, calling your test methods, then produce a report.
You can download the source code for both libraries and check yourself.
And you can read more on how the Java Virtual Machine starts up here.
*Applets running in a browser appear to have a different entry point, hence the roundabout wording. Though even behind an applet container there is a main() method somewhere.

How to run same java project in different systems using threads [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Actually, i'm trying to run the same java selenium automation framework in multiple systems using their IP address. Is this possible in threads using different instances ?
How? is this possible ?
This will be possible suppose the automation is written as a test script then selenium instances will be called from python or java. Then you may implement the threading from the test script. This will lead to the script opening a lot of browsers at the same time, then it will need to be executed on a powerful computer, with sufficient amount of CPU load and RAM to support such numbers of browsers.
This is not an usual practice since the idea of using selenium should be to perform black-box and functional testing. While something that needs threading sounds more like a performance or stress test, which should be done with unit testing codes, e.g. JUnit

Categories