continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r209839 - /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
Date Fri, 08 Jul 2005 16:43:27 GMT
Author: jvanzyl
Date: Fri Jul  8 09:43:25 2005
New Revision: 209839

URL: http://svn.apache.org/viewcvs?rev=209839&view=rev
Log:
o checking in test for trygve to mull over :-) demonstrates duplicate
developer entries.


Modified:
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java?rev=209839&r1=209838&r2=209839&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
Fri Jul  8 09:43:25 2005
@@ -19,6 +19,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ArrayList;
 
 import javax.jdo.JDODetachedFieldAccessException;
 import javax.jdo.PersistenceManager;
@@ -201,6 +202,80 @@
         assertNotNull( n.getConfiguration() );
 
         assertEquals( "foo", n.getConfiguration().get( "bar" ) );
+    }
+
+    // ----------------------------------------------------------------------
+    // Developers
+    // ----------------------------------------------------------------------
+
+    public void testDevelopersInProject()
+        throws Exception
+    {
+        ContinuumProject p = makeProject( store );
+
+        List devs = new ArrayList();
+
+        ContinuumDeveloper dev = new ContinuumDeveloper();
+
+        dev.setEmail( "foo@bar.com" );
+
+        dev.setName( "Jason" );
+
+        devs.add( dev );
+
+        p.setDevelopers( devs );
+
+        store.storeContinuumProject( p );
+
+        // ----------------------------------------------------------------------
+        // Lookup our stored developer
+        // ----------------------------------------------------------------------
+
+        p = store.getContinuumProject( p.getId(), true );
+
+        List retrievedDevs = p.getDevelopers();
+
+        assertEquals( 1, retrievedDevs.size() );
+
+        ContinuumDeveloper retrievedDev = (ContinuumDeveloper) retrievedDevs.get( 0 );
+
+        assertEquals( "foo@bar.com", retrievedDev.getEmail() );
+
+        assertEquals( "Jason", retrievedDev.getName() );
+
+        // ----------------------------------------------------------------------
+        // Now create a new list and replace the developers
+        // ----------------------------------------------------------------------
+
+        devs = new ArrayList();
+
+        dev = new ContinuumDeveloper();
+
+        dev.setEmail( "boo@bar.com" );
+
+        dev.setName( "Trygve" );
+
+        devs.add( dev );
+
+        p.setDevelopers( devs );
+
+        store.storeContinuumProject( p );
+
+        // ----------------------------------------------------------------------
+        // Now lets see that we only have one developer and it's the right one
+        // ----------------------------------------------------------------------
+
+        p = store.getContinuumProject( p.getId(), true );
+
+        retrievedDevs = p.getDevelopers();
+
+        assertEquals( 1, retrievedDevs.size() );
+
+        retrievedDev = (ContinuumDeveloper) retrievedDevs.get( 0 );
+
+        assertEquals( "boo@bar.com", retrievedDev.getEmail() );
+
+        assertEquals( "Trygve", retrievedDev.getName() );
     }
 
     public void testCascadingDelete()



Mime
View raw message