continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r602307 - in /maven/continuum/branches/continuum-jpa/continuum-model-jpa/src: main/java/org/apache/maven/continuum/store/api/ main/java/org/apache/maven/continuum/store/jpa/ test/java/org/apache/maven/continuum/store/ test/java/org/apache/m...
Date Sat, 08 Dec 2007 03:31:14 GMT
Author: rinku
Date: Fri Dec  7 19:31:13 2007
New Revision: 602307

URL: http://svn.apache.org/viewvc?rev=602307&view=rev
Log:
o  updates to generified JpaStore and unit tests.

Modified:
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectGroupQuery.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectNotifierQuery.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectQuery.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/Store.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStore.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/main/java/org/apache/maven/continuum/store/jpa/StoreSupport.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/ApplicationContextAwareStoreTestCase.java
    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/java/org/apache/maven/continuum/store/jpa/JpaStoreTest.java
    maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/spring-config.xml

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectGroupQuery.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectGroupQuery.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectGroupQuery.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectGroupQuery.java
Fri Dec  7 19:31:13 2007
@@ -4,8 +4,7 @@
 package org.apache.maven.continuum.store.api;
 
 import java.util.Date;
-
-import org.apache.maven.continuum.model.project.ProjectGroup;
+import java.util.Map;
 
 /**
  * Wraps up retrieval criteria for {@link ProjectGroup}s.
@@ -14,7 +13,7 @@
  * @version $Id$
  * @since 1.2
  */
