jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r687137 - in /jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm: RepositoryLifecycleTestSetup.java mapper/AllTests.java repository/NodeUtilTest.java repository/RepositoryUtil.java repository/RepositoryUtilTest.java
Date Tue, 19 Aug 2008 19:34:42 GMT
Author: clombart
Date: Tue Aug 19 12:34:41 2008
New Revision: 687137

URL: http://svn.apache.org/viewvc?rev=687137&view=rev
Log:
the unit tests no longer work since a couple of weeks. Here is a quick fix to run the unit
tests.
I will investigate where the problem comes from. It seems that the register/unregister repo
process has not the same behavior (compare to a previous Jackrabbit snapshot). Now, we avoid
this step per unit tests. This is the same repo instance that is used for all unit tests.
Of course, the unit tests are running faster. 

Modified:
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/NodeUtilTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtil.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtilTest.java

Modified: jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java?rev=687137&r1=687136&r2=687137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
(original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
Tue Aug 19 12:34:41 2008
@@ -18,8 +18,6 @@
 
 import junit.extensions.TestSetup;
 import junit.framework.Test;
-
-import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
 /**
  * A TestSetup that opens/close the JCR repository.
  *
@@ -35,17 +33,17 @@
      */
     protected void setUp() throws Exception {
         super.setUp();
-        System.out.println("registering repository ... ");
-        RepositoryUtil.registerRepository("repositoryTest",
-                "./src/test/test-config/repository.xml", "./target/repository");
+//        System.out.println("registering repository ... ");
+//        RepositoryUtil.registerRepository("repositoryTest",
+//                "./src/test/test-config/repository.xml", "./target/repository");
     }
 
     /**
      * @see junit.extensions.TestSetup#tearDown()
      */
     protected void tearDown() throws Exception {
-        RepositoryUtil.unRegisterRepository("repositoryTest");
-        System.out.println("repository shutdown");
+//        RepositoryUtil.unRegisterRepository("repositoryTest");
+//        System.out.println("repository shutdown");
         super.tearDown();
     }
 

Modified: jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java?rev=687137&r1=687136&r2=687137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java
(original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java
Tue Aug 19 12:34:41 2008
@@ -19,8 +19,6 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
-
 
 /**
  * Package level tests.
@@ -30,7 +28,7 @@
 public class AllTests {
 
     public static Test suite() {
-        return new RepositoryLifecycleTestSetup(buildSuite());
+        return buildSuite();
     }
 
     public static Test buildSuite() {

Modified: jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/NodeUtilTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/NodeUtilTest.java?rev=687137&r1=687136&r2=687137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/NodeUtilTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/NodeUtilTest.java
Tue Aug 19 12:34:41 2008
@@ -29,10 +29,7 @@
 public class NodeUtilTest extends TestCase
 {
 
-    /**
-     * <p>Defines the test case name for junit.</p>
-     * @param testName The test case name.
-     */
+
     public NodeUtilTest(String testName)
     {
         super(testName);
@@ -54,24 +51,6 @@
         super.tearDown();
     }
 
-    public static Test suite()
-    {
-        TestSuite suite = new TestSuite(NodeUtilTest.class);
-        // All methods starting with "test" will be executed in the test suite.
-        return new TestSetup(suite) {
-            protected void setUp() throws Exception {
-                super.setUp();
-                RepositoryUtil.registerRepository("repositoryTest", "./src/test/test-config/repository.xml",
"target/repository");
-            }
-
-            protected void tearDown() throws Exception {
-                RepositoryUtil.unRegisterRepository("repositoryTest");
-                super.tearDown();
-            }
-
-        };
-    }
-
 
     /**
      * Test for getParentPath()

Modified: jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtil.java?rev=687137&r1=687136&r2=687137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtil.java
(original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtil.java
Tue Aug 19 12:34:41 2008
@@ -45,6 +45,8 @@
 
     /** namespace prefix constant */
     public static final String OCM_NAMESPACE_PREFIX   = "ocm";
+    
+    public static Repository repository; 
 
     /** namespace constant */
     public static final String OCM_NAMESPACE          = "http://jackrabbit.apache.org/ocm";
@@ -122,13 +124,23 @@
     {
         try
         {
-            Hashtable env = new Hashtable();
-            env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
-            env.put(Context.PROVIDER_URL, "localhost");
-            InitialContext ctx = new InitialContext(env);
-
-            Repository repository = (Repository) ctx.lookup(repositoryName);
-            return repository;
+        	
+        	if (repository != null)
+        	{
+        		return repository;
+        	}
+        	else 
+        	{
+        		registerRepository(repositoryName,
+                      "./src/test/test-config/repository.xml", "./target/repository");
+        		Hashtable env = new Hashtable();
+        		env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
+        		env.put(Context.PROVIDER_URL, "localhost");
+        		InitialContext ctx = new InitialContext(env);
+
+        		repository = (Repository) ctx.lookup(repositoryName);
+        		return repository;
+        	}
         }
         catch (Exception e)
         {

Modified: jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtilTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtilTest.java?rev=687137&r1=687136&r2=687137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtilTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/repository/RepositoryUtilTest.java
Tue Aug 19 12:34:41 2008
@@ -65,23 +65,7 @@
         super.tearDown();
     }
 
-    public static Test suite()
-    {
-        TestSuite suite = new TestSuite(RepositoryUtilTest.class);
-        // All methods starting with "test" will be executed in the test suite.
-        return new TestSetup(suite) {
-            protected void setUp() throws Exception {
-                super.setUp();
-                RepositoryUtil.registerRepository("repositoryTest", "./src/test/test-config/repository.xml",
"target/repository");
-            }
-
-            protected void tearDown() throws Exception {
-                RepositoryUtil.unRegisterRepository("repositoryTest");
-                super.tearDown();
-            }
-
-        };
-    }
+    
 
     /**
      * Test for getRepository() and login



Mime
View raw message