continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r602585 - in /maven/continuum/branches/continuum-jpa/continuum-model-jpa/src: main/java/org/apache/maven/continuum/model/project/ main/java/org/apache/maven/continuum/model/scm/ main/java/org/apache/maven/continuum/store/api/ main/java/org/...
Date Sun, 09 Dec 2007 00:00:11 GMT
Author: rinku
Date: Sat Dec  8 16:00:10 2007
New Revision: 602585

URL: http://svn.apache.org/viewvc?rev=602585&view=rev
Log:
o  reformat

Modified:
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/BuildResult.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/ContinuumModelloMetadata.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/scm/ScmResult.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/DeprecatedSystemStore.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/StoreException.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStoreFactory.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectNotifierStoreTest.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMTestCase.java

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/BuildResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/BuildResult.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/BuildResult.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/BuildResult.java Sat Dec  8 16:00:10 2007
@@ -8,8 +8,6 @@
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToOne;
@@ -124,9 +122,7 @@
      * Field modifiedDependencies
      */
     @OneToMany( cascade = CascadeType.ALL )
-    @JoinTable( name = "PROJECT_DEPENDENCY", 
-                joinColumns = @JoinColumn( name = "BUILD_ID" ), 
-                inverseJoinColumns = @JoinColumn( name = "ID_PROJECT_DEPENDENCY" ) )
+    @JoinTable( name = "PROJECT_DEPENDENCY", joinColumns = @JoinColumn( name = "BUILD_ID" ), inverseJoinColumns = @JoinColumn( name = "ID_PROJECT_DEPENDENCY" ) )
     private List<ProjectDependency> modifiedDependencies;
 
     /**

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/ContinuumModelloMetadata.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/ContinuumModelloMetadata.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/ContinuumModelloMetadata.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/project/ContinuumModelloMetadata.java Sat Dec  8 16:00:10 2007
@@ -4,7 +4,7 @@
 
 /**
  * Generated ModelloMetadata class for Continuum.
- *
+ * 
  * @author Mr Modello
  */
 public class ContinuumModelloMetadata

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/scm/ScmResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/scm/ScmResult.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/scm/ScmResult.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/model/scm/ScmResult.java Sat Dec  8 16:00:10 2007
@@ -2,8 +2,8 @@
 
 import java.util.List;
 
-import javax.persistence.Column;
 import javax.persistence.Basic;
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
@@ -12,7 +12,7 @@
 
 /**
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
- * @version $Id$ 
+ * @version $Id$
  */
 @Entity
 @Table( name = "SCM_RESULT" )
