continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r603173 - in /maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test: java/org/apache/maven/continuum/store/jpa/ resources/META-INF/
Date Tue, 11 Dec 2007 08:21:10 GMT
Author: rinku
Date: Tue Dec 11 00:21:01 2007
New Revision: 603173

URL: http://svn.apache.org/viewvc?rev=603173&view=rev
Log:
o  use Hamcrest assertion to determine if Entity was deleted from underlying store.

Modified:
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectGroupStoreTest.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/maven/continuum/store/jpa/JpaProjectStoreTest.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/persistence.xml

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectGroupStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectGroupStoreTest.java?rev=603173&r1=603172&r2=603173&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectGroupStoreTest.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectGroupStoreTest.java
Tue Dec 11 00:21:01 2007
@@ -3,6 +3,8 @@
  */
 package org.apache.maven.continuum.store.jpa;
 
+import static org.apache.maven.continuum.store.matcher.JpaEntity.isDeleted;
+
 import java.io.File;
 import java.util.List;
 import java.util.Properties;
@@ -20,7 +22,6 @@
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.AfterTransaction;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -106,21 +107,7 @@
         Assert.assertTrue( group.getId() > 0L );
         getProjectGroupStore().delete( group );
         // assertion follows in a separate transaction
-    }
-
-    @AfterTransaction
-    public void assertProjectGroupDeleted() throws StoreException
-    {
-        try
-        {
-            getProjectGroupStore().lookup( ProjectGroup.class, 100L );
-            Assert.fail( "Expected exception: " + EntityNotFoundException.class.getSimpleName()
-                            + ". ProjectNotifier instance should have been deleted from the
underlying store." );
-        }
-        catch ( EntityNotFoundException e )
-        {
-            // expected!
-        }
+        isDeleted( getProjectGroupStore(), ProjectGroup.class, group );
     }
 
     @Test

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=603173&r1=603172&r2=603173&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
Tue Dec 11 00:21:01 2007
@@ -3,13 +3,14 @@
  */
 package org.apache.maven.continuum.store.jpa;
 
+import static org.apache.maven.continuum.store.matcher.JpaEntity.isDeleted;
+
 import java.io.File;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.store.ApplicationContextAwareStoreTestCase;
-import org.apache.maven.continuum.store.api.EntityNotFoundException;
 import org.apache.maven.continuum.store.api.Store;
 import org.apache.maven.continuum.store.api.StoreException;
 import org.apache.openjpa.persistence.OpenJPAQuery;
@@ -20,7 +21,6 @@
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.AfterTransaction;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -87,21 +87,7 @@
         Assert.assertTrue( notifier.getId() > 0L );
         getProjectNotifierStore().delete( notifier );
         // assertion follows in a separate transaction
-    }
-
-    @AfterTransaction
-    public void assertProjectNotifierDeleted() throws StoreException
-    {
-        try
-        {
-            ProjectNotifier notifier = getProjectNotifierStore().lookup( ProjectNotifier.class,
100L );
-            Assert.fail( "Expected exception: " + EntityNotFoundException.class.getSimpleName()
-                            + ". ProjectNotifier instance should have been deleted from the
underlying store." );
-        }
-        catch ( EntityNotFoundException e )
-        {
-            // expected!
-        }
+        isDeleted( getProjectNotifierStore(), ProjectNotifier.class, notifier );
     }
 
     @Override

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectStoreTest.java?rev=603173&r1=603172&r2=603173&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectStoreTest.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaProjectStoreTest.java
Tue Dec 11 00:21:01 2007
@@ -11,10 +11,8 @@
 
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.store.ApplicationContextAwareStoreTestCase;
-import org.apache.maven.continuum.store.api.EntityNotFoundException;
 import org.apache.maven.continuum.store.api.Store;
 import org.apache.maven.continuum.store.api.StoreException;
-import org.apache.maven.continuum.store.matcher.JpaEntity;
 import org.apache.openjpa.persistence.OpenJPAQuery;
 import org.junit.After;
 import org.junit.Assert;
@@ -23,7 +21,6 @@
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.AfterTransaction;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -101,21 +98,6 @@
         getProjectStore().delete( project );
         // assertion follows in a separate transaction
         isDeleted( getProjectStore(), Project.class, project );
-    }
-
-    // @AfterTransaction
-    public void assertProjectDeleted() throws StoreException
-    {
-        try
-        {
-            getProjectStore().lookup( Project.class, 100L );
-            Assert.fail( "Expected exception: " + EntityNotFoundException.class.getSimpleName()
-                            + ". Project instance should have been deleted from the underlying
store." );
-        }
-        catch ( EntityNotFoundException e )
-        {
-            // expected!
-        }
     }
 
     @Override

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/persistence.xml?rev=603173&r1=603172&r2=603173&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/persistence.xml
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/persistence.xml
Tue Dec 11 00:21:01 2007
@@ -42,12 +42,13 @@
       <!--  Configure OpenJPA to automatically run the mapping tool at runtime and create
schema on Unit Test setup -->
       <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>

       
-      <!-- Enable SQL logging in OpenJPA -->
+      <!-- Enable SQL logging in OpenJPA 
       <property name="openjpa.Log" value="DefaultLevel=INFO,SQL=TRACE" />
-      
-      <!-- Change default log level across OpenJPA 
-      <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
       -->
+      
+      <!-- Change default log level across OpenJPA --> 
+      <property name="openjpa.Log" value="DefaultLevel=WARN"/>
+      
     </properties>
     
   </persistence-unit>



Mime
View raw message