Getting opentaps 2
From Opentaps Wiki
Contents |
Getting the Code
opentaps v2 uses Git version control system. The most convenient way to get source code is Gitorious. Just create your personal clone of the opentaps-2 repository (Note that the exact message will differ as the size the of the project
$ git clone git://gitorious.org/opentaps/opentaps-2.git Cloning into 'opentaps-2'... remote: Counting objects: 4737, done. remote: Compressing objects: 100% (2000/2000), done. remote: Total 4737 (delta 1561), reused 4642 (delta 1506) Receiving objects: 100% (4737/4737), 39.43 MiB | 196 KiB/s, done. Resolving deltas: 100% (1561/1561), done. $ cd opentaps-2 $ ls assemblies clients features integration-tests modules pom.xml third party
Building opentaps v2
opentaps v2 uses Maven to manage dependencies and builds. Here are some simple steps to get you started:
- There are a few bundled Apache libraries from Eclipse Orbit project. Since they are unavailable in Maven repositories, you have to install them into local repository to get the build working:
$ cd opentaps-2/ $ cd thirdparty/ $ sh install.sh
- Now build the project with mvn
# go back to the opentaps-2 directory $ cd ../ $ mvn install
Setting Up and Running opentaps v2
opentaps v2 requires the Apache Geronimo 3.0 application server, which supports OSGi out of the box. Currently we are using Geronimo 3.0-beta-1. The binaries can be downloaded from http://geronimo.apache.org/apache-geronimo-v30-beta-1-release.html. Get Full Profile or Web Profile releases.
After downloading Geronimo, unpack the .zip (Windows) or tar.gz (Unix) file containing Geronimo to a convenient directory (we'll refer to it as geronimo home) and read the attached README.TXT file for information about further installation and configuration steps.
Next, create a MySQL database. Preferred database name is opentaps2. Both username and password are opentaps as well. If you want to use other names please modify /modules/entity/src/main/resources/OSGI-INF/blueprint/blueprint.xml
To start opentaps v2, first install opentaps-2 in Geronimo. From your opentaps-2 directory:
$ mvn clean install
Now go to your Geronimo directory:
$ cd ~/geronimo-tomcat7-javaee6-3.0-beta-1/ $ sh bin/geronimo start
You can see the Geronimo log with:
$ tail -f var/log/geronimo.log
You can go into the Geronimo admin console with http://localhost:8080/console and username system, password manager.
To stop Geronimo, go back to the geronimo directory and
$ sh bin/geronimo stop Using GERONIMO_HOME: /Users/sichen/geronimo-tomcat7-javaee6-3.0-beta-1 Using GERONIMO_TMPDIR: /Users/sichen/geronimo-tomcat7-javaee6-3.0-beta-1/var/temp Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Home Username: system Password: ******* Locating server on localhost:1099... Server found. Server shutdown started Server shutdown completed
The individual modules will be deployed into the Geronimo server.
Note also that no tables will be created in the database until your modules are deployed into Geronimo and attempt to make their first access to the database. You do not need to run any scripts to install database tables.
Run tests
In order to run integration tests go to project directory and run 'mvn -Dit -DgeronimoHome=/path/to/geronimo_home verify' or 'mvn -Dit verify'. Please note the difference. In second case geronimo binaries is downloaded automatically and installed into target directory and you do not need install geronimo separately. Both cases have advantages and disadvantages, use any of your choice.
RPC tests call a service running on demo1.opentaps.org. It should be constantly available. If you want to use another instance adjust URL and credentials in /modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Unit tests can be run globally or from each modules with 'mvn verify -DskipTests=false', for example this can be run from 'modules/notes' to run the tests for the notes module only.
Debug tests
Since Geronimo is Karaf based information from http://karaf.apache.org/manual/2.2.2/developers-guide/debugging.html cover our case but with some peculiarities. Testing instance is run by geronimo-maven-plugin and we have to enable debug mode in "it" profile. See configuration for "start-server" execution in integration-tests/tests-run/pom.xml. The same principles can be used for debugging application code.

