continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490865 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/ main/java/org/apache/maven/continuum/store/jdo/ test/java/org/apache/maven/continuum/store/ test/java/org/apache/mave...
Date Thu, 28 Dec 2006 23:05:24 GMT
Author: rinku
Date: Thu Dec 28 15:05:23 2006
New Revision: 490865

URL: http://svn.apache.org/viewvc?view=rev&rev=490865
Log:
o  aligned current JdoContinuumStore for updates to ContinuumStore and continuum-model (for
IDs).
o  updated schema for test and utility methods on test cases.

Removed:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/schema.sql
Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/AbstractJdoStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Dec 28 15:05:23 2006
@@ -224,7 +224,7 @@
      * @return
      * @throws ContinuumStoreException
      */
-    public Map getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
+    public Map getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( long scheduleId )
         throws ContinuumStoreException
     {
         Map projectSource = getProjectIdsAndBuildDefinitionsIdsBySchedule( scheduleId );
@@ -251,7 +251,7 @@
 
                 for ( Iterator j = projectsInGroup.iterator(); j.hasNext(); )
                 {
-                    Integer projectId = new Integer( ( (Project) j.next() ).getId() );
+                    Long projectId = new Long( ( (Project) j.next() ).getId() );
                     if ( !aggregate.keySet().contains( projectId ) )
                     {
                         aggregate.put( projectId, projectGroupSource.get( projectGroupId
) );
@@ -263,7 +263,7 @@
         return aggregate;
     }
 
-    public Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
+    public Map getProjectIdsAndBuildDefinitionsIdsBySchedule( long scheduleId )
         throws ContinuumStoreException
     {
         PersistenceManager pm = getPersistenceManager();
@@ -288,7 +288,7 @@
 
             query.setResult( "this.id, buildDef.id" );
 
-            List result = (List) query.execute( new Integer( scheduleId ) );
+            List result = (List) query.execute( new Long( scheduleId ) );
 
             Map projects = new HashMap();
 
@@ -331,7 +331,7 @@
         return null;
     }
 
-    public Map getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
+    public Map getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( long scheduleId )
         throws ContinuumStoreException
     {
         PersistenceManager pm = getPersistenceManager();
@@ -356,7 +356,7 @@
 
             query.setResult( "this.id, buildDef.id" );
 
-            List result = (List) query.execute( new Integer( scheduleId ) );
+            List result = (List) query.execute( new Long( scheduleId ) );
 
             Map projectGroups = new HashMap();
 
@@ -443,7 +443,7 @@
 
             pm.getFetchPlan().addGroup( PROJECT_WITH_BUILDS_FETCH_GROUP );
 
-            Object objectId = pm.newObjectIdInstance( Project.class, new Integer( project.getId()
) );
+            Object objectId = pm.newObjectIdInstance( Project.class, new Long( project.getId()
) );
 
             project = (Project) pm.getObjectById( objectId );
 
@@ -532,7 +532,7 @@
                 {
                     BuildResult br = (BuildResult) i.next();
 
-                    builds.put( new Integer( br.getProject().getId() ), br );
+                    builds.put( new Long( br.getProject().getId() ), br );
                 }
 
                 return builds;
@@ -688,7 +688,7 @@
         return null;
     }
 
-    public BuildDefinition getBuildDefinition( int buildDefinitionId )
+    public BuildDefinition getBuildDefinition( long buildDefinitionId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
         return (BuildDefinition) getObjectById( BuildDefinition.class, buildDefinitionId
);
@@ -766,15 +766,33 @@
         return (ProjectGroup) getObjectFromQuery( ProjectGroup.class, LOOKUP_KEY_GROUP_KEY,
groupKey, null );
     }
 
+    /**
+     * @deprecated Use {@link #getObjectById(Class,long)} instead
+     */
     private Object getObjectById( Class clazz, int id )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
+        return getObjectById( clazz, (long)id );
+    }
+
+    private Object getObjectById( Class clazz, long id )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException
+    {
         return getObjectById( clazz, id, null );
     }
 
+    /**
+     * @deprecated Use {@link #getObjectById(Class,long,String)} instead
+     */
     private Object getObjectById( Class clazz, int id, String fetchGroup )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
+        return getObjectById( clazz, (long)id, fetchGroup );
+    }
+
+    private Object getObjectById( Class clazz, long id, String fetchGroup )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException
+    {
         try
         {
             return PlexusJdoUtils.getObjectById( getPersistenceManager(), clazz, id, fetchGroup
);
@@ -1022,13 +1040,13 @@
                                              PROJECT_WITH_CHECKOUT_RESULT_FETCH_GROUP );
     }
 
