Added: websites/staging/openjpa/trunk/content/testing.html ============================================================================== --- websites/staging/openjpa/trunk/content/testing.html (added) +++ websites/staging/openjpa/trunk/content/testing.html Sun Dec 9 13:13:35 2012 @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + Apache OpenJPA -- + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + +
+ OpenJPA Logo + +   + + ASF Logo +
+ + +
+ +
+ + + + + + + + + +
+ + +
+

+

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 +.

+

If you want to contribute your own test case then follow the guidelines +.

+

Once you have downloaded and built OpenJPA (see Building +), you can run individual tests using the "test" goal to maven. For +example:

+
mvn test -DfailIfNoTests=false -Dtest=TestPersistence
+
+ + +

+
+ By default Maven will fail if there are no testcases found in any +module you build. The examples solve this by specifying +-DfailIfNoTests=false but you can also change your personal default by +adding the following to ${user.home}/.m2/settings.xml :

+
    <profile>
+        <id>enable-no-tests</id>
+        <activation>
+        <activeByDefault>true</activeByDefault>
+        </activation>
+        <properties>
+        <failIfNoTests>false</failIfNoTests>
+        </properties>
+    </profile>
+
+ + +

+

To get more debugging information (e.g., to see the SQL that is being +executed against the database), you can enable trace-level logging from the +command line using the "openjpa.Log" system property. For example:

+
$ mvn test -DfailIfNoTests=false -Dtest=TestPersistence -Dopenjpa.Log=DefaultLevel=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) nu
 ll]
+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
+...
+$
+
+ + +

+

Setting additional Log parameters

+

There are several parameters that are used by OpenJPA Log. Here are some +that might be of value when debugging test cases. Note that the logger +names are case sensitive while the log levels are not.

+
    +
  • DefaultLevel sets the level for all loggers that are not otherwise set
  • +
  • file sets the file name for logging output
  • +
  • Enhance logs messages from the enhancer
  • +
  • Metadata logs messages from the metadata processor
  • +
  • Tool logs messages from the schema synchronization tool
  • +
  • SQL logs messages from the SQL generator
  • +
  • JDBC logs messages related to JDBC
  • +
  • Schema logs messages related to schema
  • +
  • Runtime logs messages related to runtime
  • +
  • Query logs messages related to queried
  • +
  • DataCache logs messages related to caching
  • +
+

Log levels specify the minimum log message that is output. All log messages +with a level higher than the log level set for a logger are output. So if +INFO is specified, log messages of level INFO, WARN, ERROR, and SEVERE are +output.

+
    +
  • TRACE
  • +
  • INFO
  • +
  • WARN
  • +
  • ERROR
  • +
  • FATAL
  • +
+

For example, to avoid enhancement warnings, get detailed SQL information, +and write the log data to a file:

+
mvn test -Dtest=TestPersistence -Dopenjpa.Log=Enhance=ERROR,SQL=TRACE,file=openjpa.log
+
+ + +

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:

+
mvn test -DfailIfNoTests=false -Dtest=TestPersistence -Ptest-hsqldb
+
+ + +

For databases that are not in the pre-defined list, you can manually +specify connection parameters to use for testing under the "test-custom" +profile. You will need to manually provide the driver class and specify all +of the connection parameters. For example, to test against Oracle, you +might run:

+
mvn test -DfailIfNoTests=false -Dtest=TestPersistence -Ptest-custom \
+  -Dopenjpa.custom.driverjar=$(pwd)/drivers/jdbc-oracle-10_2_0_1_0.jar \
+  -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver \
+  -Dopenjpa.custom.url=jdbc:oracle:thin:@HOST:PORT:DBNAME \
+  -Dopenjpa.custom.username=USERNAME \
+  -Dopenjpa.custom.password=PASSWORD
+
+ + +

If you frequently need to test against another database, you can +permanently declare the database connection parameters in the +~/.m2/settings.xml file under a custom profile. For example:

+
<settings>
+    <profiles>
+    <profile>
+        <id>test-oracle</id>
+        <properties>
+        <test-custom>true</test-custom>            
+        <openjpa.custom.driverjar>${user.home}/.m2/privaterepos/jdbc-oracle-10_2_0_1_0.jar</openjpa.custom.driverjar>
+        <openjpa.custom.driverclass>oracle.jdbc.driver.OracleDriver</openjpa.custom.driverclass>               
+        <openjpa.custom.url>jdbc:oracle:thin:@HOST:PORT:DBNAME</openjpa.custom.url>
+        <openjpa.custom.username>USERNAME</openjpa.custom.username>
+        <openjpa.custom.password>PASSWORD</openjpa.custom.password>
+        </properties>
+    </profile>
+    </profiles>
+</settings>
+
+ + +

