continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r190786 - /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
Date Wed, 15 Jun 2005 18:04:05 GMT
Author: trygvis
Date: Wed Jun 15 11:04:05 2005
New Revision: 190786

URL: http://svn.apache.org/viewcvs?rev=190786&view=rev
Log:
o Adding a test for testing cascading deletes.

Added:
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
  (with props)

Added: 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=190786&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
(added)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
Wed Jun 15 11:04:05 2005
@@ -0,0 +1,104 @@
+package org.apache.maven.continuum.project;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManagerFactory;
+
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.jdo.JdoFactory;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumJPoxStoreTest
+    extends PlexusTestCase
+{
+    public void testCascadingDelete()
+        throws Exception
+    {
+        JdoFactory jdoFactory = (JdoFactory) lookup( JdoFactory.ROLE );
+
+        PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
+
+        ContinuumJPoxStore store = new ContinuumJPoxStore( pmf );
+
+        ContinuumProject p;
+
+        ContinuumBuild build;
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        p = new MavenTwoProject();
+
+        p.setName( "Yo Yo Project" );
+
+        Object oid = store.storeContinuumProject( p );
+
+        p = store.getContinuumProjectByJdoId( oid, true );
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        build = new ContinuumBuild();
+
+        build.setSuccess( true );
+
+        build.setExitCode( 1 );
+
+        build.setProject( p );
+
+        build = new ContinuumBuild();
+
+        build.setSuccess( true );
+
+        build.setExitCode( 2 );
+
+        build.setProject( p );
+
+        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() );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message