A project just tested in the previous period, where two systems need to implement incremental number of read updates, that is, a system to obtain incremental data to notify the B system to obtain new data and subsequent processing, in order to achieve this goal, the final design for a data there is incremental data to ACTIVEMQ, b system obtains the data from the ACTIVEMQ, for this reason, develops the child shoe needs to implement a common client tool kit, facilitates the two systems to send and reads the message.
Test ideas:
According to the analysis of the project situation, the main focus of the test of the message middleware is "producer", "consumer" is the processing of the message is normal, namely:
1. Can the producer write the message correctly ACTIVEMQ
2. Can the consumer pull out the message from the ACTIVEMQ
3. Whether the message written and the pull message can correspond to each other
Since the serialized format of the message uses Protobuffer, it has also been studied before testing, focusing on:
1) Definition of the. proc File format
The format fields for messages are defined in this file, and there are three main types:
Required: Must be assigned, not nullable
Optional: can be assigned or not assigned value
Repeated: can be repeated any number of times, the field can be decorated with the keyword as an array of automatically set size
Whether the fields in the proc file, as defined by the specific business analysis, meet the needs of the real business
2) Compilation of proc files
Compile the well-defined proc file into the required Java file, command format: protoc --proto_path=import_path--java_out=dst_dir path/to /file.proto
Proto_path: The path of the proc file to be compiled
Java_out: Compile the path of the generated Java file, or you can define it in the proc file: Option java_package= .....
There are three types of compile-generated Java files:
Speed: Generated code is efficient but takes up more space
Code_size: Contrary to speed
Lite_runtime: Generated code is efficient and takes up less space, but the reflection function is sacrificed (this is not understood)
The above three items can be set in the proc file: Option optimize_for=
Once the preparation is ready, you can start testing:
1. Depending on the Java class required to generate the proc, the above 3 types are required to generate a copy of the
2. The simulation producer invokes the development of the provided public client, sets the producer data and sends it to ACTIVEMQ (calls 3 types of Java files, i.e. speed, code_size, Lite_runtime mentioned above)
3. Simulate the consumer calls the development of the public client, pull the data from the ACTIVEMQ and parse ( call 3 types of Java files, the above mentioned speed, code_size, Lite_runtime)
4. Verify that the producer data is consistent with the data drawn by the consumer
5. Batch execution of the above operations
Test Result: The provided client can only implement speed one Java file definition format of production and consumption, the other two will appear abnormal!
Test of Java message Middleware based on ACTIVEMQ and Protobuffer