Skip to content

Commit 274565c

Browse files
committed
Finish the switch from Ant to Maven
Now, Maven is used as the only build tool. All files and archives related to Ant were removed. Because Maven doesn't provide several features Ant provided, all non-basic tasks are now inside Groovy scripts. All tests are considered integration tests, not unit tests now. `mvn verify` takes care of starting and stopping the required RabbitMQ nodes. To run only a single test, use: mvn verify -Dit.test=DeadLetterExchange [#127354185]
1 parent bad1cc2 commit 274565c

28 files changed

+806
-932
lines changed

.gitignore

+3-10
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@
88
*.iml
99
*.ipr
1010
*.iws
11+
.DS_Store
1112
\#~
12-
.idea/
13-
build/
14-
cover/
15-
debug/
16-
dist/
17-
ebin/
18-
out/
19-
tmp/
20-
junit*.properties
13+
/.idea/
14+
/deps/
2115
/target/
22-
/.DS_Store
2316
/.classpath
2417
/.project
2518
/.settings

Makefile

+26-67
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,36 @@
1-
VERSION=0.0.0
2-
PACKAGE_NAME=rabbitmq-java-client
3-
JAVADOC_ARCHIVE=$(PACKAGE_NAME)-javadoc-$(VERSION)
4-
SRC_ARCHIVE=$(PACKAGE_NAME)-$(VERSION)
5-
SIGNING_KEY=056E8E56
6-
GNUPG_PATH=~
1+
MVN ?= mvn
2+
MVN_FLAGS ?=
73

8-
WEB_URL=http://www.rabbitmq.com/
9-
NEXUS_STAGE_URL=http://oss.sonatype.org/service/local/staging/deploy/maven2
10-
MAVEN_NEXUS_VERSION=1.7
4+
ifndef DEPS_DIR
5+
ifneq ($(wildcard ../../UMBRELLA.md),)
6+
DEPS_DIR = ..
7+
else
8+
DEPS_DIR = deps
9+
endif
10+
endif
1111

12-
AMQP_CODEGEN_DIR=$(shell fgrep sibling.codegen.dir src/test/resources/build.properties | sed -e 's:sibling\.codegen\.dir=::')
12+
MVN_FLAGS += -Ddeps.dir="$(abspath $(DEPS_DIR))"
1313

14-
MAVEN_RSYNC_DESTINATION[email protected]:/home/maven/rabbitmq-java-client/
14+
.PHONY: all deps tests clean distclean
1515

16-
ANT ?= ant
17-
ANT_FLAGS ?=
16+
all: deps
17+
$(MVN) $(MVN_FLAGS) compile
1818

19-
all:
20-
$(ANT) $(ANT_FLAGS) build
19+
deps: $(DEPS_DIR)/rabbit
20+
@:
2121

22-
clean:
23-
$(ANT) $(ANT_FLAGS) clean
24-
25-
distclean: clean
26-
$(MAKE) -C $(AMQP_CODEGEN_DIR) clean
27-
28-
dist: distclean srcdist dist_all maven-bundle
29-
30-
dist_all: dist1.5 javadoc-archive
31-
32-
jar:
33-
$(ANT) $(ANT_FLAGS) jar
22+
$(DEPS_DIR)/rabbit:
23+
git clone https://github.com/rabbitmq/rabbitmq-server.git $@
24+
$(MAKE) -C $@ fetch-deps DEPS_DIR="$(abspath $(DEPS_DIR))"
3425

35-
maven-bundle:
36-
$(ANT) $(ANT_FLAGS) -Dimpl.version=$(VERSION) maven-bundle
26+
tests: deps
27+
$(MVN) $(MVN_FLAGS) verify
3728

38-
dist1.5:
39-
$(ANT) $(ANT_FLAGS) -Ddist.out=build/$(PACKAGE_NAME)-bin-$(VERSION) -Dimpl.version=$(VERSION) dist
40-
$(MAKE) post-dist TARBALL_NAME=$(PACKAGE_NAME)-bin-$(VERSION)
29+
deploy:
30+
$(MVN) $(MVN_FLAGS) deploy
4131