@@ -48,8 +48,7 @@
     private String commandOutput;
 
     /**
-     * Field exception
-     * XXX: Renamed from 'EXCEPTION' to 'EXCEPTION_MSG'
+     * Field exception XXX: Renamed from 'EXCEPTION' to 'EXCEPTION_MSG'
      */
     @Basic
     @Column( name = "EXCEPTION_MSG" )

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/DeprecatedSystemStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/DeprecatedSystemStore.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/DeprecatedSystemStore.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/DeprecatedSystemStore.java Sat Dec  8 16:00:10 2007
@@ -8,8 +8,7 @@
 import org.apache.maven.continuum.model.system.SystemConfiguration;
 
 /**
- * Defines the contract consisting of operations that can be performed on
- * following entities:
+ * Defines the contract consisting of operations that can be performed on following entities:
  * <ul>
  * <li>{@link Schedule},</li>
  * <li>{@link Profile},</li>
@@ -26,150 +25,152 @@
     public static final String ROLE = DeprecatedSystemStore.class.getName();
 
     /**
-     * Removes the passed {@link Installation} instance from the underlying
-     * store.
+     * Removes the passed {@link Installation} instance from the underlying store.
      * 
-     * @param project {@link Installation} instance to remove.
-     * @throws StoreException if there was an error removing the
-     *             entity.
+     * @param project
+     *            {@link Installation} instance to remove.
+     * @throws StoreException
+     *             if there was an error removing the entity.
      */
     public void deleteInstallation( Installation installation ) throws StoreException;
 
     /**
      * Removes the passed {@link Profile} instance from the underlying store.
      * 
-     * @param project {@link Profile} instance to remove.
-     * @throws StoreException if there was an error removing the
-     *             entity.
+     * @param project
+     *            {@link Profile} instance to remove.
+     * @throws StoreException
+     *             if there was an error removing the entity.
      */
     public void deleteProfile( Profile profile ) throws StoreException;
 
     /**
      * Removes the passed {@link Schedule} instance from the underlying store.
      * 
-     * @param project {@link Schedule} instance to remove.
-     * @throws StoreException if there was an error removing the
-     *             entity.
+     * @param project
+     *            {@link Schedule} instance to remove.
+     * @throws StoreException
+     *             if there was an error removing the entity.
      */
     public void deleteSchedule( Schedule schedule ) throws StoreException;
 
     /**
-     * Removes the passed {@link SystemConfiguration} instance from the
-     * underlying store.
+     * Removes the passed {@link SystemConfiguration} instance from the underlying store.
      * 
-     * @param project {@link SystemConfiguration} instance to remove.
-     * @throws StoreException if there was an error removing the
-     *             entity.
+     * @param project
+     *            {@link SystemConfiguration} instance to remove.
+     * @throws StoreException
+     *             if there was an error removing the entity.
      */
     public void deleteSystemConfiguration( SystemConfiguration systemConfiguration ) throws StoreException;
 
     /**
-     * Looks up the underlying store and returns a {@link Installation} instance
-     * that matches the specified id.
+     * Looks up the underlying store and returns a {@link Installation} instance that matches the specified id.
      * 
-     * @param id {@link Installation} id to match.
+     * @param id
+     *            {@link Installation} id to match.
      * @return matching {@link Installation} instance.
-     * @throws EntityNotFoundException if the instance could not be
-     *             looked up.
+     * @throws EntityNotFoundException
+     *             if the instance could not be looked up.
      * @throws StoreException
      */
     public Installation lookupInstallation( long id ) throws EntityNotFoundException, StoreException;
 
     /**
-     * Looks up the underlying store and returns a {@link Profile} instance that
-     * matches the specified id.
+     * Looks up the underlying store and returns a {@link Profile} instance that matches the specified id.
      * 
-     * @param id {@link Profile} id to match.
+     * @param id
+     *            {@link Profile} id to match.
      * @return matching {@link Profile} instance.
-     * @throws EntityNotFoundException if the instance could not be
-     *             looked up.
+     * @throws EntityNotFoundException
+     *             if the instance could not be looked up.
      * @throws StoreException
      */
     public Profile lookupProfile( long id ) throws EntityNotFoundException, StoreException;
 
     /**
-     * Looks up the underlying store and returns a {@link Schedule} instance
-     * that matches the specified id.
+     * Looks up the underlying store and returns a {@link Schedule} instance that matches the specified id.
      * 
-     * @param id {@link Schedule} id to match.
+     * @param id
+     *            {@link Schedule} id to match.
      * @return matching {@link Schedule} instance.
-     * @throws EntityNotFoundException if the instance could not be
-     *             looked up.
+     * @throws EntityNotFoundException
+     *             if the instance could not be looked up.
      * @throws StoreException
      */
     public Schedule lookupSchedule( long id ) throws EntityNotFoundException, StoreException;
 
     /**
-     * Looks up the underlying store and returns a {@link SystemConfiguration}
-     * instance that matches the specified id.
+     * Looks up the underlying store and returns a {@link SystemConfiguration} instance that matches the specified id.
      * 
-     * @param id {@link SystemConfiguration} id to match.
+     * @param id
+     *            {@link SystemConfiguration} id to match.
      * @return matching {@link SystemConfiguration} instance.
-     * @throws EntityNotFoundException if the instance could not be
-     *             looked up.
+     * @throws EntityNotFoundException
+     *             if the instance could not be looked up.
      * @throws StoreException
      */
-    public SystemConfiguration lookupSystemConfiguration( long id )
-        throws EntityNotFoundException, StoreException;
+    public SystemConfiguration lookupSystemConfiguration( long id ) throws EntityNotFoundException, StoreException;
 
     /**
-     * Persists the passed in {@link Installation} instance to the underlying
-     * store.
+     * Persists the passed in {@link Installation} instance to the underlying store.
      * <p>
-     * If the entity instance already exists in the database it is updated, else
-     * a new instance is created and an store-generated identifier assigned to
-     * it.
+     * If the entity instance already exists in the database it is updated, else a new instance is created and an
+     * store-generated identifier assigned to it.
      * 
-     * @param project {@link Installation} instance to be created/saved.
+     * @param project
+     *            {@link Installation} instance to be created/saved.
      * @return updated {@link Installation} instance.
-     * @throws StoreException if there was an error saving the entity.
+     * @throws StoreException
+     *             if there was an error saving the entity.
      */
     public Installation saveInstallation( Installation installation ) throws StoreException;
 
     /**
      * Persists the passed in {@link Profile} instance to the underlying store.
      * <p>
-     * If the entity instance already exists in the database it is updated, else
-     * a new instance is created and an store-generated identifier assigned to
-     * it.
+     * If the entity instance already exists in the database it is updated, else a new instance is created and an
+     * store-generated identifier assigned to it.
      * 
-     * @param project {@link Profile} instance to be created/saved.
+     * @param project
+     *            {@link Profile} instance to be created/saved.
      * @return updated {@link Profile} instance.
-     * @throws StoreException if there was an error saving the entity.
+     * @throws StoreException
+     *             if there was an error saving the entity.
      */
     public Profile saveProfile( Profile profile ) throws StoreException;
 
     /**
      * Persists the passed in {@link Schedule} instance to the underlying store.
      * <p>
-     * If the entity instance already exists in the database it is updated, else
-     * a new instance is created and an store-generated identifier assigned to
-     * it.
+     * If the entity instance already exists in the database it is updated, else a new instance is created and an
+     * store-generated identifier assigned to it.
      * 
-     * @param project {@link Schedule} instance to be created/saved.
+     * @param project
+     *            {@link Schedule} instance to be created/saved.
      * @return updated {@link Schedule} instance.
-     * @throws StoreException if there was an error saving the entity.
+     * @throws StoreException
+     *             if there was an error saving the entity.
      */
     public Schedule saveSchedule( Schedule schedule ) throws StoreException;
 
     /**
-     * Persists the passed in {@link SystemConfiguration} instance to the
-     * underlying store.
+     * Persists the passed in {@link SystemConfiguration} instance to the underlying store.
      * <p>
-     * If the entity instance already exists in the database it is updated, else
-     * a new instance is created and an store-generated identifier assigned to
-     * it.
+     * If the entity instance already exists in the database it is updated, else a new instance is created and an
+     * store-generated identifier assigned to it.
      * 
-     * @param project {@link SystemConfiguration} instance to be created/saved.
+     * @param project
+     *            {@link SystemConfiguration} instance to be created/saved.
      * @return updated {@link SystemConfiguration} instance.
-     * @throws StoreException if there was an error saving the entity.
+     * @throws StoreException
+     *             if there was an error saving the entity.
      */
