Skip to content
Snippets Groups Projects
Commit 0e2ebd96 authored by srosse's avatar srosse
Browse files

OO-3412: one readme to replace the 5 old ones

parent ec47416c
No related branches found
No related tags found
No related merge requests found
######################################################
# OpenOLAT REST API Documentation
######################################################
To read the OpenOLAT REST API documentation:
1) start OpenOLAT
2) go to Administration -> Core configuration -> REST API
3) Make sure the REST API ist enabled
4) Click the documentation link in the admin panel or open YOURSERVERURL/restapi/api/doc in your browser
For devs: if you modified the documentation in the source files, you need to compile
the REST API documentation. Do the follwing:
mvn clean package
mvn compile -Pdocumentation,tomcat
EXPERIMENTAL: Setting up latest OpenOLAT version on Eclipse With an Application Server
--------------------------------------------------------------------------------------
OpenOLAT supports only Tomcat officially, but it can also run on other application
servers like JBoss AS / Wildfly. This README is intended for people who have
some minimal experience with these servers and can install a JDBC driver, set some
JMS resources...
As of OpenOLAT 10, we need WildFly because we use JPA 2.1 (Hibernate 4.3.x)
The beginning of the installation is the same as Tomcat, it's described in INSTALL.README.
To create your eclipse project, use these commands instead of the default one:
for JBoss AS:
mvn eclipse:clean eclipse:eclipse -P-tomcat,wildfly
Configuration WildFly (JBoss AS 10.1)
------------------------------------
1. We need Hibernate 5.2, you need to use the utorial to update the version of hibernate
in Widlfly: http://docs.jboss.org/hibernate/orm/5.2/topical/html_single/wildfly/Wildfly.html
2. Define a JDBC connection pool in your standalone.xml configuration with a jndi-name like:
java:jboss/datasources/OpenOLATDS and set this JNDI name
in olat.local.properties set the following properties:
db.source=jndi
db.jndi=java:jboss/datasources/OpenOLATDS
cluster.mode=Cluster
The cluster mode will disable the hibernate cache
3. Create a queue with a jndi-name like:
java:jboss/exported/jms/queue/searchQueue
and a topic:
java:jboss/exported/jms/topic/sysbus
in olat.local.properties set the following properties:
jms.provider=jndi
jms.broker.jndi=java:/ConnectionFactory
sysbus.broker.jndi=java:jboss/exported/jms/topic/sysbus
search.broker.jndi=java:jboss/exported/jms/queue/searchQueue
index.broker.jndi=java:jboss/exported/jms/queue/indexQueue
certificate.broker.jndi=java:jboss/exported/jms/queue/certificateQueue
Features located on the application server
------------------------------------------
State Feature
------------------------------------------
OK JDBC Connections
OK JMS
OK JAX-RS (restapi)
OK JAX-WS (vitero, openmeetings)
x Mail
x LDAP Connection
OK Hibernate/JPA (only JBoss AS, we depend on Hibernate)
OK Caching (for JPA second level cache for example)
1. Installing OpenOLAT
----------------------
Please refer to the HTML documentation available at http://www.openolat.org
2. Licensing
----------------------
With regard to licensing and copyright please refer to the file LICENSE and NOTICE.TXT
3. Contact information
----------------------
You are welcome to participate in our development. If you make any patches to
the code, please let us know on your mailing list.
For further information about OpenOLAT please visit the product's website at
http://www.openolat.org
4. Mailing list
----------------------
A free and public mailinglist is hosted on Google groups:
https://groups.google.com/forum/#!forum/openolat
If you do not have a google account you can register with just an email address
through our openolat.org homepage.
5. Being a community member
----------------------
We strongly suggest to participate in the OpenOLAT community membership program.
Even though this software is free and open source, the development and management
has to be funded by someone. If you like what we do and want the product to be
maintained and developed in the long run you should consider purchasing a member
ship.
\ No newline at end of file
Setting up latest OpenOLAT version on Eclipse
-------------------------------------------------------------------------
o As the latest development is often ahead of the current documentation you will always find an up to date
install guide here.
*******************************************************************************************
Setting up OpenOLAT in Eclipse
*******************************************************************************************
Preconditions:
o Check that you are using maven 2.2 or higher (mvn -V)
o Check that you have the mercurial plugin installed in eclipse (http://www.javaforge.com/project/HGE)
o Check that you have Mercurial (hg) installed
o MySQL 5.1 or greater or PostreSQL 8.4
1. In Eclipse: create a Mercurial repository location (http://hg.openolat.org/openolat) and clone the repo.
1.1 Do not add a password and make sure you uncheck the init Mercurial repo checkbox at the end. Right
click to clone repo into your workspace.
2. Setup Eclipse Environment
2.1 If M2_REPO Eclipse variable is missing then execute in terminal:
mvn -Declipse.workspace=<location of your workspace> eclipse:configure-workspace
2.2 In terminal: create eclipse project settings and create .classpath file by running
mvn eclipse:clean eclipse:eclipse
3. In Eclipse: refresh the project.
4. Create an olat.local.properties file somewhere
4.1 Copy the olat.local.properties.sample to olat.local.properties in the project root folder
4.2 Adjust the file to match your setup. See the comments in the file header for more configuration options.
4.3 Right click on the file src/main/java/olat.local.properties in our eclipse project to open the file
properties and link it to your own olat.local.properties you created in step 4.1.
5. In Eclipse: refresh the project again.
5.1 Make sure the project compiled without errors. Warnings are ok.
5.2 If the project did not compile you have to fix the problems before you proceed. See Troubleshooting below.
6. Prepare database permissions and initialize the database
6.1.a. In MySQL create a user 'openolat' and a database 'openolat'
CREATE DATABASE IF NOT EXISTS openolat;
GRANT ALL PRIVILEGES ON openolat.* TO 'openolat' IDENTIFIED BY 'openolat';
UPDATE mysql.user SET HOST='localhost' WHERE USER='openolat' AND HOST='%';
FLUSH PRIVILEGES;
6.1.b. Alternatively you can use a helper script to create the MySQL database user and the empty database:
scripts/dbAndUserSetup.sh
6.1.c. PostgreSQL users please check their PostgreSQL manual how to create a user and database
6.2 Write the OpenOLAT database schema to the OpenOLAT database. Example for MySQL:
mysql -u openolat -p openolat < src/main/resources/database/mysql/setupDatabase.sql
6.3 Optional: if you want to run the jUnit tests, make sure you also create and initialize the test database
that you configured in src/test/profile/mysql/olat.local.properties
7. In Eclipse: setup tomcat server by clicking on olat->Run As->"Run on Server".
7.1 The Run on Server wizard will pop up and check: manually define a new server
7.2 look for Apache->Tomcat v6.0 or v7.0 Server
7.3 Add openolat as web application in the step "Add and remove" and click finish
7.4 Double click the newly created server and increase the timeout to something like 180s
7.5 Open the launch configuration of the server, select the tab Arguments and add these arguments to the VM arguments:
-XX:MaxPermSize=128m -Xms128m -Xmx384m -Djava.awt.headless=true
7.6 Open the generated server.xml file and manually set the following parameters:
In the "Context" element set parameter reloadable="false"
In all "Connector" elements set paramter URIEncoding="UTF-8"
7.7 Option: to use the application server database connection pool configure a jdbc data resource in the the
"Context" element, set db.source=jndi in the olat.local.properties and db.jndi to the name of the data source:
db.source=jndi
db.jndi=java:comp/env/jdbc/OpenOLATDS
Next add the resource descriptor to your tomcat context descriptor:
<Resource name="jdbc/OpenOLATDS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="60000" username="openolat" password="openolat" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/openolat?useUnicode=true&amp;characterEncoding=UTF-8&amp;cachePrepStmts=true&amp;cacheCallableStmts=true&amp;autoReconnectForPools=true"/>
If unsure, set db.source=local to use the bundled data connection pool (not recommended for production)
8. In Eclipse: start the server
9. In your browser open URL http://localhost:8080/olat
You can log in with user "administrator" and password "openolat"
10. Have fun, give feedback and contribute!
*******************************
Troubleshooting
*******************************
A. OutOfMemoryException: in Eclipse: setup VM arguments by clicking on
Run > Run Configurations > Arguments > VM Arguments and pasting:
-Xmx384m -Xms128m -XX:MaxPermSize=128m -Djava.awt.headless=true
B. (optional) Create an empty olat.local.properties and save it to /yourTomcatDir/lib (OLAT searches for
this file on the classpath and /tomcat/lib is part of it). But OLAT should start with just the default config!
D. Usually you will get a timeout exception when you start a new OLAT. After double clicking on the server entry
you can increase the timeout for the startup.
E. If your tomcat starts very quickly but you cannot access OLAT it might be that tomcat did not find the OLAT
context. Right click the server entry and click publish to inform eclipse about a new or updated context.
F. If you run into problems with classes or resources not found e.g. "ClassNotFoundException" right click your
server config and run the "Clean..." Task to republish all resources. Problems comes mostly when switching
from eclipse to console and back with command like mvn clean, or eclipse clean and such. You will always get
a clean and working environment when you do the following: Eclipse clean, create eclipse settings with launch,
Server publish resources and restart OLAT.
Background (optional for further interest)
------------------------------------------------------------------
o There is only one spring context for the whole OpenOLAT which you can access via CoreSpringFactory. The context
is configured with the files serviceconfig/olat.properies and can be overwritten with olat.local.properties.
changes in olat.local.properties are reflected upon each restart of Tomcat.
\ No newline at end of file
...@@ -7,3 +7,441 @@ ...@@ -7,3 +7,441 @@
A sophisticated modular toolkit provides course authors with a wide range of didactic possibilities. Each OpenOLAT installation can be individually extended, adapted to organizational needs, and integrated into existing IT infrastructures. The architecture is designed for minimal resource consumption, scalability and security in order to guarantee high system reliability. A sophisticated modular toolkit provides course authors with a wide range of didactic possibilities. Each OpenOLAT installation can be individually extended, adapted to organizational needs, and integrated into existing IT infrastructures. The architecture is designed for minimal resource consumption, scalability and security in order to guarantee high system reliability.
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
## Table of Contents
1. [Licensing](#licensing)
2. [Ressources](#ressources)
3. [Community](#being-a-community-member)
4. [Developers](#developers)
* [Setting up OpenOLAT in Eclipse](#setting-up-openolat-in-eclipse)
* [Compress javascript and CSS](#compress-javascript-and-css)
* [REST API](#rest-api)
* [Automated tests](#automated-tests)
* [Experimental: setting up OpenOLAT on Eclipse with an Application Server](#experimental-setting-up-openolat-on-eclipse-with-an-application-server)
## Licensing
With regard to licensing and copyright please refer to the file [LICENSE](LICENSE) and [NOTICE.TXT](NOTICE.TXT)
## Ressources
* [Installation](https://www.openolat.com/fileadmin/adminwiki/_START_.html)
* [About OpenOLAT](https://www.openolat.com)
* [Mailing list](https://groups.google.com/forum/#!forum/openolat)
## Being a community member
We strongly suggest to participate in the OpenOLAT community membership program.
Even though this software is free and open source, the development and management
has to be funded by someone. If you like what we do and want the product to be
maintained and developed in the long run you should consider purchasing a member
ship.
## Developers
### Setting up OpenOLAT in Eclipse
This is an installation guide for developers.
#### Preconditions
* Check that you are using maven 3.1 or higher (mvn -V)
* Check that you have the mercurial plugin installed in eclipse
[MercurialEclipse update site](https://bitbucket.org/mercurialeclipse/update-site/raw/default/)
* Check that you have Mercurial (hg) installed
* MySQL 5.6 or greater or PostreSQL 9.4
#### 1. In Eclipse
Create a Mercurial repository location (https://hg.openolat.org/openolat) and
clone the repo. Do not add a password and make sure you uncheck the init Mercurial repo
checkbox at the end. Right click to clone the repository into your workspace.
If M2_REPO Eclipse variable is missing in Eclipse then execute in terminal:
```bash
mvn -Declipse.workspace=<location of your workspace> eclipse:configure-workspace
```
In a terminal, create the eclipse project and classpath settings by running:
```bash
mvn eclipse:clean eclipse:eclipse
```
Refresh the project.
You need now to create an olat.local.properties file somewhere. Copy the
`olat.local.properties.sample` to `olat.local.properties` in the project root folder, adjust
the file to match your setup. See the comments in the file header for more configuration
options. Right click on the file `src/main/java/olat.local.properties` in our eclipse
project to open the file properties and link it to your own olat.local.properties
you created before.
Make sure the project compiled without errors. Warnings are ok. If the project did not
compile, you have to fix the problems before you proceed. See [Troubleshooting](#troubleshooting)
section below.
#### 2. Setting up the database
Prepare database permissions and initialize the database.
*For MySQL*: create a user 'openolat' and a database 'openolat'
```sql
CREATE DATABASE IF NOT EXISTS openolat;
GRANT ALL PRIVILEGES ON openolat.* TO 'openolat' IDENTIFIED BY 'openolat';
UPDATE mysql.user SET HOST='localhost' WHERE USER='openolat' AND HOST='%';
FLUSH PRIVILEGES;
```
*For PostgreSQL*: please check their PostgreSQL manual how to create a user and database.
Write the OpenOLAT database schema to the OpenOLAT database. Example for MySQL:
```bash
mysql -u openolat -p openolat < src/main/resources/database/mysql/setupDatabase.sql
```
Optional: if you want to run the jUnit tests, make sure you also create and initialize the
test database that you configured in `src/test/profile/mysql/olat.local.properties` for
MySQL or `src/test/profile/postgresql/olat.local.properties` for PostgreSQL.
#### 3. Setting up the Tomcat server in Eclipse
Setup a tomcat server by clicking on OpenOLAT -> Run As -> "Run on Server". The
"Run on Server" wizard will pop up and you define define a new server. Look for
Apache -> Tomcat v8.0.
Add openolat as web application in the step "Add and remove" and click finish.
Double click the newly created server and increase the timeout to something like 180s.
Open the launch configuration of the server, select the tab Arguments and add these
arguments to the VM arguments:
```
-XX:+UseG1GC -XX:+UseStringDeduplication -Xms256m -Xmx1024m -Djava.awt.headless=true
```
Open the generated server.xml file and manually set the following parameters:
* In the "Context" element set parameter reloadable="false"
* In all "Connector" elements set paramter URIEncoding="UTF-8"
Option: to use the application server database connection pool configure a jdbc data
resource in the "Context" element, set db.source=jndi in the olat.local.properties with
db.jndi to the name of the data source like this:
```
db.source=jndi
db.jndi=java:comp/env/jdbc/OpenOLATDS
```
Next add the resource descriptor to your tomcat context descriptor.
*For MySQL:*
```xml
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" type="javax.sql.DataSource"
maxIdle="4" maxTotal="16" maxWaitMillis="10000"
name="jdbc/OpenOLATDS"
password="olat" username="olat"
url="jdbc:mysql://localhost:3306/openolat?useUnicode=true&amp;characterEncoding=UTF-8&amp;cachePrepStmts=true&amp;cacheCallableStmts=true&amp;autoReconnectForPools=true"
testOnBorrow="true" testOnReturn="false"
validationQuery="SELECT 1" validationQueryTimeout="-1"/>
```
*For PostreSQL:*
```xml
<Resource auth="Container" driverClassName="org.postgresql.Driver" type="javax.sql.DataSource"
maxIdle="4" maxTotal="16" maxWaitMillis="-1"
name="jdbc/OpenOLATPostgresDS"
username="postgres" password="postgres"
url="jdbc:postgresql://localhost:5432/olat"
testOnBorrow="true" testOnReturn="false"
validationQuery="SELECT 1" validationQueryTimeout="-1"/>
```
If unsure, set db.source=local to use the bundled data connection pool (not recommended for production)
You can now start the server and open the following URL
[http://localhost:8080/olat](http://localhost:8080/olat) in your favorite browser. You can
log in with user "administrator" and password "openolat".
Have fun, give feedback and contribute!
#### Troubleshooting
* OutOfMemoryException: in Eclipse: setup VM arguments by clicking on Run > Run Configurations > Arguments > VM Arguments
and pasting: `-XX:+UseG1GC -XX:+UseStringDeduplication -Xms256m -Xmx1024m -Djava.awt.headless=true`
* Optional: create an empty olat.local.properties and save it to /yourTomcatDir/lib
(OpenOLAT searches for this file on the classpath and /tomcat/lib is part of it). But it
should start with just the default config!
* Usually you will get a timeout exception when you start a new OpenOLAT. After double clicking
on the server entry you can increase the timeout for the startup.
* If your tomcat starts very quickly but you cannot access OpenOLAT it might be that tomcat did
not find the OpenOLAT context. Right click the server entry and click publish to inform eclipse
about a new or updated context.
* If you run into problems with classes or resources not found e.g. "ClassNotFoundException" right click your
server config and run the "Clean..." Task to republish all resources. Problems comes mostly when switching
from eclipse to console and back with command like mvn clean, or eclipse clean and such. You will always get
a clean and working environment when you do the following: Eclipse clean, create eclipse settings with launch,
Server publish resources and restart OpenOLAT.
### Background (optional for further interest)
There is only one spring context for the whole OpenOLAT which you can access via
CoreSpringFactory. The context is configured with the files`serviceconfig/olat.properies`
and can be overwritten with `olat.local.properties`. Changes in olat.local.properties are
reflected upon each restart of Tomcat. You can further override OpenOLAT settings with
JVM arguments `-Dmy.option=enabled`.
### Compress javascript and CSS
The javascript and CSS files are minified and aggregated. If you make some changes, run the following
command to compress them (execution time ca. 1-2 minutes) and refresh your Eclipse project:
```bash
mvn clean package
mvn compile -compressjs,tomcat
```
### Themes
[Readme](src/main/webapp/static/themes/themes.README)
### REST API
To read the OpenOLAT REST API documentation:
1. start OpenOLAT
2. go to Administration -> Core configuration -> REST API
3. Make sure the REST API ist enabled
4. Click the documentation link in the admin panel or open YOURSERVERURL/restapi/api/doc in your browser
For developer: if you modified the documentation in the source files, you need to compile
the REST API documentation. Do the following:
```bash
mvn clean package
mvn compile -Pdocumentation,tomcat
```
The process need a lot of memory, give it 4 Gig.
### Automated tests
#### Preconditions
* Make sure the following ports are not in use (Selenium, Tomcat )
`14444 / 8080 / 8009 / 8089`
* Make sure you have a MySQL database version 5.6 with the InnoDB as default engine
or PostgreSQL 9.4 or newer. The server must be at localhost.
* Make sure maven has enough memory. E.g execute the following:
```bash
export MAVEN_OPTS= -Xms512m -Xmx1024m
mvn compile -Pdocumentation,tomcat
```
* Make sure the tmp directory is writable. E.g. execute the following.
```bash
ls -la `printenv TMPDIR`
```
#### Setup (necessary only once)
Setup database users and tables in the pom.xml. The default settings are:
```xml
<test.env.db.name>olattest</test.env.db.name>
<test.env.db.user>olat</test.env.db.user>
<test.env.db.pass>olat</test.env.db.pass>
```
You can override them with -D in the command line.
You need an empty database named olat. The maven command will create and drop
databases automatically but need an existing database to do that. Here we will
explain it with MySQL.
Setup first an user for the database
```sql
CREATE USER 'olat'@'localhost' IDENTIFIED BY 'olat';
```
Create the database:
```sql
CREATE DATABASE IF NOT EXISTS olat;
GRANT ALL PRIVILEGES ON olat.* TO 'olat' IDENTIFIED BY 'olat';
UPDATE mysql.user SET HOST='localhost' WHERE USER='olat' AND HOST='%';
FLUSH PRIVILEGES;
```
Create the real test database, it will set once the permissions:
```sql
CREATE DATABASE IF NOT EXISTS olattest;
GRANT ALL PRIVILEGES ON olattest.* TO 'olat' IDENTIFIED BY 'olat';
FLUSH PRIVILEGES;
```
Initialize the database
```bash
mysql -u olat -p olattest < src/main/resources/database/mysql/setupDatabase.sql
```
#### Execute JUnit tests
The JUnit tests load the framework to execute (execution time ca. 10m)
**For MySQL**
```bash
mvn clean test -Dwith-mysql -Ptomcat
```
The following options are available to configure the database connection:
```bash
-Dtest.env.db.user=root
-Dtest.env.db.pass=serial
```
**For PostgreSQL**
```bash
mvn clean test -Dwith-postgresql -Ptomcat
```
with the options:
```bash
-Dtest.env.db.postgresql.user=postgres
-Dtest.env.db.postgresql.pass=serial
```
To only run the OpenOLAT test suite and exclude the unit tests of QtiWorks, add the following
option:
```bash
-Dtest=org.olat.test.AllTestsJunit4
```
Example:
```bash
mvn clean test -Dwith-postgresql -Dtest.env.db.postgresql.pass=serial -Dtest=org.olat.test.AllTestsJunit4 -Ptomcat
```
#### Execute selenium functional tests
The selenium integration tests start the whole web application in Tomcat 8.0. They run with
Google Chrome and its WebDriver will be automatically downloaded (internet connection
needed). It need to be installed the standard way on Mac or Linux.
Execution time ca. 65m
**For MySQL:**
```bash
mvn clean verify -DskipTests=true -Dwith-mysql -Ptomcat
```
**For PostgreSQL:**
```bash
mvn clean verify -DskipTests=true -Dwith-postgresql -Dtest.env.db.postgresql.pass=serial -Ptomcat
```
#### Execute a single selenium functional integration test in Eclipse
First build the application without tests as before
```bash
mvn clean verify -DskipTests=true -DskipSeleniumTests=true -Ptomcat
```
Run single test as JUnit Test in Eclipse
### Experimental: setting up OpenOLAT on Eclipse with an Application Server
OpenOLAT supports only Apache Tomcat officially, but it can also run on other application
servers like JBoss AS / Wildfly. This section is intended for people who have
some minimal experience with these servers and can install a JDBC driver, set some
JMS resources...
As of OpenOLAT 10, we need WildFly because of JPA 2.1 (Hibernate 5.2.x)
The beginning of the installation is the same as Tomcat as described above. To create
your eclipse project, use these commands instead of the default one:
```bash
mvn eclipse:clean eclipse:eclipse -P-tomcat,wildfly
```
#### Configuration WildFly (JBoss AS 10.1)
We need Hibernate 5.2, you need to use the utorial to update the version of hibernate
in Widlfly: http://docs.jboss.org/hibernate/orm/5.2/topical/html_single/wildfly/Wildfly.html
Define a JDBC connection pool in your standalone.xml configuration with a jndi-name like:
`java:jboss/datasources/OpenOLATDS` and set this JNDI name in olat.local.properties set
the following properties:
```
db.source=jndi
db.jndi=java:jboss/datasources/OpenOLATDS
cluster.mode=Cluster
```
The cluster mode will disable the hibernate cache
Create a queue with a jndi-name like this:
```
java:jboss/exported/jms/queue/searchQueue
```
and a topic:
```
java:jboss/exported/jms/topic/sysbus
```
in olat.local.properties set the following properties:
```
jms.provider=jndi
jms.broker.jndi=java:/ConnectionFactory
sysbus.broker.jndi=java:jboss/exported/jms/topic/sysbus
search.broker.jndi=java:jboss/exported/jms/queue/searchQueue
index.broker.jndi=java:jboss/exported/jms/queue/indexQueue
certificate.broker.jndi=java:jboss/exported/jms/queue/certificateQueue
```
The following features are delegated to the application server
| State | Feature |
| --- | --- |
| OK | JDBC Connections |
| OK | JMS |
| OK | JAX-RS (restapi) |
| OK | JAX-WS (vitero, openmeetings) |
| x | Mail |
| x | LDAP Connection |
| OK | Hibernate/JPA (only JBoss AS, we depend on Hibernate) |
| OK | Caching (for JPA second level cache for example) |
junit and integration tests in OpenOLAT 8
=========================================
* Preconditions
-----------------------------------------
- Make sure the following ports are not in use (Selenium, Tomcat )
14444 / 8080 / 8009 / 8089
- Make sure you have a MySQL database version 5.1 or 5.5 with the InnoDB as default engine
The server must be at localhost. To change the config see databaseCorecontext.xml
- Clone a clean project or remove any olat.local.properties you might have on the classpath. This is important!
- Make sure maven has enough memory. E.g execute the following:
export MAVEN_OPTS= -Xms512m -Xmx1024m
- Make sure the tmp directory is writable. E.g. execute the following.
ls -la `printenv TMPDIR`
* Setup (necessary only once)
-----------------------------------------
- Setup database users and tables in the pom.xml. The default settings are:
<test.env.db.name>olattest</test.env.db.name>
<test.env.db.user>olat</test.env.db.user>
<test.env.db.pass>olat</test.env.db.pass>
- Setup first an user for the database
CREATE USER 'olat'@'localhost' IDENTIFIED BY 'olat';
- Create a first database named olat (the maven create and drop databases automatically and need an existing database to do that)
CREATE DATABASE IF NOT EXISTS olat;
GRANT ALL PRIVILEGES ON olat.* TO 'olat' IDENTIFIED BY 'olat';
UPDATE mysql.user SET HOST='localhost' WHERE USER='olat' AND HOST='%';
FLUSH PRIVILEGES;
- Create the real test database in mysql:
CREATE DATABASE IF NOT EXISTS olattest;
GRANT ALL PRIVILEGES ON olattest.* TO 'olat' IDENTIFIED BY 'olat';
FLUSH PRIVILEGES;
- Initialize the database
mysql -u olat -p olattest < src/main/resources/database/mysql/setupDatabase.sql
* Execute jUnit integration tests
---------------------------------
- junit integration tests that load the framework to execute (execution time ca. 10m)
- MySQL
mvn clean test -Dwith-mysql -Ptomcat
or with more options
mvn clean test -Dwith-mysql -Dtest.env.db.user=root -Dtest.env.db.pass=serial -Ptomcat
- PostgreSQL
mvn clean test -Dwith-postgresql -Ptomcat
or if you want to specify the password:
mvn clean test -Dwith-postgresql -Dtest.env.db.postgresql.pass=serial -Ptomcat
- Oracle
The support of Oracle is still EXPERIMENTAL
- you need a clean database as the maven process doesn't create a new one (every time)
- You need more cursors (if you don't know what it is, don't run this tests :-):
ALTER SYSTEM SET open_cursors = 400 SCOPE=BOTH;
- configure the olat.local.properties in src/test/profile/oracle
- you need to install the JDBC driver locally (one time) as there isn't any maven repo for them (licensing issue)
mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.0 -Dpackaging=jar -DcreateChecksum=true
then you can run the test suite
mvn clean test -Dwith-oracle -Ptomcat
- To only run the OpenOLAT test suite and exclude the unit tests of QtiWorks, add the following option: -Dtest=org.olat.test.AllTestsJunit4
- The junit testresults can be found at target/surefire-reports/*
Double click the xml files in Eclipse to display the results in the standards jUnit console
* Execute selenium functional integration tests
-----------------------------------------------
- selenium integration tests which started the whole web application in Tomcat (execution time ca. 30 - 45m)
- MySQL
mvn clean verify -DskipTests=true -Dwith-mysql -Ptomcat
- PostgreSQL
mvn clean verify -DskipTests=true -Dwith-postgresql -Dtest.env.db.postgresql.pass=serial -Ptomcat
The Selenium tests can be run with Chrome browser. It need to be installed the standard way on
Mac or Linux and the test process will download the WebDriver and found the browser.
* Execute a single selenium functional integration test in Eclipse
------------------------------------------------------------------
- First build the application without tests as before
mvn clean verify -DskipTests=true -DskipSeleniumTests=true -Ptomcat
- Run single test as JUnit Test in Eclipse
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment