(Using traditional C++ API)
We have some user created classes acting as an abstraction layer on top of DDS Connext. There are corresponding unit tests for these objects in which the goal is to make sure they are working properly.
While testing those user created classes, essentially the test cases create a single participant with subscriber/reader and publisher/writer pairs. Using an arbitrary test message and topic, the DataReader is created with a corresponding listener. A message is simply sent through the writer/publisher on this same participant and the test checks if the custom classes are working or not by whether or not the listener ballback was triggered. The transport used is the default shared memory & UPDv4. The reader and writer QoS is set to reliable reliability, transient local durability, keep all history, and resource limits for this sample max 32.
Is testing in this manner a bad idea? The DDS actions between the reader and writer happen asynchronously, so testing in this way seems to lead to timing issues, where we end up having to wait with timeouts for 1) the subscription between the local reader and writer to be matched and 2) the message to be received. Is there a more deterministic way of testing? One idea that came to mind was using a custom transport to get in between the sending and receiving of messages so that tests could be fully synchronized.
1) If you use transient local durability your test shouldn't need to wait until the entities match, since the data will be sent to late joiners.
2) You may want to use the DataReader's StatusCondition and a WaitSet to deterministically wait until data has been received.
Alex
explains the problem correctly. I believe the issue that you have @Muhammad Quanit is that you are not understanding what your query is asking for and what you're trying to pass into the query. To break it down for you, your query
Takes 6 values that you have to provide (Please NOTE the type of each they take in):
In your program, you have 6 text boxes that will obtain these values to put in HOWEVER when you call the method:
getText()
it returns aString
type. So when we try to putString prodID = "3"
into our SQL query, you would receive the error you originally received: datatype mismatch. Now your current problem is: java.lang.numberFormatException : for input String. This means that you are trying to convert a String value into a number; however it is FAILING. So what could be possible reasons for this? Well...So as you can see, you have to be very careful and keep track of what you are converting and passing into your query (and vice versa).
As @YCF_L mentioned, perhaps your String contains white spaces at the start or end. There is a method called
trim()
in theString
class that will help you with that.So the
String
OBJECT has a method calledtrim()
which gets rid of TRAILING and LEADING white spaces, but NOT white spaces in between. So instead of getting" Foo Bar "
, we will get"Foo Bar"
.I upvoted @YCF_L 's answer -- he deserves the credit. I just wanted you to understand this concept since you were still confused after his explanation followed by receiving the NumberFormatException.
Editted to include the
trim()
method that was mentioned in the comments.