-    public SystemConfiguration saveSystemConfiguration( SystemConfiguration systemConfiguration )
-        throws StoreException;
+    public SystemConfiguration saveSystemConfiguration( SystemConfiguration systemConfiguration ) throws StoreException;
 
     /**
-     * Obtains and returns a {@link List} of <b>all</b> {@link Schedule}
-     * instances for the system, stored in the underlying store.
+     * Obtains and returns a {@link List} of <b>all</b> {@link Schedule} instances for the system, stored in the
+     * underlying store.
      * 
      * @return list of all {@link Schedule} instances stored.
      * @throws StoreException
@@ -177,8 +178,8 @@
     public List getAllSchedules() throws StoreException;
 
     /**
-     * Obtains and returns a {@link List} of <b>all</b> {@link Profile}
-     * instances for the system, stored in the underlying store.
+     * Obtains and returns a {@link List} of <b>all</b> {@link Profile} instances for the system, stored in the
+     * underlying store.
      * 
      * @return list of all {@link Profile} instances stored.
      * @throws StoreException
@@ -186,8 +187,8 @@
     public List getAllProfiles() throws StoreException;
 
     /**
-     * Obtains and returns a {@link List} of <b>all</b> {@link Installation}
-     * instances for the system, stored in the underlying store.
+     * Obtains and returns a {@link List} of <b>all</b> {@link Installation} instances for the system, stored in the
+     * underlying store.
      * 
      * @return list of all {@link Installation} instances stored.
      * @throws StoreException
@@ -195,9 +196,8 @@
     public List getAllInstallations() throws StoreException;
 
     /**
-     * Obtains and returns a {@link List} of <b>all</b>
-     * {@link SystemConfiguration} instances for the system, stored in the
-     * underlying store.
+     * Obtains and returns a {@link List} of <b>all</b> {@link SystemConfiguration} instances for the system, stored in
+     * the underlying store.
      * 
      * @return list of all {@link SystemConfiguration} instances stored.
      * @throws StoreException

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/StoreException.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/StoreException.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/StoreException.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/StoreException.java Sat Dec  8 16:00:10 2007
@@ -26,7 +26,6 @@
 public class StoreException extends Exception
 {
 
-   
     public StoreException()
     {
         super();

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStoreFactory.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStoreFactory.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStoreFactory.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStoreFactory.java Sat Dec  8 16:00:10 2007
@@ -3,8 +3,6 @@
  */
 package org.apache.maven.continuum.store.jpa;
 
-import javax.persistence.EntityManagerFactory;
-
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectNotifierStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectNotifierStoreTest.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectNotifierStoreTest.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectNotifierStoreTest.java Sat Dec  8 16:00:10 2007
@@ -7,7 +7,6 @@
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.store.ApplicationContextAwareStoreTestCase;
 import org.apache.maven.continuum.store.api.ProjectNotifierQuery;

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java Sat Dec  8 16:00:10 2007
@@ -39,97 +39,104 @@
 /**
  * Base test class providing persistence utilities.
  */