-    public BuildResult getBuildResult( int buildId )
+    public BuildResult getBuildResult( long buildId )
         throws ContinuumObjectNotFoundException, ContinuumStoreException
     {
         return (BuildResult) getObjectById( BuildResult.class, buildId, BUILD_RESULT_WITH_DETAILS_FETCH_GROUP
);
     }
 
-    public List getBuildResultByBuildNumber( GroupProjectKey groupProjectKey, int buildNumber
)
+    public List getBuildResultByBuildNumber( GroupProjectKey groupProjectKey, long buildNumber
)
     {
         PersistenceManager pm = getPersistenceManager();
 
@@ -1046,7 +1064,7 @@
 
             query.setFilter( "this.project.key == projectKey && this.buildNumber
== buildNumber" );
 
-            List result = (List) query.execute( groupProjectKey.getProjectKey(), new Integer(
buildNumber ) );
+            List result = (List) query.execute( groupProjectKey.getProjectKey(), new Long(
buildNumber ) );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -1145,7 +1163,7 @@
                 {
                     BuildResult br = (BuildResult) i.next();
 
-                    builds.put( new Integer( br.getProject().getId() ), br );
+                    builds.put( new Long( br.getProject().getId() ), br );
                 }
 
                 return builds;
@@ -1251,13 +1269,13 @@
                                              PROJECT_ALL_DETAILS_FETCH_GROUP );
     }
 
-    public Schedule getSchedule( int scheduleId )
+    public Schedule getSchedule( long scheduleId )
         throws ContinuumObjectNotFoundException, ContinuumStoreException
     {
         return (Schedule) getObjectById( Schedule.class, scheduleId );
     }
 
-    public Profile getProfile( int profileId )
+    public Profile getProfile( long profileId )
         throws ContinuumObjectNotFoundException, ContinuumStoreException
     {
         return (Profile) getObjectById( Profile.class, profileId );

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/AbstractJdoStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/AbstractJdoStore.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/AbstractJdoStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/AbstractJdoStore.java
Thu Dec 28 15:05:23 2006
@@ -49,7 +49,7 @@
     private JdoFactory continuumJdoFactory;
 
     /**
-     * Provides hook to obtainig a {@link PersistenceManager} instance for
+     * Provides hook to obtaining a {@link PersistenceManager} instance for
      * invoking operations on the underlying store.
      */
     private PersistenceManagerFactory persistenceManagerFactory;

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupStore.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupStore.java
Thu Dec 28 15:05:23 2006
@@ -55,7 +55,7 @@
     public ProjectGroup lookupProjectGroup( GroupProjectKey key )
         throws ContinuumObjectNotFoundException, ContinuumStoreException
     {
-        return (ProjectGroup) getObjectFromQuery( ProjectGroup.class, "key", key.getProjectKey(),
null );
+        return (ProjectGroup) getObjectFromQuery( ProjectGroup.class, "key", key.getGroupKey(),
null );
     }
 
     /**

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
Thu Dec 28 15:05:23 2006
@@ -722,9 +722,18 @@
                                       buildResult.getStartTime(), buildResult.getEndTime()
);
     }
 
+    /**
+     * @deprecated Use {@link #createTestBuildResult(int,boolean,int,int,String,long,long,long)}
instead
+     */
     private static BuildResult createTestBuildResult( int trigger, boolean success, int state,
int exitCode,
                                                       String error, int buildNumber, long
startTime, long endTime )
     {
+        return createTestBuildResult( trigger, success, state, exitCode, error, (long) buildNumber,
startTime, endTime );
+    }
+
+    private static BuildResult createTestBuildResult( int trigger, boolean success, int state,
int exitCode,
+                                                      String error, long buildNumber, long
startTime, long endTime )
+    {
         BuildResult result = new BuildResult();
         result.setBuildNumber( buildNumber );
         result.setStartTime( startTime );
@@ -757,9 +766,18 @@
                                    schedule.getCronExpression(), schedule.isActive() );
     }
 
+    /**
+     * @deprecated Use {@link #createTestSchedule(String,String,long,String,boolean)} instead
+     */
     protected static Schedule createTestSchedule( String name, String description, int delay,
String cronExpression,
                                                   boolean active )
     {
+        return createTestSchedule( name, description, (long) delay, cronExpression, active
);
+    }
+
+    protected static Schedule createTestSchedule( String name, String description, long delay,
String cronExpression,
+                                                  boolean active )
+    {
         Schedule schedule = new Schedule();
         schedule.setActive( active );
         schedule.setCronExpression( cronExpression );
@@ -815,10 +833,21 @@
                                   project.getUrl(), project.getVersion(), project.getWorkingDirectory(),
project.getGroupKey(), project.getKey() );
     }
 
