You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by tr...@apache.org on 2005/06/16 19:51:24 UTC

svn commit: r190970 - /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java /maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo

Author: trygvis
Date: Thu Jun 16 10:51:23 2005
New Revision: 190970

URL: http://svn.apache.org/viewcvs?rev=190970&view=rev
Log:
o Adding a test case to try out the new summary/detailed part ideas.
o Removing unused stuff from the model.

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

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=190970&r1=190969&r2=190970&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 Thu Jun 16 10:51:23 2005
@@ -19,6 +19,10 @@
 import java.util.Collection;
 
 import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.JDODetachedFieldAccessException;
+
+import org.apache.maven.continuum.scm.CheckOutScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
 
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.JdoFactory;
@@ -41,12 +45,119 @@
 
         ContinuumProject p;
 
-        ContinuumBuild build;
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        makeProject( store );
+
+        // ----------------------------------------------------------------------
+        // Assert that the objects are there
+        // ----------------------------------------------------------------------
+
+        Collection projects = store.getContinuumProjectCollection( true, "", "" );
+
+        assertEquals( 1, projects.size() );
+
+        p = (ContinuumProject) projects.iterator().next();
+
+        Collection builds = p.getBuilds();
+
+        assertEquals( 2, builds.size() );
 
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
+        store.deleteContinuumProject( p.getId() );
+
+        assertEquals( 0, store.getContinuumProjectCollection( true, "", "" ).size() );
+
+        assertEquals( 0, store.getContinuumBuildCollection( true, "", "" ).size() );
+
+        assertEquals( 0, store.getCheckOutScmResultCollection( true, "", "" ).size() );
+    }
+
+    public void testFetchGroups()
+        throws Exception
+    {
+        JdoFactory jdoFactory = (JdoFactory) lookup( JdoFactory.ROLE );
+
+        PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
+
+        ContinuumJPoxStore store = new ContinuumJPoxStore( pmf );
+
+        ContinuumProject p = makeProject( store );
+
+        // ----------------------------------------------------------------------
+        // Try to get a single project. This object should include the
+        // "detailed" fetch group so it should be possible to access all
+        // collections.
+        // ----------------------------------------------------------------------
+
+        p = store.getContinuumProject( p.getId(), true );
+
+        assertEquals( "check out error exception", p.getCheckOutErrorException() );
+
+        p.getCheckOutScmResult();
+
+        p.getBuilds();
+
+        p.getDevelopers();
+
+        // ----------------------------------------------------------------------
+        // Get a project from a Collection query and assert that it only
+        // includes the summary part
+        // ----------------------------------------------------------------------
+
+        Collection projects = store.getContinuumProjectCollection( true, "", "" );
+
+        p = (ContinuumProject) projects.iterator().next();
+
+        assertEquals( "check out error exception", p.getCheckOutErrorException() );
+
+        // ----------------------------------------------------------------------
+        // This is a 1..1 association
+        // ----------------------------------------------------------------------
+
+        try
+        {
+            p.getCheckOutScmResult();
+
+            fail( "Expected a JDODetachedFieldAccessException." );
+        }
+        catch ( JDODetachedFieldAccessException e )
+        {
+            // expected
+        }
+
+        // ----------------------------------------------------------------------
+        // This is a 1..n association
+        // ----------------------------------------------------------------------
+
+        try
+        {
+            p.getDevelopers();
+
+            fail( "Expected a JDODetachedFieldAccessException." );
+        }
+        catch ( JDODetachedFieldAccessException e )
+        {
+            // expected
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private ContinuumProject makeProject( ContinuumJPoxStore store )
+        throws Exception
+    {
+        ContinuumProject p;
+
+        ContinuumBuild build;
+
         p = new MavenTwoProject();
 
         p.setName( "Yo Yo Project" );
@@ -59,6 +170,28 @@
         //
         // ----------------------------------------------------------------------
 
+        CheckOutScmResult result = new CheckOutScmResult();
+
+        result.setCommandOutput( "command output" );
+
+        result.setProviderMessage( "provider message" );
+
+        result.setSuccess( true );
+
+        ScmFile scmFile = new ScmFile();
+
+        scmFile.setPath( "/foo" );
+
+        result.getCheckedOutFiles().add( scmFile );
+
+        p.setCheckOutScmResult( result );
+
+        p.setCheckOutErrorException( "check out error exception" );
+
+        // ----------------------------------------------------------------------
+        // Make two builds in the project
+        // ----------------------------------------------------------------------
+
         build = new ContinuumBuild();
 
         build.setSuccess( true );
@@ -78,27 +211,9 @@
         store.storeContinuumProject( p );
 
         // ----------------------------------------------------------------------
-        // Assert that the objects are there
-        // ----------------------------------------------------------------------
-
-        Collection projects = store.getContinuumProjectCollection( true, "", "" );
-
-        assertEquals( 1, projects.size() );
-
-        p = (ContinuumProject) projects.iterator().next();
-
-        Collection builds = p.getBuilds();
-
-        assertEquals( 2, builds.size() );
-
-        // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------
 
-        store.deleteContinuumProject( p.getId() );
-
-        assertEquals( 0, store.getContinuumProjectCollection( true, "", "" ).size() );
-
-        assertEquals( 0, store.getContinuumBuildCollection( true, "", "" ).size() );
+        return p;
     }
 }

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=190970&r1=190969&r2=190970&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Thu Jun 16 10:51:23 2005
@@ -60,17 +60,6 @@
           <version>1.0.0</version>
           <type>String</type>
         </field>
-<!--
-        <field>
-          <name>configuration</name>
-          <version>1.0.0</version>
-          <type>Properties</type>
-          <association xml.mapStyle="inline" stash.part="true">
-            <type>String</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
--->
         <field>
           <name>builds</name>
           <version>1.0.0</version>
@@ -166,7 +155,7 @@
           <version>1.0.0</version>
           <description>Extended configuration specific to this notifier goes here.</description>
           <type>Properties</type>
-          <association xml.mapStyle="inline"  stash.part="true">
+          <association xml.mapStyle="inline" stash.part="true">
             <type>String</type>
             <multiplicity>*</multiplicity>
           </association>
@@ -316,24 +305,6 @@
           -->
         </field>
 
-        <!--
-         |
-         | Common fields for all builders
-         |
-         | -->
-<!--
-        <field>
-          <name>buildResult</name>
-          <version>1.0.0</version>
-          <association stash.part="true">
-            <type>ContinuumBuildResult</type>
-          </association>
-          <description>
-            This field contains a builder specific object that the view will
-            know how to work with.
-          </description>
-        </field>
--->
         <field>
           <name>success</name>
           <version>1.0.0</version>
@@ -364,144 +335,6 @@
       </fields>
     </class>
 
-    <!--
-    |
-    | BuilderBuildResult
-    |
-    | -->
-    <!-- java.abstract="true"-->
-<!--
-    <class>
-      <name>ContinuumBuildResult</name>
-      <version>1.0.0</version>
-      <fields>
-        <field>
-          <name>build</name>
-          <version>1.0.0</version>
-          <association>
-            <type>ContinuumBuild</type>
-          </association>
-        </field>
-        <field>
-          <name>success</name>
-          <version>1.0.0</version>
-          <type>boolean</type>
-        </field>
-        <field>
-          <name>standardOutput</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>standardError</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>exitCode</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-      </fields>
-    </class>
--->
-<!--
-    <class>
-      <name>ShellBuildResult</name>
-      <packageName>org.apache.maven.continuum.execution.shell</packageName>
-      <superClass>ContinuumBuildResult</superClass>
-      <version>1.0.0</version>
-      <fields>
-        <field stash.maxSize="8000">
-          <name>standardOutput</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field stash.maxSize="8000">
-          <name>standardError</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>exitCode</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-      </fields>
-    </class>
-
-    <class>
-      <name>Maven1BuildResult</name>
-      <packageName>org.apache.maven.continuum.execution.maven.m1</packageName>
-      <superClass>ContinuumBuildResult</superClass>
-      <version>1.0.0</version>
-      <fields>
-        <field stash.maxSize="8000">
-          <name>standardOutput</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field stash.maxSize="8000">
-          <name>standardError</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>exitCode</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-      </fields>
-    </class>
-
-    <class>
-      <name>MavenTwoBuildResult</name>
-      <packageName>org.apache.maven.continuum.execution.maven.m2</packageName>
-      <superClass>ContinuumBuildResult</superClass>
-      <version>1.0.0</version>
-      <fields>
-        <field stash.maxSize="8000">
-          <name>standardOutput</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field stash.maxSize="8000">
-          <name>standardError</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>exitCode</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-      </fields>
-    </class>
-
-    <class>
-      <name>AntBuildResult</name>
-      <packageName>org.apache.maven.continuum.execution.ant</packageName>
-      <superClass>ContinuumBuildResult</superClass>
-      <version>1.0.0</version>
-      <fields>
-        <field stash.maxSize="8000">
-          <name>standardOutput</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field stash.maxSize="8000">
-          <name>standardError</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>exitCode</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-      </fields>
-    </class>
--->
     <!--
      |
      | Scm Result