THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Excerpt | ||
---|---|---|
| ||
Running and Writing OpenJPA unit tests |
Running and Writing Tests with OpenJPA
OpenJPA's unit tests are written using JUnit. For a template for a simple test case, see the code for TestPersistence.java.
...
Code Block |
---|
$ mvn test -Dtest=TestPersistence -Dopenjpa.loglevel=TRACE [INFO] Scanning for projects... [INFO] Reactor build order: ... 690 test TRACE [main] openjpa.jdbc.SQL - <t 4261185, conn 3061987> executing prepstmnt 12659709 INSERT INTO AllFieldTypes (id, arrayOfStrings, booleanField, byteField, charField, dateField, doubleField, floatField, intField, longField, shortField, stringField) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [params=(long) 601, (null) null, (int) 0, (byte) 0, (int) 0, (null) null, (double) 0.0, (float) 0.0, (int) 0, (long) 0, (short) 0, (null) null] 701 test TRACE [main] openjpa.jdbc.SQL - <t 4261185, conn 3061987> [11 ms] spent 701 test TRACE [main] openjpa.jdbc.JDBC - <t 4261185, conn 3061987> [0 ms] commit 702 test TRACE [main] openjpa.jdbc.JDBC - <t 4261185, conn 0> [0 ms] close ... $ |
Testing against alternate databases
By default, OpenJPA uses the Derby database for testing. The openjpa-persistence-jdbc/pom.xml
POM declares various pre-defined databases against which tests can be executed. For example, to test against the stand-alone HSQLDB database, you can run with the "test-hsqldb" profile:
...