mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
12.57.2008 582ba91d8e6ce0d243c752cfc81654dd389b88b5

5 files added
4 files modified
245 ■■■■■ changed files
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java 7 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 1 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java 94 ●●●● patch | view | raw | blame | history
opends/test-output/emailable-report.html 43 ●●●●● patch | view | raw | blame | history
opends/test-output/index.html 9 ●●●●● patch | view | raw | blame | history
opends/test-output/testng-failed.xml 18 ●●●●● patch | view | raw | blame | history
opends/test-output/testng-results.xml 32 ●●●●● patch | view | raw | blame | history
opends/test-output/testng.css 9 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java 32 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -158,7 +158,7 @@
   * The fully-qualified name of this class.
   */
  private static final String CLASS_NAME =
       "org.opends.server.replication.plugin.ReplicationDomain";
       "org.opends.server.replication.plugin.LDAPReplicationDomain";
  /**
   * The attribute used to mark conflicting entries.
@@ -2642,12 +2642,15 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void sessionInitiated(
      ServerStatus initStatus,
      ServerState replicationServerState,
      long generationID,
      ProtocolSession session)
  {
    super.sessionInitiated(initStatus, replicationServerState, session);
    super.sessionInitiated(
        initStatus, replicationServerState,generationID, session);
    try
    {
      /*
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -432,6 +432,7 @@
                {
                  domain.sessionInitiated(
                      initStatus, replServerStartMsg.getServerState(),
                      replServerStartMsg.getGenerationId(),
                      session);
                }
                receiveTopo(topologyMsg);
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -104,7 +104,7 @@
 *   should read the list of replication servers from the configuration,
 *   instantiate a {@link ServerState} then start the publish service
 *   by calling
 *   {@link #startPublishService(Collection, ServerState, int, long)}.
 *   {@link #startPublishService(Collection, int, long)}.
 *   At this point it can start calling the {@link #publish(UpdateMsg)}
 *   method if needed.
 * <p>
@@ -119,7 +119,7 @@
 *   ReplicationDomain implementation should implement the appropriate code
 *   for replaying the update on the local repository.
 *   When fully done the subclass must call the
 *   {@link #processUpdateDone(UpdateMsg)} method.
 *   {@link #processUpdateDone(UpdateMsg, String)} method.
 *   This allows to process the update asynchronously if necessary.
 *
 * <p>
@@ -134,8 +134,8 @@
 *   Full Initialization of a replica can be triggered by LDAP clients
 *   by creating InitializeTasks or InitializeTargetTask.
 *   Full initialization can also by triggered from the ReplicationDomain
 *   implementation using methods {@link #initializeRemote(short, Task)}
 *   or {@link #initializeFromRemote(short, Task)}.
 *   implementation using methods {@link #initializeRemote(short)}
 *   or {@link #initializeFromRemote(short)}.
 * <p>
 *   At shutdown time, the {@link #stopDomain()} method should be called to
 *   cleanly stop the replication service.
@@ -335,11 +335,15 @@
   * @param initStatus              The status to enter the state machine with.
   * @param replicationServerState  The ServerState of the ReplicationServer
   *                                with which the session was established.
   * @param generationID            The current generationID of the
   *                                ReplicationServer with which the session
   *                                was established.
   * @param session                 The ProtocolSession that is currently used.
   */
  public void sessionInitiated(
      ServerStatus initStatus,
      ServerState replicationServerState,
      long generationID,
      ProtocolSession session)
  {
    // Sanity check: is it a valid initial status?
@@ -1217,11 +1221,13 @@
  /**
   * Process the initialization of some other server or servers in the topology
   * specified by the target argument.
   * @param target The target that should be initialized
   * @param initTask The task that triggers this initialization and that should
   *                 be updated with its progress.
   *
   * @exception DirectoryException When an error occurs.
   * @param target    The target that should be initialized
   * @param initTask  The task that triggers this initialization and that should
   *                  be updated with its progress.
   *
   * @exception DirectoryException  If the Replication Initialization protocol
   *                                failed.
   */
  void initializeRemote(short target, Task initTask)
  throws DirectoryException
@@ -1507,6 +1513,54 @@
  /**
   * Initializes this domain from another source server.
   * <p>
   * When this method is called, a request for initialization will
   * be sent to the source server asking for initialization.
   * <p>
   * The {@link #exportBackend(OutputStream)} will therefore be called
   * on the source server, and the {@link #importBackend(InputStream)}
   * will be called on his server.
   * <p>
   * The InputStream and OutpuStream given as a parameter to those
   * methods will be connected through the replication protocol.
   *
   * @param source   The server-id of the source from which to initialize.
   *                 The source can be discovered using the
   *                 {@link #getDsList()} method.
   * @throws DirectoryException If it was not possible to publish the
   *                            Initialization message to the Topology.
   */
  public void initializeFromRemote(short source)
  throws DirectoryException
  {
    initializeFromRemote(source, null);
  }
  /**
   * Initializes a remote server from this server.
   * <p>
   * The {@link #exportBackend(OutputStream)} will therefore be called
   * on this server, and the {@link #importBackend(InputStream)}
   * will be called on the remote server.
   * <p>
   * The InputStream and OutpuStream given as a parameter to those
   * methods will be connected through the replication protocol.
   *
   * @param target   The server-id of the server that should be initialized.
   *                 The target can be discovered using the
   *                 {@link #getDsList()} method.
   *
   * @throws DirectoryException If it was not possible to publish the
   *                            Initialization message to the Topology.
   */
  public void initializeRemote(short target) throws DirectoryException
  {
    initializeRemote(target, null);
  }
  /**
   * Initializes this domain from another source server.
   *
   * @param source The source from which to initialize
   * @param initTask The task that launched the initialization
@@ -1694,12 +1748,27 @@
  }
  /**
   * Reset the Replication Log.
   * Calling this method will remove all the Replication information that
   * was kept on all the Replication Servers currently connected in the
   * topology.
   *
   * @throws DirectoryException If this ReplicationDomain is not currently
   *                           connected to a Replication Server or it
   *                           was not possible to contact it.
   */
  public void resetReplicationLog() throws DirectoryException
  {
    resetGenerationId((long)-1);
  }
  /**
   * Reset the generationId of this domain in the whole topology.
   * A message is sent to the Replication Servers for them to reset
   * their change dbs.
   *
   * @param generationIdNewValue The new value of the generation Id.
   * @throws DirectoryException when an error occurs
   * @param generationIdNewValue  The new value of the generation Id.
   * @throws DirectoryException   When an error occurs
   */
  void resetGenerationId(Long generationIdNewValue)
  throws DirectoryException
@@ -2095,7 +2164,7 @@
   * <p>
   * The Replication Service will restart from the point indicated by the
   * {@link ServerState} that was given as a parameter to the
   * {@link #startPublishService(Collection, ServerState, int, long)}
   * {@link #startPublishService(Collection, int, long)}
   * at startup time.
   * If some data have changed in the repository during the period of time when
   * the Replication Service was disabled, this {@link ServerState} should
@@ -2195,9 +2264,10 @@
   *                   time.
   *                   If <code> true </code> is returned, no further
   *                   processing is necessary.
   *
   *                   If <code> false </code> is returned, the subclass should
   *                   call the method
   *                   {@link #processUpdateDone(UpdateMsg)}
   *                   {@link #processUpdateDone(UpdateMsg, String)}
   *                   and update the ServerState
   *                   When this processing is complete.
   *
opends/test-output/emailable-report.html
New file
@@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TestNG:  Unit Test</title>
<style type="text/css">
table caption,table.info_table,table.param,table.passed,table.failed {margin-bottom:10px;border:1px solid #000099;border-collapse:collapse;empty-cells:show;}
table.info_table td,table.info_table th,table.param td,table.param th,table.passed td,table.passed th,table.failed td,table.failed th {
border:1px solid #000099;padding:.25em .5em .25em .5em
}
table.param th {vertical-align:bottom}
td.numi,th.numi,td.numi_attn {
text-align:right
}
tr.total td {font-weight:bold}
table caption {
text-align:center;font-weight:bold;
}
table.passed tr.stripe td,table tr.passedodd td {background-color: #00AA00;}
table.passed td,table tr.passedeven td {background-color: #33FF33;}
table.passed tr.stripe td,table tr.skippedodd td {background-color: #cccccc;}
table.passed td,table tr.skippedodd td {background-color: #dddddd;}
table.failed tr.stripe td,table tr.failedodd td,table.param td.numi_attn {background-color: #FF3333;}
table.failed td,table tr.failedeven td,table.param tr.stripe td.numi_attn {background-color: #DD0000;}
tr.stripe td,tr.stripe th {background-color: #E6EBF9;}
p.totop {font-size:85%;text-align:center;border-bottom:2px black solid}
div.shootout {padding:2em;border:3px #4854A8 solid}
</style>
</head>
<body>
<table cellspacing=0 cellpadding=0 class="param">
<tr><th>Test</th><th class="numi">Methods<br/>Passed</th><th class="numi">Scenarios<br/>Passed</th><th class="numi"># skipped</th><th class="numi"># failed</th><th class="numi">Total<br/>Time</th><th class="numi">Included<br/>Groups</th><th class="numi">Excluded<br/>Groups</th></tr>
<tr><td style="text-align:left;padding-right:2em">org.opends.server.replication.service.ReplicationDomainTest</td><td class="numi">1</td><td class="numi">1</td><td class="numi">0</td><td class="numi">0</td><td class="numi">178.1 seconds</td><td class="numi"></td><td class="numi"></td></tr>
</table>
<a id="summary"></a>
<table cellspacing=0 cellpadding=0 class="passed">
<tr><th>Class</th><th>Method</th><th># of<br/>Scenarios</th><th>Time<br/>(Msecs)</th></tr>
<tr><th colspan="4">org.opends.server.replication.service.ReplicationDomainTest &#8212; passed</th></tr>
<tr class="passedodd"><td rowspan="1">org.opends.server.replication.service.ReplicationDomainTest<td><a href="#m1">publishAndReceive (replication)</a></td><td class="numi">1</td><td class="numi">165333</td></tr>
</table>
<h1>org.opends.server.replication.service.ReplicationDomainTest</h1>
<a id="m1"></a><h2>org.opends.server.replication.service.ReplicationDomainTest:publishAndReceive</h2>
<p class="totop"><a href="#summary">back to summary</a></p>
</body></html>
opends/test-output/index.html
New file
@@ -0,0 +1,9 @@
<html>
<head><title>Test results</title><link href="./testng.css" rel="stylesheet" type="text/css" />
<link href="./my-testng.css" rel="stylesheet" type="text/css" />
</head><body>
<h2><p align='center'>Test results</p></h2>
<table border='1' width='100%' class='main-page'><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Skipped</th><th>testng.xml</th></tr>
<tr align='center' class='invocation-passed'><td><em>Total</em></td><td><em>1</em></td><td><em>0</em></td><td><em>0</em></td><td>&nbsp;</td></tr>
<tr align='center' class='invocation-passed'><td><a href='opends2/index.html'>opends2</a></td>
<td>1</td><td>0</td><td>0</td><td><a href='opends2/testng.xml.html'>Link</a></td></tr></table></body></html>
opends/test-output/testng-failed.xml
New file
@@ -0,0 +1,18 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Failed suite [opends2]" junit="false" annotations="JDK">
  <test name="org.opends.server.replication.service.ReplicationDomainTest(failed)" junit="false" annotations="JDK">
    <classes>
      <class name="org.opends.server.replication.service.ReplicationDomainTest">
        <methods>
          <include name="publishAndReceive"/>
          <include name="setUp"/>
          <include name="suppressOutput"/>
          <include name="shutdownServer"/>
          <include name="clearSuccessfulTestParams"/>
          <include name="nullMemberVariablesAfterTest"/>
          <include name="exportAndImport"/>
        </methods>
      </class>
    </classes>
  </test>
</suite>
opends/test-output/testng-results.xml
New file
@@ -0,0 +1,32 @@
<testng-results>
  <reporter-output>
  </reporter-output>
  <suite name="opends2">
    <groups>
      <group name="precommit">
        <method signature="org.opends.server.replication.service.ReplicationDomainTest.publishAndReceive()" name="publishAndReceive" class="org.opends.server.replication.service.ReplicationDomainTest"/>
      </group>
      <group name="replication">
        <method signature="org.opends.server.replication.service.ReplicationDomainTest.publishAndReceive()" name="publishAndReceive" class="org.opends.server.replication.service.ReplicationDomainTest"/>
      </group>
    </groups>
    <test name="org.opends.server.replication.service.ReplicationDomainTest">
      <class name="org.opends.server.replication.service.ReplicationDomainTest">
        <test-method status="PASS" signature="classCleanUp()" name="classCleanUp" is-config="true" duration-ms="627" started-at="2008-12-12T12:11:07Z" finished-at="2008-12-12T12:11:07Z">
        </test-method>
        <test-method status="PASS" signature="nullMemberVariablesAfterTest()" name="nullMemberVariablesAfterTest" is-config="true" duration-ms="2" started-at="2008-12-12T12:11:07Z" finished-at="2008-12-12T12:11:07Z">
        </test-method>
        <test-method status="PASS" signature="setUp()" name="setUp" is-config="true" duration-ms="11827" started-at="2008-12-12T12:08:09Z" finished-at="2008-12-12T12:08:21Z">
        </test-method>
        <test-method status="PASS" signature="publishAndReceive()" name="publishAndReceive" duration-ms="165333" started-at="2008-12-12T12:08:21Z" finished-at="2008-12-12T12:11:07Z">
        </test-method>
        <test-method status="PASS" signature="shutdownServer()" name="shutdownServer" is-config="true" duration-ms="358" started-at="2008-12-12T12:11:07Z" finished-at="2008-12-12T12:11:08Z">
        </test-method>
        <test-method status="PASS" signature="clearSuccessfulTestParams()" name="clearSuccessfulTestParams" is-config="true" duration-ms="0" started-at="2008-12-12T12:11:07Z" finished-at="2008-12-12T12:11:07Z">
        </test-method>
        <test-method status="PASS" signature="suppressOutput()" name="suppressOutput" is-config="true" duration-ms="14" started-at="2008-12-12T12:08:09Z" finished-at="2008-12-12T12:08:09Z">
        </test-method>
      </class>
    </test>
  </suite>
</testng-results>
opends/test-output/testng.css
New file
@@ -0,0 +1,9 @@
.invocation-failed,  .test-failed  { background-color: #DD0000; }
.invocation-percent, .test-percent { background-color: #006600; }
.invocation-passed,  .test-passed  { background-color: #00AA00; }
.invocation-skipped, .test-skipped { background-color: #CCCC00; }
.main-page {
  font-size: x-large;
}
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -28,6 +28,7 @@
import static org.testng.Assert.*;
import java.util.List;
import java.util.TreeSet;
import java.util.concurrent.LinkedBlockingQueue;
@@ -39,6 +40,7 @@
import org.opends.server.TestCaseUtils;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.DSInfo;
import org.opends.server.replication.common.RSInfo;
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.replication.server.ReplServerFakeConfiguration;
import org.opends.server.replication.server.ReplicationServer;
@@ -51,6 +53,7 @@
{
  /**
   * Test that a ReplicationDomain is able to publish and receive UpdateMsg.
   * Also test the ReplicationDomain.resetReplicationLog() method.
   */
  @Test(enabled=true)
  public void publishAndReceive() throws Exception
@@ -95,6 +98,33 @@
      UpdateMsg rcvdMsg = rcvQueue2.poll(1, TimeUnit.SECONDS);
      assertNotNull(rcvdMsg);
      assertEquals(test, rcvdMsg.getPayload());
      /*
       * Now test the resetReplicationLog() method.
       */
      List<RSInfo> replServers = domain1.getRsList();
      // There should be one and only one server in the list.
      assertTrue(replServers.size() == 1);
      RSInfo replServerInfo = replServers.get(0);
      // The generation Id of the remote should be 1
      assertTrue(replServerInfo.getGenerationId() == 1);
      domain1.resetReplicationLog();
      Thread.sleep(1000);
      replServers = domain1.getRsList();
      // There should be one and only one server in the list.
      assertTrue(replServers.size() == 1);
      replServerInfo = replServers.get(0);
      // The generation Id of the remote should now be -1
      assertTrue(replServerInfo.getGenerationId() == -1);
    }
    finally
    {
@@ -161,7 +191,7 @@
      {
        if (remoteDS.getDsId() != domain2.getServerId())
        {
          domain2.initializeFromRemote(remoteDS.getDsId() , null);
          domain2.initializeFromRemote(remoteDS.getDsId());
          break;
        }
      }