-public class ProjectGroupQuery implements Query<ProjectGroup>
+public class ProjectGroupQuery<ProjectGroup> implements Query<ProjectGroup>
 {
 
     /**
@@ -236,6 +235,72 @@
     public void setName( String name )
     {
         this.name = name;
+    }
+
+    /**
+     * @{inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.api.Query#toString(java.util.Map)
+     */
+    public String toString( Map<String, Object> whereClause )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        if ( this.hasId() )
+        {
+            whereClause.put( "id", this.getId() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.id =:id " );
+        }
+        if ( this.hasDateCreated() )
+        {
+            whereClause.put( "dateCreated", this.getDateCreated() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.dateCreated =:dateCreated " );
+        }
+        if ( this.hasDateUpdated() )
+        {
+            whereClause.put( "dateUpdated", this.getDateUpdated() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.dateUpdated =:dateUpdated " );
+        }
+        if ( this.hasDescription() )
+        {
+            whereClause.put( "description", this.getDescription() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.description =:description " );
+        }
+        if ( this.hasGroupId() )
+        {
+            whereClause.put( "groupId", this.getGroupId() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.groupId =:groupId " );
+        }
+        if ( this.hasModelEncoding() )
+        {
+            whereClause.put( "modelEncoding", this.getModelEncoding() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.modelEncoding =:modelEncoding " );
+        }
+        if ( this.hasName() )
+        {
+            whereClause.put( "name", this.getName() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " projectGroup.name =:name " );
+        }
+
+        if ( sb.length() > 0 )
+            sb.insert( 0, " where " );
+        sb.insert( 0, "select projectGroup from ProjectGroup as projectGroup " );
+
+        return sb.toString();
     }
 
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectNotifierQuery.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectNotifierQuery.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectNotifierQuery.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectNotifierQuery.java
Fri Dec  7 19:31:13 2007
@@ -4,17 +4,17 @@
 package org.apache.maven.continuum.store.api;
 
 import java.util.Date;
+import java.util.Map;
 
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
-import org.apache.maven.continuum.model.project.ProjectNotifier;
 
 /**
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
  * @version $Id$
  * @since 1.2
  */
-public class ProjectNotifierQuery implements Query<ProjectNotifier>
+public class ProjectNotifierQuery<ProjectNotifier> implements Query<ProjectNotifier>
 {
 
     /**
@@ -184,6 +184,63 @@
     public void setUserDefined( boolean isUserDefined )
     {
         this.isUserDefined = isUserDefined;
+    }
+
+    /**
+     * @{inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.api.Query#toString(java.util.Map)
+     */
+    public String toString( Map<String, Object> whereClause )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        if ( this.hasId() )
+        {
+            whereClause.put( "id", this.getId() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " notifier.id =:id " );
+        }
+        if ( this.hasDateCreated() )
+        {
+            whereClause.put( "dateCreated", this.getDateCreated() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " notifier.dateCreated =:dateCreated " );
+        }
+        if ( this.hasDateUpdated() )
+        {
+            whereClause.put( "dateUpdated", this.getDateUpdated() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " notifier.dateUpdated =:dateUpdated " );
+        }
+        if ( this.hasModelEncoding() )
+        {
+            whereClause.put( "modelEncoding", this.getModelEncoding() );
+            if ( sb.length() > 0 )
+                sb.append( "and" );
+            sb.append( " notifier.modelEncoding =:modelEncoding " );
+        }
+        if ( this.isDefinedOnProject() )
+        {
+            // TODO: Implement!
+            // Need to check what property is setup on the Notifier.
+            // May need to add a property ORM mapping to persist.
+        }
+        if ( this.isUserDefined() )
+        {
+            // TODO: Implement!
+            // Need to check what property is setup on the Notifier.
+            // May need to add a property ORM mapping to persist.
+        }
+
+        if ( sb.length() > 0 )
+            sb.insert( 0, " where " );
+        sb.insert( 0, "select project from Project as project " );
+
+        return sb.toString();
     }
 
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectQuery.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectQuery.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectQuery.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/ProjectQuery.java
Fri Dec  7 19:31:13 2007
@@ -6,8 +6,6 @@
 import java.util.Date;
 import java.util.Map;
 
-import org.apache.maven.continuum.model.project.Project;
-
 /**
  * Wraps up retrieval criteria for {@link Project}s.
  * 
@@ -327,84 +325,86 @@
      * 
      * @see org.apache.maven.continuum.store.api.Query#toString(java.util.Map)
      */
-    public String toString( Map<String, Object> where )
+    public String toString( Map<String, Object> whereClause )
     {
         StringBuffer sb = new StringBuffer();
 
         if ( this.hasId() )
         {
-            where.put( "id", this.getId() );
+            whereClause.put( "id", this.getId() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.id =:id " );
         }
         if ( this.hasDateCreated() )
         {
-            where.put( "dateCreated", this.getDateCreated() );
+            whereClause.put( "dateCreated", this.getDateCreated() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.dateCreated =:dateCreated " );
         }
         if ( this.hasDateUpdated() )
         {
-            where.put( "dateUpdated", this.getDateUpdated() );
+            whereClause.put( "dateUpdated", this.getDateUpdated() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.dateUpdated =:dateUpdated " );
         }
         if ( this.hasDescription() )
         {
-            where.put( "description", this.getDescription() );
+            whereClause.put( "description", this.getDescription() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.description =:description " );
         }
         if ( this.hasGroupId() )
         {
-            where.put( "groupId", this.getGroupId() );
+            whereClause.put( "groupId", this.getGroupId() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.groupId =:groupId " );
         }
         if ( this.hasModelEncoding() )
         {
-            where.put( "modelEncoding", this.getModelEncoding() );
+            whereClause.put( "modelEncoding", this.getModelEncoding() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.modelEncoding =:modelEncoding " );
         }
         if ( this.hasName() )
         {
-            where.put( "name", this.getName() );
+            whereClause.put( "name", this.getName() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.name =:name " );
         }
         if ( this.hasArtifactId() )
         {
-            where.put( "artifactId", this.getArtifactId() );
+            whereClause.put( "artifactId", this.getArtifactId() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.artifactId =:artifactId" );
         }
         if ( this.hasBuildNumber() )
         {
-            where.put( "buildNumber", this.getBuildNumber() );
+            whereClause.put( "buildNumber", this.getBuildNumber() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.buildNumber =:buildNumber" );
         }
         if ( this.hasVersion() )
         {
-            where.put( "version", this.getVersion() );
+            whereClause.put( "version", this.getVersion() );
             if ( sb.length() > 0 )
                 sb.append( "and" );
             sb.append( " project.version =:version" );
         }
 
-        String whereClause = ( sb.length() > 0 ? " where " : "" ) + sb.toString();
+        if ( sb.length() > 0 )
+            sb.insert( 0, " where " );
+        sb.insert( 0, "select project from Project as project " );
 
-        return null;
+        return sb.toString();
     }
 
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/Store.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/Store.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/Store.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/api/Store.java
Fri Dec  7 19:31:13 2007
@@ -5,6 +5,8 @@
 
 import java.util.List;
 
+import org.apache.maven.continuum.model.CommonUpdatableEntity;
+
 /**
  * Interface that Continuum store extensions/implementations are expected to implement to
allow operations on the
  * underlying store.
@@ -19,7 +21,7 @@
  * @version $Id$
  * @since 1.2
  */
-public interface Store<T, Q extends Query<T>>
+public interface Store<T extends CommonUpdatableEntity, Q extends Query<T>>
 {
 
     /**

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStore.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStore.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/JpaStore.java
Fri Dec  7 19:31:13 2007
@@ -7,7 +7,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.CommonUpdatableEntity;
 import org.apache.maven.continuum.store.api.EntityNotFoundException;
 import org.apache.maven.continuum.store.api.Query;
 import org.apache.maven.continuum.store.api.Store;
@@ -20,7 +20,7 @@
  * @version $Id$
  * @since 1.2
  */
-public class JpaStore<T, Q extends Query<T>> extends StoreSupport implements
Store<T, Q>
+public class JpaStore<T extends CommonUpdatableEntity, Q extends Query<T>> extends
StoreSupport implements Store<T, Q>
 {
 
     /**
@@ -80,8 +80,14 @@
     @Transactional( readOnly = false )
     public T save( T entity ) throws StoreException
     {
-        // TODO Auto-generated method stub
-        return null;
+        if ( null != entity )
+        {
+            if ( null == entity.getId() )
+                getJpaTemplate().persist( entity );
+            else
+                entity = getJpaTemplate().merge( entity );
+        }
+        return entity;
     }
 
 }

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=602307&r1=602306&r2=602307&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
Fri Dec  7 19:31:13 2007
@@ -4,6 +4,10 @@
 package org.apache.maven.continuum.store.jpa;
 
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.store.api.ProjectGroupQuery;
+import org.apache.maven.continuum.store.api.ProjectNotifierQuery;
 import org.apache.maven.continuum.store.api.ProjectQuery;
 import org.apache.maven.continuum.store.api.Store;
 
@@ -15,12 +19,37 @@
 public class JpaStoreFactory
 {
 
+    /**
+     * Store instance that services executes requests on underlying store for {@link Project}
entities.
+     */
     private final JpaStore<Project, ProjectQuery<Project>> JPA_PROJECT_STORE
=
         new JpaStore<Project, ProjectQuery<Project>>();
 
-    public Store<Project, ProjectQuery<Project>> createProjectStoreInstance()
+    /**
+     * Store instance that services executes requests on underlying store for {@link ProjectGroup}
entities.
+     */
+    private final JpaStore<ProjectGroup, ProjectGroupQuery<ProjectGroup>> JPA_PROJECT_GROUP_STORE
=
+        new JpaStore<ProjectGroup, ProjectGroupQuery<ProjectGroup>>();
+
+    /**
+     * Store instance that services executes requests on underlying store for {@link ProjectNotifier}
entities.
+     */
+    private final JpaStore<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>>
JPA_PROJECT_NOTIFIER_STORE =
+        new JpaStore<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>>();
+
+    public Store<Project, ProjectQuery<Project>> createProjectGroupStoreInstance()
     {
         return JPA_PROJECT_STORE;
+    }
+
+    public Store<ProjectGroup, ProjectGroupQuery<ProjectGroup>> createProjectStoreInstance()
+    {
+        return JPA_PROJECT_GROUP_STORE;
+    }
+
+    public Store<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>> createProjectNotifierStoreInstance()
+    {
+        return JPA_PROJECT_NOTIFIER_STORE;
     }
 
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/StoreSupport.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/StoreSupport.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/StoreSupport.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/main/java/org/apache/maven/continuum/store/jpa/StoreSupport.java
Fri Dec  7 19:31:13 2007
@@ -11,12 +11,9 @@
 import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 
-import org.apache.maven.continuum.model.CommonPersistableEntity;
-import org.apache.maven.continuum.store.api.EntityNotFoundException;
 import org.apache.maven.continuum.store.api.Store;
 import org.springframework.dao.DataAccessException;
 import org.springframework.orm.jpa.JpaCallback;
-import org.springframework.orm.jpa.JpaObjectRetrievalFailureException;
 import org.springframework.orm.jpa.support.JpaDaoSupport;
 
 /**

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/ApplicationContextAwareStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/ApplicationContextAwareStoreTestCase.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/ApplicationContextAwareStoreTestCase.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/ApplicationContextAwareStoreTestCase.java
Fri Dec  7 19:31:13 2007
@@ -14,6 +14,7 @@
 import java.util.List;
 
 import org.apache.maven.continuum.model.CommonPersistableEntity;
+import org.apache.maven.continuum.model.CommonUpdatableEntity;
 import org.apache.maven.continuum.store.api.Query;
 import org.apache.maven.continuum.store.api.Store;
 import org.apache.openjpa.persistence.test.SingleEMTestCase;
@@ -165,7 +166,7 @@
      * @return
      */
     @SuppressWarnings( "unchecked" )
-    protected <T extends CommonPersistableEntity, Q extends Query<T>> Store<T,
Q> getStore( String storeBeanReference )
+    protected <T extends CommonUpdatableEntity, Q extends Query<T>> Store<T,
Q> getStore( String storeBeanReference )
     {
         Object store = this.applicationContext.getBean( storeBeanReference );
         return (Store<T, Q>) store;

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=602307&r1=602306&r2=602307&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
Fri Dec  7 19:31:13 2007
@@ -81,7 +81,7 @@
     @Test
     public void testLookupProjectGroup() throws EntityNotFoundException, StoreException
     {
-        ProjectGroup projectGroup = getProjectGroupStore().lookup( null, 1000L );
+        ProjectGroup projectGroup = getProjectGroupStore().lookup( ProjectGroup.class, 1000L
);
         Assert.assertNotNull( projectGroup );
         Assert.assertEquals( 1000L, projectGroup.getId().longValue() );
         Assert.assertEquals( "Continuum Projects", projectGroup.getName() );
@@ -93,7 +93,7 @@
     {
         try
         {
-            ProjectGroup projectGroup = getProjectGroupStore().lookup( null, 99999L );
+            ProjectGroup projectGroup = getProjectGroupStore().lookup( ProjectGroup.class,
99999L );
             Assert.fail( "Expected " + EntityNotFoundException.class.getSimpleName()
                             + " on account of an invalid ProjectGroup Id." );
         }
@@ -132,9 +132,9 @@
      * 
      * @return
      */
-    private Store<ProjectGroup, ProjectGroupQuery> getProjectGroupStore()
+    private Store<ProjectGroup, ProjectGroupQuery<ProjectGroup>> getProjectGroupStore()
     {
-        Store<ProjectGroup, ProjectGroupQuery> store = getStore( BEAN_REF__PROJECT_GROUP_STORE
);
+        Store<ProjectGroup, ProjectGroupQuery<ProjectGroup>> store = getStore(
BEAN_REF__PROJECT_GROUP_STORE );
         return store;
     }
 

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=602307&r1=602306&r2=602307&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
Fri Dec  7 19:31:13 2007
@@ -7,6 +7,7 @@
 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;
@@ -60,16 +61,25 @@
     public void testCreateProjectNotifier() throws StoreException
     {
         ProjectNotifier notifier = new ProjectNotifier();
-        notifier.setModelEncoding( "UTF-8" );        
+        notifier.setModelEncoding( "UTF-8" );
         Assert.assertTrue( null == notifier.getId() );
         notifier = getProjectNotifierStore().save( notifier );
         Assert.assertTrue( null != notifier.getId() );
-        Assert.assertTrue( notifier.getId() > 0L );        
+        Assert.assertTrue( notifier.getId() > 0L );
     }
 
-    private Store<ProjectNotifier, ProjectNotifierQuery> getProjectNotifierStore()
+    @Test
+    public void testLookupProjectNotifier() throws StoreException
+    {
+        ProjectNotifier notifier = getProjectNotifierStore().lookup( ProjectNotifier.class,
100L );
+        Assert.assertNotNull( notifier );
+        Assert.assertTrue( notifier.getId() > 0L );
+    }
+
+    private Store<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>> getProjectNotifierStore()
     {
-        Store<ProjectNotifier, ProjectNotifierQuery> store = getStore( BEAN_REF__PROJECT_NOTIFIER_STORE
);
+        Store<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>> store =
+            getStore( BEAN_REF__PROJECT_NOTIFIER_STORE );
         return store;
     }
 }

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=602307&r1=602306&r2=602307&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
Fri Dec  7 19:31:13 2007
@@ -77,6 +77,14 @@
         Assert.assertTrue( project.getId() > 0L );
     }
 
+    @Test
+    public void testLookupProject() throws StoreException
+    {
+        Project project = getProjectStore().lookup( Project.class, 100L );
+        Assert.assertNotNull( project );
+        Assert.assertTrue( project.getId() > 0L );
+    }
+
     @Override
     @After
     public void tearDown() throws Exception

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaStoreTest.java?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaStoreTest.java
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/java/org/apache/maven/continuum/store/jpa/JpaStoreTest.java
Fri Dec  7 19:31:13 2007
@@ -67,9 +67,9 @@
         Assert.assertTrue( notifier.getId() > 0L );
     }
 
-    private Store<ProjectNotifier, ProjectNotifierQuery> getProjectNotifierStore()
+    private Store<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>> getProjectNotifierStore()
     {
-        Store<ProjectNotifier, ProjectNotifierQuery> store = getStore( BEAN_REF__PROJECT_STORE
);
+        Store<ProjectNotifier, ProjectNotifierQuery<ProjectNotifier>> store =
getStore( BEAN_REF__PROJECT_STORE );
         return store;
     }
 }

Modified: maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/spring-config.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/spring-config.xml?rev=602307&r1=602306&r2=602307&view=diff
==============================================================================
--- maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/spring-config.xml
(original)
+++ maven/continuum/branches/continuum-jpa/continuum-model-jpa/src/test/resources/META-INF/spring-config.xml
Fri Dec  7 19:31:13 2007
@@ -1,7 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  - Middle tier application context definition for the image database.
--->
+
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
@@ -30,59 +28,28 @@
     </property>
   </bean>
 
-  <!-- 
-  <bean id="projectStoreTarget"
-    class="org.apache.maven.continuum.store.jpa.JpaProjectStore">
-    <property name="entityManagerFactory" ref="entityManagerFactory" />
+  <bean id="storeFactory"
+    class="org.apache.maven.continuum.store.jpa.JpaStoreFactory">
   </bean>
 
   <bean id="projectStore"
-    class="org.springframework.aop.framework.ProxyFactoryBean">
-    <property name="targetName" value="projectStoreTarget" />
-    <property name="autodetectInterfaces" value="true" />
-    <property name="interceptorNames">
-      <idref local="transactionInterceptor" />
-    </property>
-  </bean>
-
-  <bean id="projectGroupStoreTarget"
-    class="org.apache.maven.continuum.store.jpa.JpaProjectGroupStore">
+    class="org.apache.maven.continuum.store.jpa.JpaStore"
+    factory-bean="storeFactory"
+    factory-method="createProjectStoreInstance">
     <property name="entityManagerFactory" ref="entityManagerFactory" />
   </bean>
 
   <bean id="projectGroupStore"
-    class="org.springframework.aop.framework.ProxyFactoryBean">
-    <property name="targetName" value="projectGroupStoreTarget" />
-    <property name="autodetectInterfaces" value="true" />
-    <property name="interceptorNames">
-      <idref local="transactionInterceptor" />
-    </property>
-  </bean>
-
-  <bean id="projectNotifierStoreTarget"
-    class="org.apache.maven.continuum.store.jpa.JpaProjectNotifierStore">
+    class="org.apache.maven.continuum.store.jpa.JpaStore"
+    factory-bean="storeFactory"
+    factory-method="createProjectGroupStoreInstance">
     <property name="entityManagerFactory" ref="entityManagerFactory" />
   </bean>
 
   <bean id="projectNotifierStore"
-    class="org.springframework.aop.framework.ProxyFactoryBean">
-    <property name="targetName" value="projectNotifierStoreTarget" />
-    <property name="autodetectInterfaces" value="true" />
-    <property name="interceptorNames">
-      <idref local="transactionInterceptor" />
-    </property>
-  </bean>
-  -->
-
-  <bean id="projectStoreFactory"
-    class="org.apache.maven.continuum.store.jpa.JpaStoreFactory">
-  </bean>
-  
-   <bean id="projectStore"
     class="org.apache.maven.continuum.store.jpa.JpaStore"
-    factory-bean="projectStoreFactory"
-    factory-method="createProjectStoreInstance"    
-    >    
+    factory-bean="storeFactory"
+    factory-method="createProjectNotifierStoreInstance">
     <property name="entityManagerFactory" ref="entityManagerFactory" />
   </bean>
 



Mime
View raw message