This profile can then be executed by running:

+
mvn test -DfailIfNoTests=false -Dtest=TestPersistence -Ptest-custom,test-oracle
+
+ + +

+

Running JUnits in Eclipse

+

You'll probably want to setup a Debug Configuration in Eclipse for running +the JUnit testcases.

+
    +
  1. +

    Run --> Debug Configurations... Create a new JUnit configuration

    +

    eclipse_dbgcfg_1.png

    +
  2. +
  3. +

    For the Test tab - Give the configuration a Name, select a Project and +Test class, and you'll probably want to select the "Keep JUnit running..." +option.

    +

    eclipse_dbgcfg_2.png

    +
  4. +
  5. +

    For the Arguments tab - Press the Variables... button. This will allow us +to define variables that can be shared across other Release/Debug +Configurations within this workspace.

    +

    eclipse_dbgcfg_3.png

    +
  6. +
  7. +

    For the Select Variable window - Press the Edit Variables... button.

    +

    eclipse_dbgcfg_4.png

    +
  8. +
  9. +

    For the Preferences windows - Press New... to add two variables. + eclipse_dbgcfg_5.png

    +
    Name = openjpa.trace
    +Value = -Dopenjpa.Log=DefaultLevel=TRACE
    +Description = Set OpenJPA logging to TRACE
    +
    + + +

    eclipse_dbgcfg_6.png

    +
    Name = connect.derby
    +Value = -Dopenjpa.ConnectionDriverName=org.apache.derby.jdbc.EmbeddedDriver
    +    -Dopenjpa.ConnectionURL=jdbc:derby:target/database/openjpa-derby-database;create=true
    +Description = Connection properties for Derby
    +
    + + +

    eclipse_dbgcfg_7.png

    +
  10. +
  11. +

    After the above are created and saved, add the new variables as VM Arguments.

    +
    ${openjpa.trace}
    +${connect.derby}
    +
    + + +

    eclipse_dbgcfg_8.png

    +
  12. +
+
+
+
+
+
+
+
+
+ +
+
+
+ Copyright (C) 2006,2012 The Apache Software Foundation. Licensed under Apache License 2.0.
+ Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
+ Other names may be trademarks of their respective owners.
+
+ + + + + + Added: websites/staging/openjpa/trunk/content/thanks.html ============================================================================== --- websites/staging/openjpa/trunk/content/thanks.html (added) +++ websites/staging/openjpa/trunk/content/thanks.html Sun Dec 9 13:13:35 2012 @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + Apache OpenJPA -- + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + +
+ OpenJPA Logo + +   + + ASF Logo +
+ + +
+ +
+ + + + + + + + + +
+ + +
+

The Apache OpenJPA team would like to thank the following individuals and +organizations.

+

+

Apache Sponsors

+

Without those sponsors, the ASF would simply not exist or sustain its +activities : +http://www.apache.org/foundation/thanks.html

+

For those who want to know more about the Apache Sponsorship Program, +please check : +http://www.apache.org/foundation/sponsorship.html

+

Thanks !

+

+

Website Design

+

Marc Prud'hommeaux - Wiki template design based on Apache ActiveMQ template.

+

+ +

Donald R. Woods

+

+

Organizations who helped our project . . .

+ + + + + + + + +
Organization Donation type Organization Contact Apache Contact
ej-technologies jProfiler license Hannes Kegel, CTO Pinaki Poddar
+ +

+ +

Other Related Projects + that OpenJPA depends upon or uses.

+
+
+
+
+
+
+
+
+ +
+
+
+ Copyright (C) 2006,2012 The Apache Software Foundation. Licensed under Apache License 2.0.
+ Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
+ Other names may be trademarks of their respective owners.
+
+ + + + + + Added: websites/staging/openjpa/trunk/content/tools.html ============================================================================== --- websites/staging/openjpa/trunk/content/tools.html (added) +++ websites/staging/openjpa/trunk/content/tools.html Sun Dec 9 13:13:35 2012 @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + Apache OpenJPA -- + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + +
+ OpenJPA Logo + +   + + ASF Logo +
+ + +
+ +
+ + + + + + + + + +
+ + +
+

+

Tools for OpenJPA

+

This page will host description of design-time and runtime tools for +OpenJPA. +The tools mentioned below are available as command-line utilities. In the +future, they may be made available as interactive graphical tools +integrated into popular IDEs such as Eclipse or IntelliJ.

+

+

