diff --git a/howto-test.md b/howto-test.md new file mode 100644 index 000000000..243ed5200 --- /dev/null +++ b/howto-test.md @@ -0,0 +1,152 @@ +This is a short description how to run tests +============================================ + +Run tests from maven +-------------------- + +Just type `mvn test` - it will run the whole test suite with the settings +from `src/test/resources/ebean.properties`. + +Run tests from eclipse +---------------------- + +Running tests requires, that the classes are enhanced. By default, the +`BaseTestCase` tries to load the enhancer-agent in a very early stage. This +also works for most test cases, but it does not work if you try to run a +complete test-suite, as classes that are loaded before the enhancer-agent +kicks in will not get enhanced. To solve this problem, you need either the +[Eclipse-Enhancer-Plugin](https://github.com/ebean-orm-tools/ebean-eclipse-enhancer) +or add the agent to your JVM arguments (Preferences->Installed JREs) or to +your run configuration: +`-javaagent:/.m2/repository/io/ebean/ebean-agent//ebean-agent-.jar=debug=0` + + +Platform Tests +============== + +By default, the `h2` platform is used. To test a different platform, add +`-Ddatasource.default=xxx` to your maven command or JVM arguments. + +'h2' platform +------------- + +Reqires no setup + +run: `mvn clean test` + +Current status: PASS +Tests run: 1986, Failures: 0, Errors: 0, Skipped: 16 + +'pg' platform +------------- + +Reqirements +- a locally installed PostgreSQL server with PostGis. +- Create a user "unit" with password "unit" and a database "unit" +- Give the user all permissions to that db + +run: `mvn clean test -Ddatasource.default=pg` + +Current status: PASS +Tests run: 1986, Failures: 0, Errors: 0, Skipped: 16 + + +'mysql' platform +------------- + +Reqirements +- a locally installed MySQL server. +- Create a user "unit" with password "unit" and a database "unit" +- Give the user all permissions to that db + +run: `mvn clean test -Ddatasource.default=mysql` + +Current status: FAIL +Tests run: 1986, Failures: 2, Errors: 4, Skipped: 16 + + + +'sqlserver' platform +-------------------- + +Reqires an installed sqlserver - e.g. https://hub.docker.com/r/microsoft/mssql-server-linux/ + +- Create a user "ebean" with password "ebean" and a database "ebean_unittest" +- Adjust the connection string and/or username in ebean.properties + +run: `mvn clean test -Ddatasource.default=mssql` + +Current status: FAIL +Tests run: 1986, Failures: 19, Errors: 43, Skipped: 16 + + + +'oracle' platform +----------------- + +Reqires a locally installed Oracle server. +- Create a user "unit" with password "unit" with all permissions +- The test wirtes directly to the "xe" SID - so do not use a productive server! +- As the Oracle JDBC driver is only available on an oracle repository, + you need a special maven setup as described [here](http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010) + +run: `mvn clean test -Ddatasource.default=ora -Poracle` + +Current status: FAIL +Tests run: 1986, Failures: 17, Errors: 34, Skipped: 16 + + + +'db2' platform +-------------- + +Reqires a locally installed DB2 Express-C server. +- Create a user "unit" with password "unit" with all permissions +- Install the db2jcc4 driver (see pom.xml) + +run: `mvn clean test -Ddatasource.default=db2 -Pdb2` + +Current status: FAIL +Tests run: 1986, Failures: 33, Errors: 26, Skipped: 16 + + +'sqlite' platform +----------------- + +Reqires no setup + +run: `mvn clean test -Ddatasource.default=sqlite` + +Current status: FAIL +Tests run: 1986, Failures: 24, Errors: 86, Skipped: 16 + +After some time, the db locks up, every test takes 3 seconds and fails with +"the database file is locked" + + + +'hsqldb' platform +----------------- + +Reqires no setup + +run: `mvn clean test -Ddatasource.default=hsqldb` + +Current status: FAIL +Tests run: 1980, Failures: 3, Errors: 657, Skipped: 16 + + +@Rob FYI +The problem is https://sourceforge.net/p/hsqldb/bugs/1364/ +In `InsertHandler.getPstmt` the `meta.getIdentityDbColumns()` contains +'id' in lowercase. Changing that to uppercase gives me this result: +`Tests run: 1986, Failures: 2, Errors: 18, Skipped: 16` +(as quick hack I added temporary a toUpperCase to BindableIdScalar.getIdentityColumn) + + +'sqlanywhere' platform +---------------------- + +TODO: not yet tested + + diff --git a/pom.xml b/pom.xml index 2a0e5bc3a..a926803a8 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,56 @@ HEAD + + + + oracle + + + com.oracle.jdbc + ojdbc8 + 12.2.0.1 + test + + + + + maven.oracle.com + + true + + + false + + https://maven.oracle.com + default + + + + + + db2 + + + com.ibm.jdbc + db2jcc4 + 4.23.42 + test + + + + @@ -197,7 +247,8 @@ mysql mysql-connector-java - 6.0.5 + + 5.1.43 test diff --git a/src/test/resources/ebean.properties b/src/test/resources/ebean.properties index 7e0893779..7375f601a 100644 --- a/src/test/resources/ebean.properties +++ b/src/test/resources/ebean.properties @@ -103,13 +103,14 @@ datasource.hsqldb.databaseDriver=org.hsqldb.jdbcDriver datasource.mysql.username=unit datasource.mysql.password=unit datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:3306/unit -#datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:3306/unit?useLegacyDatetimeCode=false +#connection String for Connector/j 6.0 +#datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:3306/unit?useLegacyDatetimeCode=false&serverTimezone=UTC datasource.mysql.databaseDriver=com.mysql.jdbc.Driver datasource.ora.username=unit datasource.ora.password=unit -datasource.ora.databaseUrl=jdbc:oracle:thin:@//127.0.0.1:1521/orcl +datasource.ora.databaseUrl=jdbc:oracle:thin:@127.0.0.1:1521:xe datasource.ora.databaseDriver=oracle.jdbc.driver.OracleDriver ## set this to use timestamp rather than timestamptz @@ -125,5 +126,10 @@ datasource.pg.maxStackTraceSize=50 #TODO we need an sqlserver for travis - maybe from azure cloud datasource.mssql.username=ebean datasource.mssql.password=ebean -datasource.mssql.databaseUrl=jdbc:sqlserver://10.75.1.40:1433;databaseName=ebean_unittest;selectMethod=cursor +datasource.mssql.databaseUrl=jdbc:sqlserver://10.75.1.45:1433;databaseName=ebean_unittest;selectMethod=cursor datasource.mssql.databaseDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver + +datasource.db2.username=db2admin +datasource.db2.password=veryverysecret#1234 +datasource.db2.databaseUrl=jdbc:db2://127.0.0.1:50000/SAMPLE +datasource.db2.databaseDriver=com.ibm.db2.jcc.DB2Driver