Compiling from github

rickyepoderi edited this page May 3, 2014 · 28 revisions

Since 0.2 version the couchbase-manager is mavenized so the compilation is more or less easy but you need maven installed in your laptop (I am using now maven package from debian, version 3.0.4). The manager was created for glassfish v3 but in June 2013 Oracle released the new version 4.0 (JavaEE 7 reference implementation) and last commits let compile the manager for v3 or v4 versions. Version 0.3 of the manager will be distributed for 3.1.2.2 and 4.0 glassfish versions.

Compiling the manager

The steps to compile the couchbase-manager for glassfish v3 (it uses 3.1.2.2 maven repository) are the following:

  1. Clone the repository:

    git clone https://github.com/rickyepoderi/couchbase-manager.git

    cd couchbase-manager/

  2. Compile and package the manager (this step is quite long cos a lot of dependencies are downloaded). The version for v3 is the default profile right now, so no profile is specified. Besides tests should be skipped (you need to install the manager in a glassfish server to test the manager, see below).

    mvn -Dmaven.test.skip=true package

  3. If you want to compile the manager for glassfish 4.0 the profile V4 should be specified in the command.

    mvn -P V4 -Dmaven.test.skip=true package

  4. The couchbase-manager-X.X.X.jar is generated in the target directory. Now you can install it following the installation instructions. Take in mind that now dependencies can be different, they will depend on current maven file.

  5. For cleaning the environment just execute the clean command (the documentation is placed into target/site/apidocs/ directory). You can use the profile option to mark the glassfish version (-P V4 or -P V3, the default is the former).

    mvn clean

  6. If you want to produce the javadoc information just perform the following command.

    mvn javadoc:javadoc

Testing the manager

The maven file has some testing prepared but tests need some pre-configuration. The instructions are assuming that glassfish (3.1.2.2 or 4.0) and couchbase are installed in the same box (localhost).

  1. The couchbase-manager should be installed inside the glassfish container, please follow the instructions.

  2. Download and install the manager-test.war application from here. That application by default is configured to use non-sticky configuration against a default couchbase installation in localhost. The deployment example is done against the default target in glassfish.

    cd <GLASSFISH_V3_V4_HOME>/bin

    ./asadmin deploy --availabilityenabled=true <DOWNLOAD_DIR>/manager-test.war

  3. Now the test application can be tested manually. The manager-test is a normal web application that can be accessed using default glassfish ports:

    http://localhost:8080/manager-test/

  4. Right now the web application has four different tests. The first one is just the infamous hajsp that let you add string session attributes. The second is a test for a JSF bean which uses a EJB using CDI (@Named and @Inject). The third is the same but not using CDI (@ManagedBean and @EJB). The last link is just a protected page using file realm (previous tests use the principal if logged).

  5. In order to test the protected page login into glassfish console (http://localhost:4848) and add a user in the realm: Configurations → server-config → Security → Realms → file. Click manage users button and add a username and password. The user must belong to a group called allusers. Once this is done the protected web page should work.

  6. Finally the application has some Web Services that are used by the maven tests. So once the application is deployed and it is working you can execute maven tests against the test application. There are four groups of tests: blocking (tests which uses several inner threads to do blocks), refresh-update (tests for session updates), create-delete (tests for session creation and invalidation) and performance (long tests for performance). Examples for different tests are shown below (only one group, three of them and all tests -quite long-):

    mvn test -Dgroups=blocking -DbaseUrl="http://localhost:8080/manager-test/SessionTest?wsdl"

    mvn test -Dgroups=blocking,refresh-update,create-delete -DbaseUrl="http://localhost:8080/manager-test/SessionTest?wsdl"

    mvn test -DbaseUrl="http://localhost:8080/manager-test/SessionTest?wsdl"