-public abstract class PersistenceTestCase {
+public abstract class PersistenceTestCase
+{
 
     /**
-     * Marker object you an pass to {@link #setUp} to indicate that the
-     * database tables should be cleared.
+     * Marker object you an pass to {@link #setUp} to indicate that the database tables should be cleared.
      */
     protected static final Object CLEAR_TABLES = new Object();
 
     /**
-     * Create an entity manager factory. Put {@link #CLEAR_TABLES} in
-     * this list to tell the test framework to delete all table contents
-     * before running the tests.
-     *
-     * @param props list of persistent types used in testing and/or
-     * configuration values in the form key,value,key,value...
+     * Create an entity manager factory. Put {@link #CLEAR_TABLES} in this list to tell the test framework to delete all
+     * table contents before running the tests.
+     * 
+     * @param props
+     *            list of persistent types used in testing and/or configuration values in the form
+     *            key,value,key,value...
      */
-    protected OpenJPAEntityManagerFactorySPI createEMF(Object... props) {
-        return createNamedEMF(getPersistenceUnitName(), props);
+    protected OpenJPAEntityManagerFactorySPI createEMF( Object... props )
+    {
+        return createNamedEMF( getPersistenceUnitName(), props );
     }
 
     /**
-     * The name of the persistence unit that this test class should use
-     * by default. This defaults to "test".
+     * The name of the persistence unit that this test class should use by default. This defaults to "test".
      */
-    protected String getPersistenceUnitName() {
+    protected String getPersistenceUnitName()
+    {
         return "test";
     }
 
     /**
-     * Create an entity manager factory for persistence unit <code>pu</code>.
-     * Put {@link #CLEAR_TABLES} in
-     * this list to tell the test framework to delete all table contents
-     * before running the tests.
-     *
-     * @param props list of persistent types used in testing and/or
-     * configuration values in the form key,value,key,value...
-     */
-    protected OpenJPAEntityManagerFactorySPI createNamedEMF(String pu,
-        Object... props) {
-        Map map = new HashMap(System.getProperties());
+     * Create an entity manager factory for persistence unit <code>pu</code>. Put {@link #CLEAR_TABLES} in this list
+     * to tell the test framework to delete all table contents before running the tests.
+     * 
+     * @param props
+     *            list of persistent types used in testing and/or configuration values in the form
+     *            key,value,key,value...
+     */
+    protected OpenJPAEntityManagerFactorySPI createNamedEMF( String pu, Object... props )
+    {
+        Map map = new HashMap( System.getProperties() );
         List<Class> types = new ArrayList<Class>();
         boolean prop = false;
-        for (int i = 0; i < props.length; i++) {
-            if (prop) {
-                map.put(props[i - 1], props[i]);
+        for ( int i = 0; i < props.length; i++ )
+        {
+            if ( prop )
+            {
+                map.put( props[i - 1], props[i] );
                 prop = false;
-            } else if (props[i] == CLEAR_TABLES) {
-                map.put("openjpa.jdbc.SynchronizeMappings",
-                    "buildSchema(ForeignKeys=true," 
-                    + "SchemaAction='add,deleteTableContents')");
-            } else if (props[i] instanceof Class)
-                types.add((Class) props[i]);
-            else if (props[i] != null)
+            }
+            else if ( props[i] == CLEAR_TABLES )
+            {
+                map.put( "openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true,"
+                                + "SchemaAction='add,deleteTableContents')" );
+            }
+            else if ( props[i] instanceof Class )
+                types.add( (Class) props[i] );
+            else if ( props[i] != null )
                 prop = true;
         }
 
-        if (!types.isEmpty()) {
+        if ( !types.isEmpty() )
+        {
             StringBuffer buf = new StringBuffer();
-            for (Class c : types) {
-                if (buf.length() > 0)
-                    buf.append(";");
-                buf.append(c.getName());
+            for ( Class c : types )
+            {
+                if ( buf.length() > 0 )
+                    buf.append( ";" );
+                buf.append( c.getName() );
             }
-            map.put("openjpa.MetaDataFactory",
-                "jpa(Types=" + buf.toString() + ")");
+            map.put( "openjpa.MetaDataFactory", "jpa(Types=" + buf.toString() + ")" );
         }
 
-        return (OpenJPAEntityManagerFactorySPI) Persistence.
-            createEntityManagerFactory(pu, map);
+        return (OpenJPAEntityManagerFactorySPI) Persistence.createEntityManagerFactory( pu, map );
     }
 
-    public void tearDown() throws Exception {
-        //super.tearDown();
+    public void tearDown() throws Exception
+    {
+        // super.tearDown();
     }
 
     /**
      * Safely close the given factory.
-     */    
-    protected boolean closeEMF(EntityManagerFactory emf) {
-        if (emf == null)
+     */
+    protected boolean closeEMF( EntityManagerFactory emf )
+    {
+        if ( emf == null )
             return false;
-        if (!emf.isOpen())
+        if ( !emf.isOpen() )
             return false;
 
-        for (Iterator iter = ((AbstractBrokerFactory) JPAFacadeHelper
-            .toBrokerFactory(emf)).getOpenBrokers().iterator();
-            iter.hasNext(); ) {
+        for ( Iterator iter =
+            ( (AbstractBrokerFactory) JPAFacadeHelper.toBrokerFactory( emf ) ).getOpenBrokers().iterator(); iter.hasNext(); )
+        {
             Broker b = (Broker) iter.next();
-            if (b != null && !b.isClosed()) {
-                EntityManager em = JPAFacadeHelper.toEntityManager(b);
-                if (em.getTransaction().isActive())
+            if ( b != null && !b.isClosed() )
+            {
+                EntityManager em = JPAFacadeHelper.toEntityManager( b );
+                if ( em.getTransaction().isActive() )
                     em.getTransaction().rollback();
                 em.close();
             }
@@ -142,64 +149,70 @@
     /**
      * Delete all instances of the given types using bulk delete queries.
      */
-    protected void clear(EntityManagerFactory emf, Class... types) {
-        if (emf == null || types.length == 0)
+    protected void clear( EntityManagerFactory emf, Class... types )
+    {
+        if ( emf == null || types.length == 0 )
             return;
 
-        List<ClassMetaData> metas = new ArrayList<ClassMetaData>(types.length);
-        for (Class c : types) {
-            ClassMetaData meta = JPAFacadeHelper.getMetaData(emf, c);
-            if (meta != null)
-                metas.add(meta);
+        List<ClassMetaData> metas = new ArrayList<ClassMetaData>( types.length );
+        for ( Class c : types )
+        {
+            ClassMetaData meta = JPAFacadeHelper.getMetaData( emf, c );
+            if ( meta != null )
+                metas.add( meta );
         }
-        clear(emf, metas.toArray(new ClassMetaData[metas.size()]));
+        clear( emf, metas.toArray( new ClassMetaData[metas.size()] ) );
     }
 
     /**
-     * Delete all instances of the persistent types registered with the given
-     * factory using bulk delete queries.
+     * Delete all instances of the persistent types registered with the given factory using bulk delete queries.
      */
-    protected void clear(EntityManagerFactory emf) {
-        if (emf == null)
+    protected void clear( EntityManagerFactory emf )
+    {
+        if ( emf == null )
             return;
-        clear(emf, ((OpenJPAEntityManagerFactorySPI) emf).getConfiguration().
-            getMetaDataRepositoryInstance().getMetaDatas());
+        clear(
+               emf,
+               ( (OpenJPAEntityManagerFactorySPI) emf ).getConfiguration().getMetaDataRepositoryInstance().getMetaDatas() );
     }
 
     /**
      * Delete all instances of the given types using bulk delete queries.
      */
-    private void clear(EntityManagerFactory emf, ClassMetaData... types) {
-        if (emf == null || types.length == 0)
+    private void clear( EntityManagerFactory emf, ClassMetaData... types )
+    {
+        if ( emf == null || types.length == 0 )
             return;
 
         EntityManager em = emf.createEntityManager();
         em.getTransaction().begin();
-        for (ClassMetaData meta : types) {
-            if (!meta.isMapped() || meta.isEmbeddedOnly() 
-                || Modifier.isAbstract(meta.getDescribedType().getModifiers()))
+        for ( ClassMetaData meta : types )
+        {
+            if ( !meta.isMapped() || meta.isEmbeddedOnly()
+                            || Modifier.isAbstract( meta.getDescribedType().getModifiers() ) )
                 continue;
-            em.createQuery("DELETE FROM " + meta.getTypeAlias() + " o").
-                executeUpdate();
+            em.createQuery( "DELETE FROM " + meta.getTypeAlias() + " o" ).executeUpdate();
         }
         em.getTransaction().commit();
         em.close();
     }
 
     /**
-     * Return the entity name for the given type.   
+     * Return the entity name for the given type.
      */
-    protected String entityName(EntityManagerFactory emf, Class c) {
-        ClassMetaData meta = JPAFacadeHelper.getMetaData(emf, c);
-        return (meta == null) ? null : meta.getTypeAlias();
+    protected String entityName( EntityManagerFactory emf, Class c )
+    {
+        ClassMetaData meta = JPAFacadeHelper.getMetaData( emf, c );
+        return ( meta == null ) ? null : meta.getTypeAlias();
     }
 
-    public static void assertNotEquals(Object o1, Object o2) {
-        if (o1 == o2)
-            Assert.fail("expected args to be different; were the same instance.");
-        else if (o1 == null || o2 == null)
+    public static void assertNotEquals( Object o1, Object o2 )
+    {
+        if ( o1 == o2 )
+            Assert.fail( "expected args to be different; were the same instance." );
+        else if ( o1 == null || o2 == null )
             return;
-        else if (o1.equals(o2))
-            Assert.fail("expected args to be different; compared equal.");
+        else if ( o1.equals( o2 ) )
+            Assert.fail( "expected args to be different; compared equal." );
     }
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SQLListenerTestCase.java Sat Dec  8 16:00:10 2007
@@ -28,98 +28,112 @@
 
 /**
  * Base class for tests that need to check generated SQL.
- *
+ * 
  * @author Patrick Linskey
  */
-public abstract class SQLListenerTestCase
-    extends SingleEMFTestCase {
+public abstract class SQLListenerTestCase extends SingleEMFTestCase
+{
 
     protected List<String> sql = new ArrayList<String>();
+
     protected int sqlCount;
-    
+
     @Override
-    public void setUp(Object... props) {
+    public void setUp( Object... props )
+    {
         Object[] copy = new Object[props.length + 2];
-        System.arraycopy(props, 0, copy, 0, props.length);
+        System.arraycopy( props, 0, copy, 0, props.length );
         copy[copy.length - 2] = "openjpa.jdbc.JDBCListeners";
         copy[copy.length - 1] = new JDBCListener[] { new Listener() };
-        super.setUp(copy); 
+        super.setUp( copy );
     }
 
     /**
      * Confirm that the specified SQL has been executed.
-     *
-     * @param sqlExp the SQL expression. E.g., "SELECT FOO .*"
+     * 
+     * @param sqlExp
+     *            the SQL expression. E.g., "SELECT FOO .*"
      */
-    public void assertSQL(String sqlExp) {
-        for (String statement : sql) {
-            if (statement.matches(sqlExp))
+    public void assertSQL( String sqlExp )
+    {
+        for ( String statement : sql )
+        {
+            if ( statement.matches( sqlExp ) )
                 return;
         }
 
-        Assert.fail("Expected regular expression <" + sqlExp + "> to have"
-            + " existed in SQL statements: " + sql);
+        Assert.fail( "Expected regular expression <" + sqlExp + "> to have" + " existed in SQL statements: " + sql );
     }
 
     /**
      * Confirm that the specified SQL has not been executed.
-     *
-     * @param sqlExp the SQL expression. E.g., "SELECT BADCOLUMN .*"
+     * 
+     * @param sqlExp
+     *            the SQL expression. E.g., "SELECT BADCOLUMN .*"
      */
-    public void assertNotSQL(String sqlExp) {
+    public void assertNotSQL( String sqlExp )
+    {
         boolean failed = false;
 
-        for (String statement : sql) {
-            if (statement.matches(sqlExp))
+        for ( String statement : sql )
+        {
+            if ( statement.matches( sqlExp ) )
                 failed = true;
         }
 
-        if (failed)
-            Assert.fail("Regular expression <" + sqlExp + ">"
-                + " should not have been executed in SQL statements: " + sql);
+        if ( failed )
+            Assert.fail( "Regular expression <" + sqlExp + ">" + " should not have been executed in SQL statements: "
+                            + sql );
     }
 
     /**
      * Confirm that the executed SQL String contains the specified sqlExp.
-     *
-     * @param sqlExp the SQL expression. E.g., "SELECT BADCOLUMN .*"
+     * 
+     * @param sqlExp
+     *            the SQL expression. E.g., "SELECT BADCOLUMN .*"
      */
-    public void assertContainsSQL(String sqlExp) {
-        for (String statement : sql) {
-            if (statement.contains(sqlExp))
+    public void assertContainsSQL( String sqlExp )
+    {
+        for ( String statement : sql )
+        {
+            if ( statement.contains( sqlExp ) )
                 return;
         }
 
-        Assert.fail("Expected regular expression <" + sqlExp + "> to be"
-            + " contained in SQL statements: " + sql);
+        Assert.fail( "Expected regular expression <" + sqlExp + "> to be" + " contained in SQL statements: " + sql );
     }
-    
+
     /**
      * Gets the number of SQL issued since last reset.
      */
-    public int getSQLCount() {
-    	return sqlCount;
+    public int getSQLCount()
+    {
+        return sqlCount;
     }
-    
+
     /**
      * Resets SQL count.
+     * 
      * @return number of SQL counted since last reset.
      */
-    public int resetSQLCount() {
-    	int tmp = sqlCount;
-    	sqlCount = 0;
-    	return tmp;
+    public int resetSQLCount()
+    {
+        int tmp = sqlCount;
+        sqlCount = 0;
+        return tmp;
     }
 
-    public class Listener
-        extends AbstractJDBCListener {
+    public class Listener extends AbstractJDBCListener
+    {
 
         @Override
-        public void beforeExecuteStatement(JDBCEvent event) {
-            if (event.getSQL() != null && sql != null) {
-                sql.add(event.getSQL());
+        public void beforeExecuteStatement( JDBCEvent event )
+        {
+            if ( event.getSQL() != null && sql != null )
+            {
+                sql.add( event.getSQL() );
                 sqlCount++;
             }
-		}
-	}
+        }
+    }
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMFTestCase.java Sat Dec  8 16:00:10 2007
@@ -21,51 +21,58 @@
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 
-public abstract class SingleEMFTestCase
-    extends PersistenceTestCase {
+public abstract class SingleEMFTestCase extends PersistenceTestCase
+{
 
     protected OpenJPAEntityManagerFactorySPI emf;
 
     /**
-     * Call {@link #setUp(Object...)} with no arguments so that the emf
-     * set-up happens even if <code>setUp()</code> is not called from the
-     * subclass.
+     * Call {@link #setUp(Object...)} with no arguments so that the emf set-up happens even if <code>setUp()</code> is
+     * not called from the subclass.
      */
-    public void setUp() throws Exception {
-        setUp(new Object[0]);
+    public void setUp() throws Exception
+    {
+        setUp( new Object[0] );
     }
 
     /**
-     * Initialize entity manager factory. Put {@link #CLEAR_TABLES} in
-     * this list to tell the test framework to delete all table contents
-     * before running the tests.
-     *
-     * @param props list of persistent types used in testing and/or 
-     * configuration values in the form key,value,key,value...
+     * Initialize entity manager factory. Put {@link #CLEAR_TABLES} in this list to tell the test framework to delete
+     * all table contents before running the tests.
+     * 
+     * @param props
+     *            list of persistent types used in testing and/or configuration values in the form
+     *            key,value,key,value...
      */
-    protected void setUp(Object... props) {
-        emf = createEMF(props);
+    protected void setUp( Object... props )
+    {
+        emf = createEMF( props );
     }
 
     /**
      * Closes the entity manager factory.
      */
-    public void tearDown() throws Exception {
+    public void tearDown() throws Exception
+    {
         super.tearDown();
 
-        if (emf == null)
+        if ( emf == null )
             return;
 
-        try {
-            clear(emf);
-        } finally {
-            closeEMF(emf);
+        try
+        {
+            clear( emf );
+        }
+        finally
+        {
+            closeEMF( emf );
         }
     }
-    
-    protected ClassMapping getMapping(String name) {
-        return (ClassMapping) emf.getConfiguration()
-                .getMetaDataRepositoryInstance().getMetaData(name,
-                        getClass().getClassLoader(), true);
+
+    protected ClassMapping getMapping( String name )
+    {
+        return (ClassMapping) emf.getConfiguration().getMetaDataRepositoryInstance().getMetaData(
+                                                                                                  name,
+                                                                                                  getClass().getClassLoader(),
+                                                                                                  true );
     }
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMTestCase.java?rev=602585&r1=602584&r2=602585&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMTestCase.java (original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/openjpa/persistence/test/SingleEMTestCase.java Sat Dec  8 16:00:10 2007
@@ -27,169 +27,191 @@
 import org.apache.openjpa.persistence.OpenJPAQuery;
 
 /**
- * A base test case that can be used to easily test scenarios where there
- * is only a single EntityManager at any given time.
- *
+ * A base test case that can be used to easily test scenarios where there is only a single EntityManager at any given
+ * time.
+ * 
  * @author Marc Prud'hommeaux
  */
-public abstract class SingleEMTestCase 
-    extends SingleEMFTestCase {
+public abstract class SingleEMTestCase extends SingleEMFTestCase
+{
 
     protected OpenJPAEntityManager em;
 
     @Override
-    public void setUp() {
-        setUp(new Object[0]);
+    public void setUp()
+    {
+        setUp( new Object[0] );
     }
 
     @Override
-    public void setUp(Object... props) {
-        super.setUp(props);
-        em = emf.createEntityManager(); 
+    public void setUp( Object... props )
+    {
+        super.setUp( props );
+        em = emf.createEntityManager();
     }
 
-    /** 
+    /**
      * Clear the current EntityManager and re-initialize it.
      */
-    protected void reset() {
+    protected void reset()
+    {
         close();
-        em = emf.createEntityManager(); 
+        em = emf.createEntityManager();
     }
 
     @Override
-    public void tearDown() throws Exception {
+    public void tearDown() throws Exception
+    {
         rollback();
         close();
         super.tearDown();
     }
 
-    /** 
-     * Start a new transaction if there isn't currently one active. 
-     * @return  true if a transaction was started, false if one already existed
+    /**
+     * Start a new transaction if there isn't currently one active.
+     * 
+     * @return true if a transaction was started, false if one already existed
      */
-    protected boolean begin() {
+    protected boolean begin()
+    {
         EntityTransaction tx = em.getTransaction();
-        if (tx.isActive())
+        if ( tx.isActive() )
             return false;
 
         tx.begin();
         return true;
     }
 
-    /** 
-     * Commit the current transaction, if it is active. 
+    /**
+     * Commit the current transaction, if it is active.
+     * 
      * @return true if the transaction was committed
      */
-    protected boolean commit() {
+    protected boolean commit()
+    {
         EntityTransaction tx = em.getTransaction();
-        if (!tx.isActive())
+        if ( !tx.isActive() )
             return false;
 
         tx.commit();
         return true;
     }
 
-    /** 
-     * Rollback the current transaction, if it is active. 
+    /**
+     * Rollback the current transaction, if it is active.
+     * 
      * @return true if the transaction was rolled back
      */
-    protected boolean rollback() {
+    protected boolean rollback()
+    {
         EntityTransaction tx = em.getTransaction();
-        if (!tx.isActive())
+        if ( !tx.isActive() )
             return false;
 
         tx.rollback();
         return true;
     }
 
-    /** 
-     * Closes the current EntityManager if it is open. 
+    /**
+     * Closes the current EntityManager if it is open.
+     * 
      * @return false if the EntityManager was already closed.
      */
-    protected boolean close() {
-        if (em == null)
+    protected boolean close()
+    {
+        if ( em == null )
             return false;
 
         rollback();
 
-        if (!em.isOpen())
+        if ( !em.isOpen() )
             return false;
 
         em.close();
         return !em.isOpen();
     }
 
-    /** 
+    /**
      * Delete all of the instances.
-     *
-     * If no transaction is running, then one will be started and committed.
-     * Otherwise, the operation will take place in the current transaction.
+     * 
+     * If no transaction is running, then one will be started and committed. Otherwise, the operation will take place in
+     * the current transaction.
      */
-    protected void remove(Object... obs) {
+    protected void remove( Object... obs )
+    {
         boolean tx = begin();
-        for (Object ob : obs)
-            em.remove(ob);
-        if (tx) 
+        for ( Object ob : obs )
+            em.remove( ob );
+        if ( tx )
             commit();
     }
 
-    /** 
+    /**
      * Persist all of the instances.
-     *
-     * If no transaction is running, then one will be started and committed.
-     * Otherwise, the operation will take place in the current transaction.
+     * 
+     * If no transaction is running, then one will be started and committed. Otherwise, the operation will take place in
+     * the current transaction.
      */
-    protected void persist(Object... obs) {
+    protected void persist( Object... obs )
+    {
         boolean tx = begin();
-        for (Object ob : obs)
-            em.persist(ob);
-        if (tx) 
+        for ( Object ob : obs )
+            em.persist( ob );
+        if ( tx )
             commit();
     }
 
-    /** 
-     * Creates a query in the current EntityManager with the specified string. 
+    /**
+     * Creates a query in the current EntityManager with the specified string.
      */
-    protected OpenJPAQuery query(String str) {
-        return em.createQuery(str);
-    }
-
-    /** 
-     * Create a query against the specified class, which will be aliased
-     * as "x". For example, query(Person.class, "where x.age = 21") will
-     * create the query "select x from Person x where x.age = 21".
-     *  
-     * @param  c  the class to query against
-     * @param  str  the query suffix
-     * @param  params  the parameters, if any
+    protected OpenJPAQuery query( String str )
+    {
+        return em.createQuery( str );
+    }
+
+    /**
+     * Create a query against the specified class, which will be aliased as "x". For example, query(Person.class, "where
+     * x.age = 21") will create the query "select x from Person x where x.age = 21".
+     * 
+     * @param c
+     *            the class to query against
+     * @param str
+     *            the query suffix
+     * @param params
+     *            the parameters, if any
      * @return the Query object
      */
-    protected OpenJPAQuery query(Class c, String str, Object... params) {
-        String query = "select x from " + entityName(emf, c) + " x "
-            + (str == null ? "" : str);
-        OpenJPAQuery q = em.createQuery(query);
-        for (int i = 0; params != null && i < params.length; i++)
-            q.setParameter(i + 1, params[i]);
+    protected OpenJPAQuery query( Class c, String str, Object... params )
+    {
+        String query = "select x from " + entityName( emf, c ) + " x " + ( str == null ? "" : str );
+        OpenJPAQuery q = em.createQuery( query );
+        for ( int i = 0; params != null && i < params.length; i++ )
+            q.setParameter( i + 1, params[i] );
         return q;
     }
 
-    /** 
-     * Returns a list of all instances of the specific class in the database. 
-     *
-     * @param c the class to find
-     * @param q the query string suffix to use
-     * @param params the positional parameter list value
-     *
+    /**
+     * Returns a list of all instances of the specific class in the database.
+     * 
+     * @param c
+     *            the class to find
+     * @param q
+     *            the query string suffix to use
+     * @param params
+     *            the positional parameter list value
+     * 
      * @see #query(java.lang.Class,java.lang.String)
      */
-    protected <E> List<E> find(Class<E> c, String q, Object... params) {
-        return Collections.checkedList(query(c, q, params).getResultList(), c);
+    protected <E> List<E> find( Class<E> c, String q, Object... params )
+    {
+        return Collections.checkedList( query( c, q, params ).getResultList(), c );
     }
 
-    /** 
-     * Returns a list of all instances of the specific class in the database. 
+    /**
+     * Returns a list of all instances of the specific class in the database.
      */
-    protected <E> List<E> find(Class<E> c) {
-        return find(c, null);
+    protected <E> List<E> find( Class<E> c )
+    {
+        return find( c, null );
     }
 }



Mime
View raw message