Existing OpenJPA Tools

+

The OpenJPA distribution and runtime already comes with a series of useful +tools to:

+
    +
  • Entity Enhancement + for enhancing the bytecode of POJO domain classes
  • +
  • reverse map + a database schema to Java source code
  • +
  • create/synchronize + a Java persistent domain model to a database schema
  • +
  • generate + canonical metamodel classes for strictly-typed Criteria queries
  • +
+

+

Tools Under Development

+

A new OpenJPA Tools subproject has been created to deliver a new set of +tools that are decoupled from a specific OpenJPA release.

+ +
+
+
+
+
+
+
+
+ +
+
+
+ Copyright (C) 2006,2012 The Apache Software Foundation. Licensed under Apache License 2.0.
+ Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
+ Other names may be trademarks of their respective owners.
+
+ + + + + + Added: websites/staging/openjpa/trunk/content/top-navigation-bar.html ============================================================================== --- websites/staging/openjpa/trunk/content/top-navigation-bar.html (added) +++ websites/staging/openjpa/trunk/content/top-navigation-bar.html Sun Dec 9 13:13:35 2012 @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + Apache OpenJPA -- + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + +
+ OpenJPA Logo + +   + + ASF Logo +
+ + +
+ +
+ + + + + + + + + +
+ + +
+ +
+
+
+
+
+
+
+
+ +
+
+
+ Copyright (C) 2006,2012 The Apache Software Foundation. Licensed under Apache License 2.0.
+ Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
+ Other names may be trademarks of their respective owners.
+
+ + + + + + Added: websites/staging/openjpa/trunk/content/update-release-text-files.html ============================================================================== --- websites/staging/openjpa/trunk/content/update-release-text-files.html (added) +++ websites/staging/openjpa/trunk/content/update-release-text-files.html Sun Dec 9 13:13:35 2012 @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + Apache OpenJPA -- + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + +
+ OpenJPA Logo + +   + + ASF Logo +
+ + +
+ +
+ + + + + + + + + +
+ + +
+

+

Updating release text files.

+

+

Obtaining the list of resolved issues from JIRA. 

+
    +
  1. Go to the main JIRA releases page at http://issues.apache.org/jira/browse/OPENJPA?report=com.sourcelabs.jira.plugin.portlet.releases:releases-projecttab
  2. +
  3. Under Unreleased find the version you're about to release and click on +"Release Notes". +Keep this page open since it contains a nice reference point for many of +the documents you will edit.
  4. +
+

+

Update text files

+
    +
  • openjpa-projects/CHANGES.txt
      +
    • Update the overview paragraph with the new version and a brief description of the release.
    • +
    • Remove the previous changes section and replace with a url to the location in SVN. This is similar to what HTTPD does in its CHANGES file
    • +
    • Create a new section : OpenJPA x.y.z changes and copy the JIRA issues resolved in this section. You may want to do some minor editing by hand to ensure the file respects the 80 character column width guideline.
    • +
    +
  • +
  • +

    openjpa-project/RELEASE-NOTES.html

    +
      +
    • Similar to CHANGES.txt you need to update the version number and provide a brief description of the release.
    • +
    • Remove the previous list of changes for the previous release. Replace this with a link to the last release's file in SVN.
    • +
    • Add a new section. This can be copied from the JIRA page with one exception (see the next step).
    • +
    • +

      Update the links at the top of the file. If you've copied changes from JIRA you'll see a section like this :

      +
       <h2> Bug </h2>
      +
      + + +

      Replace it with :

      +
       <h4><a name='Bug'>Bug</h4>
      +
      + + +

      You should also check the links at the top to make sure they are all valid.

      +
    • +
    +
  • +
  • +

    openjpa-project/NOTICE.txt +NOTICE.txt "usually" does not need to be updated. The exceptions are when a new dependency has been introduced (ie a new version of Serp) or if a new source file containing a copyright notice is introduced.

    +
  • +
  • +

    openjpa-project/LICENSE.txt +Similar to NOTICE.txt this file does not require updating in each release. It should contain the current version of the Apache license, and any other licenses mentioned in NOTICE.txt.

    +
  • +
  • +

    openjpa-project/README.txt +This file rarely needs updating - just make sure the URL is accurate.

    +
  • +
  • +

    openjpa-project/BUILDING.txt +This file rarely needs updating.

    +
  • +
+
+
+
+
+
+
+
+
+ +
+
+
+ Copyright (C) 2006,2012 The Apache Software Foundation. Licensed under Apache License 2.0.
+ Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
+ Other names may be trademarks of their respective owners.
+
+ + + + + +