+    /**
+     * @deprecated Use {@link #createTestProject(String,long,String,String,String,String,int,String,String,String,String,String)}
instead
+     */
     private static Project createTestProject( String artifactId, int buildNumber, String
description, String groupId,
                                               String name, String scmUrl, int state, String
url, String version,
                                               String workingDirectory, String groupKey, String
projectKey )
     {
+        return createTestProject( artifactId, (long) buildNumber, description, groupId, name,
scmUrl, state, url, version,
+                                  workingDirectory, groupKey, projectKey );
+    }
+
+    private static Project createTestProject( String artifactId, long buildNumber, String
description, String groupId,
+                                              String name, String scmUrl, int state, String
url, String version,
+                                              String workingDirectory, String groupKey, String
projectKey )
+    {
         Project project = new Project();
         project.setArtifactId( artifactId );
         project.setBuildNumber( buildNumber );
@@ -1045,7 +1074,15 @@
         return dependency;
     }
 
+    /**
+     * @deprecated Use {@link #createTestDeveloper(long,String,String,String)} instead
+     */
     protected static ProjectDeveloper createTestDeveloper( int continuumId, String email,
String name, String scmId )
+    {
+        return createTestDeveloper( (long) continuumId, email, name, scmId );
+    }
+
+    protected static ProjectDeveloper createTestDeveloper( long continuumId, String email,
String name, String scmId )
     {
         ProjectDeveloper developer = new ProjectDeveloper();
         developer.setContinuumId( continuumId );

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
Thu Dec 28 15:05:23 2006
@@ -1,5 +1,7 @@
 package org.apache.maven.continuum.store.jdo;
 
+import org.apache.maven.continuum.key.GroupProjectKey;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.store.ProjectGroupStore;
 
 import java.util.List;
@@ -37,6 +39,15 @@
         List list = store.getAllProjectGroups();
         assertNotNull( list );
         assertEquals( 2, list.size() );
+    }
+
+    public void testLookupProjectGroup() throws Exception
+    {
+        ProjectGroupStore store = (ProjectGroupStore) lookup( ProjectGroupStore.ROLE, "jdo"
);
+        GroupProjectKey key = new GroupProjectKey( "Default", null );
+        ProjectGroup group = store.lookupProjectGroup( key );
+        assertNotNull( group );
+        assertEquals( 1L, group.getId() );
     }
 
 }

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
Thu Dec 28 15:05:23 2006
@@ -18,6 +18,8 @@
 
 import org.apache.maven.continuum.store.ProjectStore;
 
+import java.util.List;
+
 /**
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
  * @version $Id$
@@ -44,6 +46,14 @@
     {
         ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );
         assertNotNull( store );
+    }
+
+    public void testGetAllProjects() throws Exception
+    {
+        ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );       
+        List list = store.getAllProjects();
+        assertNotNull( list );
+        assertEquals( 3, list.size() );
     }
 
 }

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java?view=diff&rev=490865&r1=490864&r2=490865
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
Thu Dec 28 15:05:23 2006
@@ -278,7 +278,7 @@
     }
 
     private static BuildResult createTestBuildResult( int trigger, boolean success, int state,
int exitCode,
-                                                      String error, int buildNumber, long
startTime, long endTime )
+                                                      String error, long buildNumber, long
startTime, long endTime )
     {
         BuildResult result = new BuildResult();
         result.setBuildNumber( buildNumber );
@@ -328,7 +328,7 @@
         return dependency;
     }
 
-    public static ProjectDeveloper createTestDeveloper( int continuumId, String email, String
name, String scmId )
+    public static ProjectDeveloper createTestDeveloper( long continuumId, String email, String
name, String scmId )
     {
         ProjectDeveloper developer = new ProjectDeveloper();
         developer.setContinuumId( continuumId );
@@ -413,7 +413,7 @@
                                   project.getGroupKey(), project.getKey() );
     }
 
-    private static Project createTestProject( String artifactId, int buildNumber, String
description, String groupId,
+    private static Project createTestProject( String artifactId, long buildNumber, String
description, String groupId,
                                               String name, String scmUrl, int state, String
url, String version,
                                               String workingDirectory, String groupKey, String
projectKey )
     {
@@ -455,7 +455,7 @@
                                    schedule.getCronExpression(), schedule.isActive() );
     }
 
-    public static Schedule createTestSchedule( String name, String description, int delay,
String cronExpression,
+    public static Schedule createTestSchedule( String name, String description, long delay,
String cronExpression,
                                                boolean active )
     {
         Schedule schedule = new Schedule();



Mime
View raw message