This article takes a practical project as an example, describes how to use Java multithreaded programming to simulate the random or regular behavior of multiple users. Using Java multithreaded programming, can better test products, earlier exposure to potential problems.
With the increasing complexity and scale of the http://www.aliyun.com/zixun/aggregation/32730.html "> information system, the application of transaction middleware in complex systems is more and more extensive." Transaction middleware as a middle-tier system, when receiving client requests, it is usually necessary to do some load control and user caching functions. For software testers, the test transaction middleware can not avoid the simulation of the client in the high load situation of some regular or random behavior. These tests are sometimes functional validation tests (functional verification test) and sometimes performance tests (configured test).
This article describes how to write multithreaded automated test scripts using the Java language, and uses a thread pool to simulate some special, regular test scenarios.
This paper will first introduce the concept of transaction middleware and Java multithreaded programming. Then the problems encountered in the project are raised. Then the problem, using Java multithreading technology to simulate test scenarios. After solving this problem, this paper puts forward the idea of popularizing the similar problems.
Prerequisites for this example
Java multi-threaded application of a wide range of transaction middleware there are many kinds. The version of this JDK is JDK5 because of the rich multithreaded concurrency tools that are added to JDK5. Currently, the latest version of the JDK is JDK7, which adds a number of tools including Phaser, Threadlocalrandom, Forkjoinpool, and transferqueue, but if you have a JDK5 multithreaded tool, JDK7 Tools will certainly not be unfamiliar.
The transaction middleware in this paper is an example of the TM of IBM information Management System (IMS), an example of which is to create a learning scenario for you, and of course Java has a wide range of multi-threaded applications, not limited to this kind of transaction middleware. In the promotion section of this paper, we also assume a scene and implement it.
If you also need to test with IMS TM, be sure to provide the following test environment.
Software that needs to be installed on Windows:
JDK 1.5 (or later)
Rational functional Tester V7.0 (or newer version)
Environments that need to be installed on IBM z/OS:
IMS version 9 (or later)
IMS Connect version 9 (or newer version)
Otma
TCP/IP
Concept Introduction
Transaction middleware
There are many kinds of middleware products, according to the role of middleware in the system and the use of technology is different, roughly divided into five categories: Database middleware (DB MIDDLEWARE,DM), remote process call middleware (remotely Procedure calls, RPC), Object-based request proxies (object requests broker, ORB), middleware and transaction middleware (Transaction 處理 Monitor, TPM, also known as transaction processing middleware).
Transaction middleware is a kind of complex middleware product, which is usually implemented by using the speed and reliability of distributed application under the load environment. Transaction middleware provides users with a range of services, including communication services, logging services, system services and transaction services.
Transaction middleware communication is mainly based on TCP/IP socket technology and based on message delivery and queuing mechanism, the communication process as shown in Figure 1:
Figure 1. Transaction Middleware Communication Process
The transaction middleware side usually has a listening method that listens for a client's connection request, returns a connection, and generates a corresponding customer service process. After receiving the data from the client, the data is segmented, encrypted, and encapsulated into a message packet. Then do the distribution, team, send and other operations.