42-
javadoc-archive:
43-
$(ANT) $(ANT_FLAGS) javadoc
44-
cp -Rp build/doc/api build/$(JAVADOC_ARCHIVE)
45-
(cd build; tar -zcf $(JAVADOC_ARCHIVE).tar.gz $(JAVADOC_ARCHIVE))
46-
(cd build; zip -q -r $(JAVADOC_ARCHIVE).zip $(JAVADOC_ARCHIVE))
47-
(cd build; rm -rf $(JAVADOC_ARCHIVE))
48-
49-
post-dist:
50-
@[ -n "$(TARBALL_NAME)" ] || (echo "Please set TARBALL_NAME."; false)
51-
chmod a+x build/$(TARBALL_NAME)/*.sh
52-
cp LICENSE* build/$(TARBALL_NAME)
53-
(cd build; tar -zcf $(TARBALL_NAME).tar.gz $(TARBALL_NAME))
54-
(cd build; zip -q -r $(TARBALL_NAME).zip $(TARBALL_NAME))
55-
(cd build; rm -rf $(TARBALL_NAME))
56-
57-
srcdist: distclean
58-
mkdir -p build/$(SRC_ARCHIVE)
59-
cp -Rp `ls | grep -v '^\(build\|README.in\)$$'` build/$(SRC_ARCHIVE)
60-
61-
mkdir -p build/$(SRC_ARCHIVE)/codegen
62-
cp -r $(AMQP_CODEGEN_DIR)/* build/$(SRC_ARCHIVE)/codegen/.
32+
clean:
33+
$(MVN) $(MVN_FLAGS) clean
6334

64-
if [ -f README.in ]; then \
65-
cp README.in build/$(SRC_ARCHIVE)/README; \
66-
if [ -f "$(BUILD_DOC)" ]; then \
67-
cat "$(BUILD_DOC)" \
68-
>> build/$(SRC_ARCHIVE)/README; \
69-
else \
70-
elinks -dump -no-references -no-numbering \
71-
$(WEB_URL)build-java-client.html \
72-
>> build/$(SRC_ARCHIVE)/README; \
73-
fi; \
74-
fi
75-
(cd build; tar -zcf $(SRC_ARCHIVE).tar.gz $(SRC_ARCHIVE))
76-
(cd build; zip -q -r $(SRC_ARCHIVE).zip $(SRC_ARCHIVE))
77-
(cd build; rm -rf $(SRC_ARCHIVE))
35+
distclean: clean
36+
$(MAKE) -C $(DEPS_DIR)/rabbitmq_codegen clean

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Maven artifacts are [released to Maven Central](http://search.maven.org/#search%
1414
<dependency>
1515
<groupId>com.rabbitmq</groupId>
1616
<artifactId>amqp-client</artifactId>
17-
<version>3.6.2</version>
17+
<version>3.6.5</version>
1818
</dependency>
1919
```
2020

2121
### Gradle
2222

2323
``` groovy
24-
compile 'com.rabbitmq:amqp-client:3.6.2'
24+
compile 'com.rabbitmq:amqp-client:3.6.5'
2525
```
2626

2727

RUNNING_TESTS.md

+115-66
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,150 @@
11
## Overview
22

33
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)
55
directory.
66

77
The suites are:
88

99
* Client tests
10-
* Functional tests
1110
* Server tests
1211
* SSL tests
12+
* Functional tests
13+
* HA tests
1314

1415
All of them assume a RabbitMQ node listening on localhost:5672
1516
(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.
1918

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.
2121

22+
`mvn verify` will start those nodes with the appropriate configuration.
2223

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:
2427

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+
```
3833

34+
You then run Maven with the `deps.dir` property set like this:
35+
```
36+
mvn -Ddeps.dir=/path/to/deps verify
3937
```
40-
----------------- Example shell session -------------------------------------
41-
rabbitmq-java-client$ ant test-client
42-
Buildfile: build.xml
4338

44-
test-prepare:
39+
For details on running specific tests, see below.
4540

46-
test-build:
4741

48-
amqp-generate-check:
42+
## Running a Specific Test Suite
4943

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:
5146

52-
build:
47+
* To run the client unit tests:
5348

54-
test-build-param:
49+
```
50+
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests
51+
```
5552

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:
5954

60-
BUILD SUCCESSFUL
61-
-----------------------------------------------------------------------------
55+
```
56+
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=FunctionalTests
6257
```
6358

64-
Test failures and errors are logged to `build/TEST-*`.
65-
59+
* To run a single test:
6660

67-
## SSL Test Setup
61+
```
62+
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=DeadLetterExchange
63+
```
6864

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:
7366

7467
```
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] ------------------------------------------------------------------------
85148
```
86149

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

Comments
 (0)