From 50fecca39d0f244a4225fb2f74b550b52734602b Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 18 Feb 2009 10:05:18 +0000
Subject: [PATCH] Fix and disable the Replication StatMachineFull Test. This test is very hard and requires too a lot of memory to run. It is better to run it only when needed as it creates too much strain in the daily build.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java               |   20 ++++
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/MultimasterReplicationFakeConf.java |  206 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 224 insertions(+), 2 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/MultimasterReplicationFakeConf.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/MultimasterReplicationFakeConf.java
new file mode 100644
index 0000000..88a53d9
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/MultimasterReplicationFakeConf.java
@@ -0,0 +1,206 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2009 Sun Microsystems, Inc.
+ */
+package org.opends.server.replication.plugin;
+
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.std.server.ReplicationDomainCfg;
+import org.opends.server.admin.std.server.ReplicationServerCfg;
+import org.opends.server.admin.std.server.ReplicationSynchronizationProviderCfg;
+import org.opends.server.admin.std.server.SynchronizationProviderCfg;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.DN;
+
+public class MultimasterReplicationFakeConf implements
+   ReplicationSynchronizationProviderCfg
+{
+
+  @Override
+  public void addReplicationChangeListener(
+      ConfigurationChangeListener<ReplicationSynchronizationProviderCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void addReplicationDomainAddListener(
+      ConfigurationAddListener<ReplicationDomainCfg> listener)
+      throws ConfigException
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void addReplicationDomainDeleteListener(
+      ConfigurationDeleteListener<ReplicationDomainCfg> listener)
+      throws ConfigException
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void addReplicationServerAddListener(
+      ConfigurationAddListener<ReplicationServerCfg> listener)
+      throws ConfigException
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void addReplicationServerDeleteListener(
+      ConfigurationDeleteListener<ReplicationServerCfg> listener)
+      throws ConfigException
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Class<? extends ReplicationSynchronizationProviderCfg> configurationClass()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String getJavaClass()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public int getNumUpdateReplayThreads()
+  {
+    return 1;
+  }
+
+  @Override
+  public ReplicationDomainCfg getReplicationDomain(String name)
+      throws ConfigException
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public ReplicationServerCfg getReplicationServer() throws ConfigException
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public boolean hasReplicationServer()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public String[] listReplicationDomains()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void removeReplicationChangeListener(
+      ConfigurationChangeListener<ReplicationSynchronizationProviderCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void removeReplicationDomainAddListener(
+      ConfigurationAddListener<ReplicationDomainCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void removeReplicationDomainDeleteListener(
+      ConfigurationDeleteListener<ReplicationDomainCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void removeReplicationServerAddListener(
+      ConfigurationAddListener<ReplicationServerCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void removeReplicationServerDeleteListener(
+      ConfigurationDeleteListener<ReplicationServerCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void addChangeListener(
+      ConfigurationChangeListener<SynchronizationProviderCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public boolean isEnabled()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public void removeChangeListener(
+      ConfigurationChangeListener<SynchronizationProviderCfg> listener)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public DN dn()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
index 0a103da..b329306 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2009 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.plugin;
 
@@ -36,6 +36,8 @@
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
+
 import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
 import static org.opends.server.loggers.ErrorLogger.logError;
 import static org.opends.server.loggers.debug.DebugLogger.getTracer;
@@ -46,6 +48,11 @@
 import org.opends.messages.Message;
 import org.opends.messages.Severity;
 import org.opends.server.TestCaseUtils;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.std.server.ReplicationSynchronizationProviderCfg;
+import org.opends.server.admin.std.server.SynchronizationProviderCfg;
+import org.opends.server.api.SynchronizationProvider;
+import org.opends.server.core.DirectoryServer;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.replication.ReplicationTestCase;
 import org.opends.server.replication.service.ReplicationBroker;
@@ -275,6 +282,7 @@
    * Creates and starts a new ReplicationDomain configured for the replication
    * server
    */
+  @SuppressWarnings("unchecked")
   private LDAPReplicationDomain createReplicationDomain(short dsId)
   {
     try
@@ -288,6 +296,14 @@
       LDAPReplicationDomain replicationDomain =
         MultimasterReplication.createNewDomain(domainConf);
       replicationDomain.start();
+      SynchronizationProvider<SynchronizationProviderCfg> provider =
+        DirectoryServer.getSynchronizationProviders().get(0);
+      if (provider instanceof ConfigurationChangeListener)
+      {
+        ConfigurationChangeListener<MultimasterReplicationFakeConf> mmr =
+          (ConfigurationChangeListener<MultimasterReplicationFakeConf>) provider;
+        mmr.applyConfigurationChange(new MultimasterReplicationFakeConf());
+      }
 
       return replicationDomain;
 
@@ -547,7 +563,7 @@
    * ->NC->D->N->NC->N->D->NC->D->N->BG->NC->N->D->BG->FU->NC->N->D->FU->NC->BG->NC->N->FU->NC->N->NC
    * @throws Exception If a problem occurred
    */
-  @Test(enabled = true, groups = "slow")
+  @Test(enabled = false, groups = "slow")
   public void testStateMachineFull() throws Exception
   {
     String testCase = "testStateMachineFull";

--
Gitblit v1.10.0