Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Source

Firstly, check out the source from the git repository.

git clone https://git-wip-us.apache.org/repos/asf/qpid-broker-j.git qpid-broker-j

Prerequisites

Java

The build requires a Java 8 or later. You should set the JAVA_HOME environment variable and include its bin directory in your PATH.

Check it's OK by executing the following at your command prompt.

java -version

Maven

The build requires a Maven version of 3.0.0 or later.  You should set the M2_HOME environment variable and include its bin directory in your PATH.

...

For full maven install reference visit Maven Installation Instructions.

Qpid Maven Structure

For complete reference and documentation on Maven please visit the following online resources.

...

Maven: The Complete Reference by Sonatype

Project Object Model (POM)

Each Qpid java module has its own POM file (pom.xml) located in its root directory.

...

POMArtifact NameLocationDescription

Qpid Parent

qpid-parent

NA

This is the high level POM that all Qpid modules ultimately inherit from.  

It itself is a child of the latest Apache parent POM and its main purpose is to initialise all of our default values, plugins and versions and set any global Qpid configuration.

It is versioned separatley and its release cycle is independent of that of the Qpid Java Project.

Java Build

qpid-java-build

pom.xmlThis is the primary build POM that can be used to build the whole Qpid Java project.  It defines all of the Java Qpid modules and sets all the default values, plugins, versions and configuration for the whole Java build.

Child Modules

qpid-*

 **/pom.xml

or

**/**/pom.xml

Each and every child module has its own specific POM file that specifies exactly what its dependencies are and any plugin configuration it needs.

Maven Commands

Here is a quick reference guide outlining some of the maven commands you can run and what the outcome will be.

...

CommandDescriptionNotes
mvn cleanremoves all the files created by the previous buildUsually means it deletes the contents of the modules */target/ directory.
mvn validatevalidates that the maven poms are all correct and that no config is missingUsefull to run when making build modifications to ensure consistency.
mvn compilecompiles the source code of the projectThis will verify that project dependencies are correct.
mvn testexecutes the unit testsShould not rely on code being packaged or deployed, only unit tests.

mvn package

packages the code into the its distributable formats (jar, war, zip etc)Each pom specifies what the distribution format is, default is POM.
mvn verifyverifies that the packaged code is validThis will run the integration and system tests.
mvn installinstalls the package into the local maven repositoryThis will result in the module being available, locally, as a depedency
mvn deploycopies the final artifacts to the remote maven repository for sharingThis would happen only when modules ready to be shared with other developers or projects
mvn site:stagecreates a staged version of the maven site with all the reports

Staging output defaults to the */target/staging/ directory

mvn jacoco:reportgenerates the code coverage report for the tests that have been executedTest output appears in the */target/site/jacoco/ directory

Maven Profiles

Maven profiles are used to allow set configuration to be enables easily at the command line using the -P option.   If no profile is selected, java-mms-1.0 is run by default.

...

Profile NameDescription
java-store.protocolTest profile to use AMQP protocol with store store for Java Broker for system testing. Store can be bdb, derby, json, mms the latter signifying a test in-memory store principally used for testing.
Note that when running the older protocols, it is necessary to add the system property -DenableAmqp0-x to the command line.
cppTest profile to use AMQP 0-10 and the C++ for system testing
apache-releaseRelease profile for performing Apache software releases
dependency-checkDependency check to validate project licensing ahead of release
joramtestsProfile used to execute the Joram JMS test suite (more below).
tckProfile used to execute the JMS TCK (more below)

Maven Build Output

By default the build output for a maven module will appear in the modules "target" directory:

...

Once you have this then refer to the JMS client documentation.

Example Maven Commands

Here are some example Maven build commands that you may find usefull.

...

Execute the unit tests and then produce the code coverage report

mvn test jacoco:report

Joram JMS Testsuite

The Joram JMS Testsuite is integrated into the Maven build but is disabled by default.  It allows the Joram JMS test suite to executed, using the specified Qpid JMS client, against the Java Broker.  The Java Broker must be running already.

...

mvn -f joramtests/pom.xml integration-test -Djoramtests=qpid-amqp-1-0-client-jms  -Dit.test=ConnectionTest

JMS TCK

The configuration for the JMS TCK is integrated into the Maven build but the profile is disabled by default.  The JMS TCK itself is proprietary and must be provided by the user.   The Java Broker must be running and HTTP management available. The test suite will automatically set-up/teardown the JMS objects required by the TCK.

...

Code Block
shell
shell
mvn post-integration-test -f tck/pom.xml -Pjms20-tck -Dtck.directory=/home/alex/tck/jmstck20 -Dqpid-jms-client-version=0.20.0

Performance Tests

The Performance test suite is integrated into Maven.  It is bound to the integration-test phase and it is activated by the  perftest system property.  The Java Broker must be running and HTTP management available. The test suite will automatically set-up/teardown the JMS objects required for the performance tests. 

...

Most things can be overridden from system properties.  Take a look in the first few lines of the POM.

Python Tests

The Python Test suite runs against the Java Broker too but is not currently integrated into Maven. To run the 0-8..0-10 test suites use the following steps.  It assumes that qpid-python and qpid-cpp are checked out.

...

Todo.  Describe the running of the AMQP 1.0 test suite using the swigged binding/proton-c.  See the https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-Python-Java-Test/.

IDE integration

Nowadays, most of the team chose IntelliJ.

IntelliJ 

To setup the project, simply import the POM that resides at the top level.

Configuring the Annotation Processor

The build uses Java Annotation Processors to automatically generate code for things such as factories.  Intellij's annotation processor defaults don't play nicely with Maven.  A symptom of this is missing implementation classes when you try and start the Broker.

...

This workaround does mean that you need to remember to mvn install each time the codegen project is changed, and update the version number each time the version number bumps.

Running the Broker within Intellij

TODO expand on this.

You need to

  • specify QPID_WORK and QPID_HOME in the "VM options"
  • set the class path to "qpid-broker"
  • set the working directory to the root source folder
  • add dojotoolkit and bdb to the "qpid-broker" module dependencies

Running System Tests within Intellij

Running system tests from within IntelliJ requires a bit of fiddeling. You first create a template configuration which you then need to adapt every time you want to run a different systest. This means this method does not support running the entire test suite.

...