jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r703099 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
Date Thu, 09 Oct 2008 08:21:04 GMT
Author: dpfister
Date: Thu Oct  9 01:21:03 2008
New Revision: 703099

URL: http://svn.apache.org/viewvc?rev=703099&view=rev
Log:
Add more ClusterNode stability tests

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java?rev=703099&r1=703098&r2=703099&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
Thu Oct  9 01:21:03 2008
@@ -38,6 +38,16 @@
     private static final String REPOSITORY_HOME = "target/repository_for_test";
 
     /**
+     * Default cluster node id.
+     */
+    private static final String CLUSTER_NODE_ID = "node";
+
+    /**
+     * Default sync delay: 5 seconds.
+     */
+    private static final long SYNC_DELAY = 5000;
+
+    /**
      * Repository home.
      */
     private File repositoryHome;
@@ -83,7 +93,7 @@
         BeanConfig bc = new BeanConfig(FileJournal.class.getName(), params);
         JournalConfig jc = new JournalConfig(bc);
 
-        ClusterConfig cc = new ClusterConfig(null, 0, jc);
+        ClusterConfig cc = new ClusterConfig(CLUSTER_NODE_ID, SYNC_DELAY, jc);
         SimpleClusterContext context = new SimpleClusterContext(cc, repositoryHome);
 
         ClusterNode clusterNode = new ClusterNode();
@@ -96,4 +106,58 @@
             clusterNode.stop();
         }
     }
+
+    /**
+     * Verify that <code>ClusterNode.stop</code> can be invoked even when
+     * <code>ClusterNode.init</code> throws because of a bad journal class.
+     *
+     * @throws Exception
+     */
+    public void testClusterInitIncompleteBadJournalClass() throws Exception {
+        Properties params = new Properties();
+
+        BeanConfig bc = new BeanConfig(Object.class.getName(), params);
+        JournalConfig jc = new JournalConfig(bc);
+
+        ClusterConfig cc = new ClusterConfig(CLUSTER_NODE_ID, SYNC_DELAY, jc);
+        SimpleClusterContext context = new SimpleClusterContext(cc);
+
+        ClusterNode clusterNode = new ClusterNode();
+
+        try {
+            clusterNode.init(context);
+            fail("Bad cluster configuration.");
+        } catch (Exception e) {
+        }
+
+        clusterNode.stop();
+    }
+
+    /**
+     * Verify that <code>ClusterNode.stop</code> can be invoked even when
+     * <code>ClusterNode.init</code> throws because the journal can not
+     * be initialized. Note: this is done by omitting the required argument
+     * <code>directory</code>.
+     *
+     * @throws Exception
+     */
+    public void testClusterInitIncompleteMissingParam() throws Exception {
+        Properties params = new Properties();
+
+        BeanConfig bc = new BeanConfig(FileJournal.class.getName(), params);
+        JournalConfig jc = new JournalConfig(bc);
+
+        ClusterConfig cc = new ClusterConfig(CLUSTER_NODE_ID, SYNC_DELAY, jc);
+        SimpleClusterContext context = new SimpleClusterContext(cc);
+
+        ClusterNode clusterNode = new ClusterNode();
+
+        try {
+            clusterNode.init(context);
+            fail("Bad cluster configuration.");
+        } catch (Exception e) {
+        }
+
+        clusterNode.stop();
+    }
 }



Mime
View raw message