continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490426 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/ test/java/org/apache/maven/continuum/store/
Date Wed, 27 Dec 2006 02:04:51 GMT
Author: rinku
Date: Tue Dec 26 18:04:50 2006
New Revision: 490426

URL: http://svn.apache.org/viewvc?view=rev&rev=490426
Log:
o  updated refactored impl for additional methods added to Store interface.
o  started putting together unit tests (w.i.p)

Added:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
  (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
  (with props)
Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java?view=diff&rev=490426&r1=490425&r2=490426
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoRefactoredContinuumStore.java
Tue Dec 26 18:04:50 2006
@@ -18,8 +18,12 @@
 
 import org.apache.maven.continuum.key.GroupProjectKey;
 import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Profile;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.model.system.Installation;
+import org.apache.maven.continuum.model.system.SystemConfiguration;
 import org.codehaus.plexus.jdo.PlexusJdoUtils;
 import org.codehaus.plexus.jdo.PlexusObjectNotFoundException;
 import org.codehaus.plexus.jdo.PlexusStoreException;
@@ -37,8 +41,11 @@
  * Store implementation that interacts with the underlying JDO-based store.
  * 
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
- * @version $Id$
+ * @version $Id: JdoRefactoredContinuumStore.java 490386 2006-12-26 22:05:15Z
+ *          rinku $
  * @since 1.1
+ * @plexus.component role="org.apache.maven.continuum.store.RefactoredContinuumStore"
+ *                   role-hint="jdo"
  */
 public class JdoRefactoredContinuumStore implements RefactoredContinuumStore
 {
@@ -150,6 +157,136 @@
         return group;
     }
 
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteInstallation(org.apache.maven.continuum.model.system.Installation)
+     */
+    public void deleteInstallation( Installation installation ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before installation should be deleted?
+        removeObject( installation );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteProfile(org.apache.maven.continuum.model.project.Profile)
+     */
+    public void deleteProfile( Profile profile ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before profile should be deleted?
+        removeObject( profile );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteSchedule(org.apache.maven.continuum.model.project.Schedule)
+     */
+    public void deleteSchedule( Schedule schedule ) throws ContinuumStoreException
+    {
+        // TODO: Any checks before schedule should be deleted?
+        removeObject( schedule );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#deleteSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
+     */
+    public void deleteSystemConfiguration( SystemConfiguration systemConfiguration ) throws
ContinuumStoreException
+    {
+        // TODO: Any checks before systemConfiguration should be deleted?
+        removeObject( systemConfiguration );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupInstallation(long)
+     */
+    public Installation lookupInstallation( long id ) throws ContinuumObjectNotFoundException,
ContinuumStoreException
+    {
+        return (Installation) getObjectById( Installation.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupProfile(long)
+     */
+    public Profile lookupProfile( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (Profile) getObjectById( Profile.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupSchedule(long)
+     */
+    public Schedule lookupSchedule( long id ) throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (Schedule) getObjectById( Schedule.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#lookupSystemConfiguration(long)
+     */
+    public SystemConfiguration lookupSystemConfiguration( long id )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (SystemConfiguration) getObjectById( SystemConfiguration.class, id, null );
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveInstallation(org.apache.maven.continuum.model.system.Installation)
+     */
+    public Installation saveInstallation( Installation installation ) throws ContinuumStoreException
+    {
+        updateObject( installation );
+        return installation;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveProfile(org.apache.maven.continuum.model.project.Profile)
+     */
+    public Profile saveProfile( Profile profile ) throws ContinuumStoreException
+    {
+        updateObject( profile );
+        return profile;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveSchedule(org.apache.maven.continuum.model.project.Schedule)
+     */
+    public Schedule saveSchedule( Schedule schedule ) throws ContinuumStoreException
+    {
+        updateObject( schedule );
+        return schedule;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.maven.continuum.store.RefactoredContinuumStore#saveSystemConfiguration(org.apache.maven.continuum.model.system.SystemConfiguration)
+     */
+    public SystemConfiguration saveSystemConfiguration( SystemConfiguration systemConfiguration
)
+        throws ContinuumStoreException
+    {
+        updateObject( systemConfiguration );
+        return systemConfiguration;
+    }
+
     // ------------------------------------------------------------------------
     // Service Methods
     // ------------------------------------------------------------------------
@@ -175,6 +312,24 @@
         try
         {
             return PlexusJdoUtils.getObjectFromQuery( getPersistenceManager(), clazz, idField,
id, fetchGroup );
+        }
+        catch ( PlexusObjectNotFoundException e )
+        {
+            throw new ContinuumObjectNotFoundException( e.getMessage() );
+        }
+        catch ( PlexusStoreException e )
+        {
+            throw new ContinuumStoreException( e.getMessage(), e );
+        }
+    }
+
+    private Object getObjectById( Class clazz, long id, String fetchGroup )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException
+    {
+        try
+        {
+            // TODO: Add method to PlexusJdoUtils to use long
+            return PlexusJdoUtils.getObjectById( getPersistenceManager(), clazz, (int) id,
fetchGroup );
         }
         catch ( PlexusObjectNotFoundException e )
         {

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java?view=auto&rev=490426
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
(added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
Tue Dec 26 18:04:50 2006
@@ -0,0 +1,37 @@
+/**
+ * 
+ */
+package org.apache.maven.continuum.store;
+
+import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+import org.codehaus.plexus.jdo.JdoFactory;
+
+/**
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * 
+ */
+public class AbstractRefactoredContinuumStoreTestCase extends PlexusTestCase
+{
+    protected RefactoredContinuumStore store;
+
+    /**
+     * Setup JDO Factory
+     * 
+     * @todo push down to a Jdo specific test
+     */
+    protected RefactoredContinuumStore createStore() throws Exception
+    {
+        DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup(
JdoFactory.ROLE );
+
+        jdoFactory.setUrl( "jdbc:hsqldb:mem:" + getName() );
+
+        return (RefactoredContinuumStore) lookup( RefactoredContinuumStore.ROLE );
+    }
+
+    protected void createBuildDatabase()
+    {
+     
+    }
+}

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractRefactoredContinuumStoreTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java?view=auto&rev=490426
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
(added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
Tue Dec 26 18:04:50 2006
@@ -0,0 +1,24 @@
+/**
+ * 
+ */
+package org.apache.maven.continuum.store;
+
+/**
+ * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
+ * 
+ */
+public class RefactoredContinuumStoreTestCase extends AbstractRefactoredContinuumStoreTestCase
+{
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        createBuildDatabase();
+    }
+
+    public void saveProjectGroup()
+    {
+
+    }
+
+}

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/RefactoredContinuumStoreTestCase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message