Added: openjpa/site/trunk/original.cwiki.content/using-criteria-api-in-daytrader.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/using-criteria-api-in-daytrader.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/using-criteria-api-in-daytrader.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/using-criteria-api-in-daytrader.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1,134 @@ +h1. Using Criteria API in DayTrader + +A current DayTrader project implementation in Apache Geronimo contains several JPQL queries. These can easily be converted to JPA Criteria API queries. A sample with this conversion can be created to run on either the Apache Geronimo server or the WebSphere Application Server with the built-in Derby database. + + +h2. Downloading DayTrader + +You must have Subversion installed in order to download the DayTrader implementation.Subversion can be downloaded from [http://subversion.apache.org/packages.html]. Use the 2.1.3 version of DayTrader for this sample. Follow the following steps: +# Create a root directory for the download. For this example, we will use a directory called *DayTrader*. +# Create subdirectories *branches/2.1.3* under the *DayTrader* directory +# cd to *DayTrader* +# Issue the following subversion command: + svn checkout [https://svn.apache.org/repos/asf/geronimo/daytrader/branches/2.1.3] branches/2.1.3 + +h2. Build DayTrader + +You must have maven installed in order to build DayTrader. Maven can be downloaded from [http://maven.apache.org/download.html]. Unzip the file to a directory and run mvn.bat\|.sh in the bin subdirectory to install. Add the bin subdirectory to you system path. + +Maven needs a repository. Typically it is at the following: +* Windows - C:\Documents and Settings\<userid>\.m2\repository +* Linux/unix - \~/.m2/repository + +From the *DayTrader/branches/2.1.3* directory, type "mvn clean install" to build the project. (Note: If you see errors that say "java.util.zip.ZipException: error in opening zip file", ignore them for this exercise.) + + + +h2. + +h2. Apply the DayTrader Patch + +The following patch can be applied using a system or downloaded *patch* utility. (For example, you can get a patch utility for Windows from [http://gnuwin32.sourceforge.net/packages/patch.htm].) + +for Geronimo - [^daytrader_geronimo.patch] + + + + + + + + + +for WebSphere - [^daytrader_websphere.patch] + + + +Download the appropriate patch and go to the *DayTrader/branches.2.1.3* directory to apply it. For example, with the patch utility mentioned above, you can type: + +patch \-p0 \-i <path-to>/daytrader_geronimo.patch + +After you have applied the patch, you can see the changes from JPQL to the Criteria API in the java class org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBBean. The changes are in the following 4 methods: +* getMarketSummary() +* getClosedOrders() +* getAllQuotes() +* getHoldings() + +(Note: If you view these changes in eclipse, and you have previously run "mvn eclipse:eclipse" to setup eclipse projects, you'll have to run this command again in order for this file to compile.) + +You can also [Apply an Eclipse Patch] + + + + + + +h2. Re-create the DayTrader ear file + +From the *DayTrader/branches/2.1.3* directory, type "mvn clean install" to build the project. + + + +h2. Run DayTrader on Geronimo + +This writeup assumes some familiarity with Apache Geronimo. The download and documentation can be found at [http://geronimo.apache.org.|http://geronimo.apache.org/] + + + + + + + + + + +Install and start the Geronimo server + +Add jpa2 plugins from repository [http://geronimo.apache.org/plugins/openjpa2]. One way to do this is the following: +# Go to the Geronimo console at http://<host>:8080/console and logon +# Select _plugins_ +# Click on _Add Repository_ and add [http://geronimo.apache.org/plugins/openjpa2] +# Click on _Update Repository List_ +# Make sure the new repository is selected. Then click on _Show Plugins in selected repository._ On that panel: +## Select _GeronimoPlugins, OpenJPA2::CAR 2.1.3-SNAPSHOT_ and _GeronimoPlugins, OpenJPA2::Deployer 2.1.3-SNAPSHOT_ +## Click on _Install_ +# On the next screen, click on _Install_ + +Deploy the DayTrader application. This can be done through the console as follows: +# Click on _Deploy New_ +# For _Archive_, browse to DayTrader/branches/2.1.3/modules/ear/target/daytrader-ear-2.1.3.ear +# For _Plan,_ browse to DayTrader/branches/2.1.3/plans/dayTrader-derby-plan.xml +# Check _Start app after install_ +# Click on _Install_ + +Re-start the server. + +Make sure that the system module, org.apache.geronimo.configs/axis-deployer/2.1.5/car, is running. + +Run DayTrader: +# Go to http://<host>:8080/daytrader/ +# Click on the _Configuration_ tab and click on _(Re)-create DayTrader Database Tables and Indexes_ +# Click on the _Configuration _ tab and click on _(Re)-populate DayTrader Database_ +# Click on the _Trading & Portfolios_ tab, login, and start trading + +h2. Run DayTrader on WebSphere + +This writeup assumes some familiarity with WebSphere. Also, the script that is provided assumes a local unmanaged node with a single server. + +At a minimum, the WebSphere Application Server must be at version 7.0.0.9. You must also have installed the Feature Pack for OSGi Applications and Java Persistence API 2.0. Make sure you have a profile that is augmented for JPA 2.0 function. + +Download the following jython script. This script is used to configure the objects needed by DayTrader (data sources, JMS queues and topics) and install the application. + +[^daytrader_singleServer.py] + + +Within the bin directory of the augmented profile: +# Start the server. +# Run the script using the following command: "wsadmin \-f <location of daytrader_singleServer.py> <script options>". You can display the list of available script options by specifying the option "--help". +# Re-start the server. + +Run DayTrader +# On a web browser, go to http://localhost:<application port>/daytrader/ (The default application port is 9080. But, you may have a different one if you created a new profile.) +# Click on the _Configuration_ tab and click on _(Re)-create DayTrader Database Tables and Indexes_ +# Click on the _Configuration _ tab and click on _(Re)-populate DayTrader Database_ +# Click on the _Trading & Portfolios_ tab, login, and start trading \ No newline at end of file
Added: openjpa/site/trunk/original.cwiki.content/verifying-release-signatures.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/verifying-release-signatures.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/verifying-release-signatures.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/verifying-release-signatures.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1,18 @@ +On unix platforms the following command can be executed : +{code} +for file in `find . -type f -iname '*.asc'` +do + gpg --verify ${file} +done +{code} + +You'll need to look at the output contains only good signaturesie : +{code} +gpg: Good signature from "Michael Dick (CODE SIGNING KEY) <[email protected]>" +gpg: Signature made Tue 12 Jan 2010 05:30:17 PM CST using RSA key ID 7412AD2C +gpg: Good signature from "Michael Dick (CODE SIGNING KEY) <[email protected]>" +gpg: Signature made Tue 12 Jan 2010 05:30:18 PM CST using RSA key ID 7412AD2C +gpg: Good signature from "Michael Dick (CODE SIGNING KEY) <[email protected]>" +gpg: Signature made Tue 12 Jan 2010 05:30:17 PM CST using RSA key ID 7412AD2C +gpg: Good signature from "Michael Dick (CODE SIGNING KEY) <[email protected]>" +{code} \ No newline at end of file Added: openjpa/site/trunk/original.cwiki.content/websphere-application-server.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/websphere-application-server.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/websphere-application-server.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/websphere-application-server.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1,8 @@ +h1. Fetch Statistic Tool Usage for Websphere Application Server + +h2. Download +* The latest OpenJPA Tools JAR file can be download from the [SNAPSHOT Repository|https://repository.apache.org/content/groups/snapshots/org/apache/openjpa/openjpa-fetch-statistics-was/] or can be built from the source code in [svn|https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-tools/openjpa-fetch-statistics-was/] by using Maven 2.2.1 and Java SE 6. + +h2. Configuration +* Put openjpa-fetch-statistics-VERSION-was.jar into the WAS_HOME\plugins directory. +* Run WAS_HOME\bin\osgiCfgInit.sh(bat) to clear the osgi cache. \ No newline at end of file Added: openjpa/site/trunk/original.cwiki.content/whither-openjpa.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/whither-openjpa.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/whither-openjpa.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/whither-openjpa.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1,14 @@ +Discussion topics: OpenJPA 1.0, OpenJPA 1.1, JPA 2.0, SDO, etc. + +* JPA 2.0: Any of OpenJPA members on the expert group? +Patrick will be on the EG. There will be a lurker list set up by each EG member for internal discussions. + +* Does Apache want to have representation on the JPA 2.0 EG? There would be an advantage for OpenJPA community members who are not privy to an internal lurker alias, to be able to participate in the discussion. +AI: Craig poll the openjpa community to see if they want to participate under NDA in the EG under rules established by the Spec Lead. If positive, discuss with Apache JCP representative how to do it. We would need a closed Apache-JPA mail alias for discussion and an EG representative to forward comments to the expert group. + +* Roadmap for OpenJPA. It would be nice to have an idea of when releases should come out. +What about picking a date, for example, August 20 for branching the release. Everyone who wants a bug fixed for the release, do it by then. Marc has volunteered to be release manager. He goes on vacation August 31 so if the release is delayed beyond that point, someone else needs to push it. AI Craig propose a release date and strategy to the community. + +* What about the next releases? +Craig earlier volunteered to start the roadmap discussion. + Added: openjpa/site/trunk/original.cwiki.content/wiki.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/wiki.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/wiki.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/wiki.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1 @@ +{note}TODO{note} \ No newline at end of file Added: openjpa/site/trunk/original.cwiki.content/writing-test-cases-for-openjpa.cwiki URL: http://svn.apache.org/viewvc/openjpa/site/trunk/original.cwiki.content/writing-test-cases-for-openjpa.cwiki?rev=1415738&view=auto ============================================================================== --- openjpa/site/trunk/original.cwiki.content/writing-test-cases-for-openjpa.cwiki (added) +++ openjpa/site/trunk/original.cwiki.content/writing-test-cases-for-openjpa.cwiki Fri Nov 30 16:56:02 2012 @@ -0,0 +1,77 @@ + +h1. Tips on writing TestCase for OpenJPA + +You are welcome to contribute new test cases. Following are few suggestions and guidelines on how to contribute new test case to OpenJPA repository of 2000 test cases spread across 400 classes. + +{tip:title=Inherit from OpenJPA TestCases} +Unit Tests are {{JUnit}} Tests. The base JUnit test case implementation {{org.junit.TestCase}} has been extended to facilitate common initialization steps or configuration settings for unit testing OpenJPA. +The inheritance hierarchy is: +{code} +junit.framework.TestCase + +-- org.apache.openjpa.persistence.test.PersistenceTestCase + +-- org.apache.openjpa.persistence.test.SingleEMFTestCase + +-- org.apache.openjpa.persistence.test.SQLListenerTestCase +{code} +As a test developer, you should inherit your test class from one of the extended TestCases. In general, {{SingleEMFTestCase}} is a good candidate to inherit from. If your test needs to analyze or count number of SQL statements, {{SQLListenerTestCase}} should be your choice. +{tip} + +{tip:title=Use correct name and package for test case and entity classes} +* Test case should be in a separate sub-package of {{org.apache.openjpa.persistence.*}} or {{org.apache.openjpa.persistence.jdbc.*}} + +* Test case class names must start with "Test" e.g. {{TestEagerFetch}} + +* There are hundreds of testable entity classes. But if your test requires new entity classes, place them in the same package as that of the new Test cases. +{tip} + +{tip:title=setUp() and tearDown()} +* OpenJPA TestCases augment the {{setUp()}} method to accept a list of arguments. In this list, you should specify: + ** the entity classes used by your test + ** the critical configuration properties + ** {{CLEAR_TABLES}} or {{DROP_TABLES}} : these are constants declared in the superclass which clears the existing rows or drops the tables altogether. + +* The following is an example {{setUp()}} method +{code} +public void setUp() throws Exception { + super.setUp(CLEAR_TABLES, // clears records for domain classes + Candidate.class, Election.class, // registers Candidate and Election as persistence-capable entity + "openjpa.Multithreaded", "true", // sets configuration property as name-value pairs + "openjpa.Log", "SQL=TRACE"); +} +{code} + +* Notice that some configuration parameters can be set in the {{setUp()}} method of test program itself. This is recommended for properties that are important for your test. The non-critical parameters such as database connection properties (unless your test is about some specific aspect of a particular database) are better be specified in {{META-INF/persistence.xml}}. The persistence name can be specified by overwriting the following method: +{code} +protected String getPersistenceUnitName() { + return "test-eager-fetch"; +} +{code} + +* {{SingleEMFTestCase}} ensures that {{tearDown()}} method deletes all rows for the domain classes involved in your test. You may want the database records to remain for analysis especially when tests are failing. In that case, you may consider suppressing the superclass behavior of {{tearDown()}} by simply nullifying the method as +{code} +public void tearDown() throws Exception { + // avoids super class to delete all records +} +{code} +{tip} + +{tip:title=Annotate O-R Mapping} + +Prefer annotation over XML Descriptors for O-R Mapping because that helps to collocate relevant information. Unless, of course, the test is specific about variations in behavior across annotation and XML Descriptors. +{tip} + +{tip:title=Use JUnit assert*() methods} +For verification, use many assertion methods provided by {{JUnit}} e.g. {{assertEquals()}} or {{assertTrue()}} rather than depending on printing trace with {{System.out.println()}}. If you want to trace generated SQL or other runtime information, use appropriate {{openjpa.Log}} property settings. +{tip} + +{tip:title=Create JIRA Issue} +Create a JIRA issue. Refer to the JIRA issue in the comments section of the new test case. +{tip} + +{tip:title=ASF License} +Remember to include ASF License header in the comment section of all the new source or resource files. +{tip} + +{tip:title=Attach the test to JIRA Issue} +Package all the *.java files related to your test case in a JAR file and attach it to JIRA issue you have created. +You must check in the radio button *Grant license to ASF for inclusion in ASF works* that appears near the bottom of *Attach File* JIRA page. +{tip} \ No newline at end of file
