Message-ID: <1646637854.3556.1369387486254.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3555_2126882367.1369387486254" ------=_Part_3555_2126882367.1369387486254 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
If you want to add support for an unsupported database system, you found= the right documentation. This step-by-step guide describes all the steps t= hat need to be processed in order to support a new database system.
First we need to make sure, what is the qa test suite. With Activiti the= re are two projects that make up the qa. These are:
These tests need to be run successfully before we consider Activiti to s= upport a database system.
Before we start to go through all the steps, we should execute the test = scripts on an already supported database. We assume, you already checked ou= t the activiti project, setup the demo and configured ant and maven on your= system.
Before we can run the test, we need to provide a database connection. Th= is is done via a properties file located in <user_home>/.activiti/jdb= c. There create a file called h2.properties adding this content:
This setup assumes an installed h2 database with no tables in it! Al= l tests are constructed to create the database before running the test and = dropping the database after finishing the tests. If you have setup the data= base and the configuration file, you can proceed with the next command.
Navigate to the =E2=80=9Cactiviti-engine-examples=E2=80=9D-project and e= xecute following command:
mvn --Ddatabase=3Dh2 clean install
You should see lots of info on the console. Most important are the tests= that are run with this command. You also saw the creation and dropping of = the database before and after the testing. This defines another point in th= e configuration for a new database system.
Now we will describe the parts that have to be completed for the purpose= of this document. These are:
This should be the easiest part of the description. You need to setup th= e database you want to test with a schema and a user. The user needs to hav= e enough privileges to execute all the following sql statements.
You may already write down the information that is needed to connect to = this database and fetch the jdbc driver for this database. Then you can pro= ceed to the next step.
Activiti uses two sql files to create and drop the database tables. Thes= e are located at:
<db-profile> is an identifier; you would also use it to run your t= ests against. We did that in chapter =E2=80=9CRun a test with H2=E2=80=9D. = Before you can start the testing of Activiti against a new database, you ne= ed to setup these two scripts. Start with copying the two files and rename = them to your <db-profile> setting. After that you need to work out cr= eate, alter and drop statements for your database system. Be cautious to pl= ace those files in the same directory!
As we did in the introduction sample, you have to provide the database c= onnection configuration in the activiti user home directory. Please create = a properties file like this:
You need to add the jdbc parameters like this
This is just a sample configuration for h2! You need to change the p= roperties to your database environment.
Since the database connection is achieved by jdbc, you need to provide a= jdbc-driver for the tests. There are two ways you can provide the jdbc dri= ver:
If you have a maven dependency xml snippet for your jdbc driver, fine=
3; Then you can skip the next step and go directly to step 2 =E2=80=9CModif=
y maven pom.xml=E2=80=9D. Otherwise you need to install the library into yo=
ur local maven repository first.
1 Install the library into your local maven repository
mvn install:install-file -Dfile=3D<path to library> = 45;DgroupId=3D<groupId>-DartifactId=3D<artifactId> -Dversio= n=3D<version> -Dpackaging=3Djar
Example for mysql:
mvn install:install-file -Dfile=3Dmysql.jar -DgroupId=3D= mysql -DartifactId=3Dmysql-connector-java driver -Dversion=3D5.1.6 = -Dpackaging=3Djar
After having installed the library you should now get the dependency sni= ppet like this:
You can this example as basis and add your dependency information here. =
Make sure you have the scope property set to =E2=80=9Ctest=E2=80=9D. This d=
ependency is only needed for tests. In a running Activiti scenario you woul=
d provide the jdbc driver for the activiti-engine. But this goes beyond the=
scope of this document.
2 Modify the pom.xml
If you open the pom.xml from one of the mentioned projects, you will see= an xml file. Navigate to the dependencies area of the database profile. Th= is should like this:
You can add your database driver dependency at the marked location. Save= the file and proceed to the next step. You may return to this step to also= modify the pom.xml for the other activiti project.
You can run the test from the command line located in the appropriate te= st project. This is either =E2=80=9Cactiviti-engine-examples=E2=80=9D or = =E2=80=9Cactiviti-engine-test-api=E2=80=9D. To be sure that your changes in= project activiti-engine are up to date, run
mvn clean install
from the activiti-engine project location. After that execute this comma= nd:
mvn --Ddatabase=3D<db-profile> clean install<= /p>
* *If you got lucky and the test didn=C2=B4t fail one test, you= can proceed with the other project. For the unlucky guys like mine, procee= d with the next step!
This is the hardest part and I can only give you some advice how to get = to the cause of test failures. Any test logs errors and output to the targe= t folder. In case of errors search for
These reports should help you a lot to get the conditions on which those= errors rely on. The following points are at least a checklist or advice li= st I found out adding support for some databases:
If you encounter a bug in the test, you can file a bug in JIRA! Othe= rwise after you fixed something you can once again run the test.
Last step is to successfully run the qa script. This test combines creat= ion of activiti-engine and executing all tests for database support. If thi= s test is successful, you have added support for your database environment.= We would be happy, if you would provide those scripts to the community.
The following lines will guide you through running the test suite. For = this example we will use MySQL 5.1 as database environment.
Now we are ready to run the qa script. Navigate to /activiti/trunk/qa/ci= and run the script that is suitable for your operating system like this:ru= n-test-db-standalone mysqlIf you would like to run the qa script against H2= , then you need to execute this command:run-test-db-standalone h2------=_Part_3555_2126882367.1369387486254--