|
1 | 1 | ## Overview
|
2 | 2 |
|
3 | 3 | There are multiple test suites in the RabbitMQ Java client library;
|
4 |
| -the source for all of the suites can be found in the [test/src](./test/src) |
| 4 | +the source for all of the suites can be found in the [src/test/java](src/test/java) |
5 | 5 | directory.
|
6 | 6 |
|
7 | 7 | The suites are:
|
8 | 8 |
|
9 | 9 | * Client tests
|
10 |
| - * Functional tests |
11 | 10 | * Server tests
|
12 | 11 | * SSL tests
|
| 12 | + * Functional tests |
| 13 | + * HA tests |
13 | 14 |
|
14 | 15 | All of them assume a RabbitMQ node listening on localhost:5672
|
15 | 16 | (the default settings). SSL tests require a broker listening on the default
|
16 |
| -SSL port. Connection recovery tests assume `rabbitmqctl` at `../rabbitmq-server/scripts/rabbitmqctl` |
17 |
| -can control the running node: this is the case when all repositories are cloned using |
18 |
| -the [umbrella repository](https://github.com/rabbitmq/rabbitmq-public-umbrella). |
| 17 | +SSL port. HA tests expect a second node listening on localhost:5673. |
19 | 18 |
|
20 |
| -For details on running specific tests, see below. |
| 19 | +Connection recovery tests need `rabbitmqctl` to control the running nodes. |
| 20 | +can control the running node. |
21 | 21 |
|
| 22 | +`mvn verify` will start those nodes with the appropriate configuration. |
22 | 23 |
|
23 |
| -## Running a Specific Test Suite |
| 24 | +To easily fullfil all those requirements, you can use `make deps` to |
| 25 | +fetch the dependencies. You can also fetch them yourself and use the |
| 26 | +same layout: |
24 | 27 |
|
25 |
| -To run a specific test suite you should execute one of the following in the |
26 |
| -top-level directory of the source tree: |
27 |
| - |
28 |
| - # runs unit tests |
29 |
| - ant test-client |
30 |
| - # runs integration/functional tests |
31 |
| - ant test-functional |
32 |
| - # runs TLS tests |
33 |
| - ant test-ssl |
34 |
| - # run all test suites |
35 |
| - ant test-suite |
36 |
| - |
37 |
| -For example, to run the client tests: |
| 28 | +``` |
| 29 | +deps |
| 30 | +|-- rabbitmq_codegen |
| 31 | +`-- rabbit |
| 32 | +``` |
38 | 33 |
|
| 34 | +You then run Maven with the `deps.dir` property set like this: |
| 35 | +``` |
| 36 | +mvn -Ddeps.dir=/path/to/deps verify |
39 | 37 | ```
|
40 |
| ------------------ Example shell session ------------------------------------- |
41 |
| -rabbitmq-java-client$ ant test-client |
42 |
| -Buildfile: build.xml |
43 | 38 |
|
44 |
| -test-prepare: |
| 39 | +For details on running specific tests, see below. |
45 | 40 |
|
46 |
| -test-build: |
47 | 41 |
|
48 |
| -amqp-generate-check: |
| 42 | +## Running a Specific Test Suite |
49 | 43 |
|
50 |
| -amqp-generate: |
| 44 | +To run a specific test suite you should execute one of the following in the |
| 45 | +top-level directory of the source tree: |
51 | 46 |
|
52 |
| -build: |
| 47 | +* To run the client unit tests: |
53 | 48 |
|
54 |
| -test-build-param: |
| 49 | + ``` |
| 50 | +mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests |
| 51 | +``` |
55 | 52 |
|
56 |
| -test-client: |
57 |
| - [junit] Running com.rabbitmq.client.test.ClientTests |
58 |
| - [junit] Tests run: 31, Failures: 0, Errors: 0, Time elapsed: 2.388 sec |
| 53 | +* To run the functional tests: |
59 | 54 |
|
60 |
| -BUILD SUCCESSFUL |
61 |
| ------------------------------------------------------------------------------ |
| 55 | + ``` |
| 56 | +mvn -Ddeps.dir=/path/to/deps verify -Dit.test=FunctionalTests |
62 | 57 | ```
|
63 | 58 |
|
64 |
| -Test failures and errors are logged to `build/TEST-*`. |
65 |
| - |
| 59 | +* To run a single test: |
66 | 60 |
|
67 |
| -## SSL Test Setup |
| 61 | + ``` |
| 62 | +mvn -Ddeps.dir=/path/to/deps verify -Dit.test=DeadLetterExchange |
| 63 | +``` |
68 | 64 |
|
69 |
| -To run the SSL tests, the RabbitMQ server and Java client should be configured |
70 |
| -as per the SSL instructions on the RabbitMQ website. The `SSL_CERTS_DIR` |
71 |
| -environment variable must point to a certificate folder with the following |
72 |
| -minimal structure: |
| 65 | +For example, to run the client tests: |
73 | 66 |
|
74 | 67 | ```
|
75 |
| - $SSL_CERTS_DIR |
76 |
| - |-- client |
77 |
| - | |-- keycert.p12 |
78 |
| - | |-- cert.pem |
79 |
| - | \-- key.pem |
80 |
| - |-- server |
81 |
| - | |-- cert.pem |
82 |
| - | \-- key.pem |
83 |
| - \-- testca |
84 |
| - \-- cacert.pem |
| 68 | +rabbitmq-java-client$ mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests |
| 69 | +[INFO] Scanning for projects... |
| 70 | +[INFO] Inspecting build with total of 1 modules... |
| 71 | +[INFO] Installing Nexus Staging features: |
| 72 | +[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin |
| 73 | +[INFO] |
| 74 | +[INFO] ------------------------------------------------------------------------ |
| 75 | +[INFO] Building RabbitMQ Java Client 3.7.0-SNAPSHOT |
| 76 | +[INFO] ------------------------------------------------------------------------ |
| 77 | +[INFO] |
| 78 | +[INFO] --- groovy-maven-plugin:2.0:execute (generate-amqp-sources) @ amqp-client --- |
| 79 | +[INFO] |
| 80 | +[INFO] --- build-helper-maven-plugin:1.12:add-source (add-generated-sources-dir) @ amqp-client --- |
| 81 | +[INFO] Source directory: .../rabbitmq_java_client/target/generated-sources/src/main/java added. |
| 82 | +[INFO] |
| 83 | +[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ amqp-client --- |
| 84 | +[debug] execute contextualize |
| 85 | +[INFO] Using 'UTF-8' encoding to copy filtered resources. |
| 86 | +[INFO] Copying 1 resource |
| 87 | +[INFO] |
| 88 | +[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ amqp-client --- |
| 89 | +[INFO] Nothing to compile - all classes are up to date |
| 90 | +[INFO] |
| 91 | +[INFO] --- groovy-maven-plugin:2.0:execute (remove-old-test-keystores) @ amqp-client --- |
| 92 | +[INFO] |
| 93 | +[INFO] --- groovy-maven-plugin:2.0:execute (query-test-tls-certs-dir) @ amqp-client --- |
| 94 | +[INFO] |
| 95 | +[INFO] --- keytool-maven-plugin:1.5:importCertificate (generate-test-ca-keystore) @ amqp-client --- |
| 96 | +[WARNING] Certificate was added to keystore |
| 97 | +[INFO] |
| 98 | +[INFO] --- keytool-maven-plugin:1.5:importCertificate (generate-test-empty-keystore) @ amqp-client --- |
| 99 | +[WARNING] Certificate was added to keystore |
| 100 | +[INFO] |
| 101 | +[INFO] --- keytool-maven-plugin:1.5:deleteAlias (generate-test-empty-keystore) @ amqp-client --- |
| 102 | +[INFO] |
| 103 | +[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ amqp-client --- |
| 104 | +[debug] execute contextualize |
| 105 | +[INFO] Using 'UTF-8' encoding to copy filtered resources. |
| 106 | +[INFO] Copying 3 resources |
| 107 | +[INFO] |
| 108 | +[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ amqp-client --- |
| 109 | +[INFO] Nothing to compile - all classes are up to date |
| 110 | +[INFO] |
| 111 | +[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ amqp-client --- |
| 112 | +[INFO] Tests are skipped. |
| 113 | +[INFO] |
| 114 | +[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ amqp-client --- |
| 115 | +[INFO] Building jar: .../rabbitmq_java_client/target/amqp-client-3.7.0-SNAPSHOT.jar |
| 116 | +[INFO] |
| 117 | +[INFO] --- groovy-maven-plugin:2.0:execute (start-test-broker-A) @ amqp-client --- |
| 118 | +[INFO] |
| 119 | +[INFO] --- groovy-maven-plugin:2.0:execute (start-test-broker-B) @ amqp-client --- |
| 120 | +[INFO] |
| 121 | +[INFO] --- groovy-maven-plugin:2.0:execute (create-test-cluster) @ amqp-client --- |
| 122 | +[INFO] |
| 123 | +[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (integration-test) @ amqp-client --- |
| 124 | +
|
| 125 | +------------------------------------------------------- |
| 126 | + T E S T S |
| 127 | +------------------------------------------------------- |
| 128 | +Running com.rabbitmq.client.test.ClientTests |
| 129 | +Tests run: 50, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.732 sec - in com.rabbitmq.client.test.ClientTests |
| 130 | +
|
| 131 | +Results : |
| 132 | +
|
| 133 | +Tests run: 50, Failures: 0, Errors: 0, Skipped: 0 |
| 134 | +
|
| 135 | +[INFO] |
| 136 | +[INFO] --- groovy-maven-plugin:2.0:execute (stop-test-broker-B) @ amqp-client --- |
| 137 | +[INFO] |
| 138 | +[INFO] --- groovy-maven-plugin:2.0:execute (stop-test-broker-A) @ amqp-client --- |
| 139 | +[INFO] |
| 140 | +[INFO] --- maven-failsafe-plugin:2.19.1:verify (verify) @ amqp-client --- |
| 141 | +[INFO] ------------------------------------------------------------------------ |
| 142 | +[INFO] BUILD SUCCESS |
| 143 | +[INFO] ------------------------------------------------------------------------ |
| 144 | +[INFO] Total time: 33.707s |
| 145 | +[INFO] Finished at: Mon Aug 08 16:22:26 CEST 2016 |
| 146 | +[INFO] Final Memory: 21M/256M |
| 147 | +[INFO] ------------------------------------------------------------------------ |
85 | 148 | ```
|
86 | 149 |
|
87 |
| -The `PASSWORD` environment variable must be set to the password of the keycert.p12 |
88 |
| -PKCS12 keystore. The broker must be configured to validate client certificates. |
89 |
| -This will become minimal broker configuration file if `$SSL_CERTS_DIR` is replaced |
90 |
| -with the certificate folder: |
91 |
| - |
92 |
| -``` erlang |
93 |
| -%%%%% begin sample test broker configuration |
94 |
| -[{rabbit, [{ssl_listeners, [5671]}, |
95 |
| - {ssl_options, [{cacertfile,"$SSL_CERTS_DIR/testca/cacert.pem"}, |
96 |
| - {certfile,"$SSL_CERTS_DIR/server/cert.pem"}, |
97 |
| - {keyfile,"$SSL_CERTS_DIR/server/key.pem"}, |
98 |
| - {verify,verify_peer}, |
99 |
| - {fail_if_no_peer_cert, false}]}]}]. |
100 |
| -%%%%% end sample test broker configuration |
101 |
| -``` |
| 150 | +Test reports can be found in `target/failsafe-reports`. |
0 commit comments