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

Jean-Noel Rouvignac
19.39.2013 b1a075384bb211f7d7bb555019bce86b4802905a
ServerStateTest.java:
Added @Test annotation to testCover() - follow up of r9800

ServerState.java:
Little code cleanup.
2 files modified
16 ■■■■■ changed files
opends/src/server/org/opends/server/replication/common/ServerState.java 15 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/common/ServerStateTest.java 1 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -86,8 +86,7 @@
   *               ends.
   * @throws DataFormatException If the encoded form was not correct.
   */
  public ServerState(byte[] in, int pos, int endpos)
         throws DataFormatException
  public ServerState(byte[] in, int pos, int endpos) throws DataFormatException
  {
    try
    {
@@ -373,15 +372,14 @@
      List<String> csnList = new ArrayList<String>(size);
      // calculate the total length needed to allocate byte array
      int length = 0;
      for (Entry<Integer, CSN> entry : serverIdToCSN
          .entrySet())
      for (Entry<Integer, CSN> entry : serverIdToCSN.entrySet())
      {
        // serverId is useless, see comment in ServerState ctor
        String serverIdStr = String.valueOf(entry.getKey());
        final String serverIdStr = String.valueOf(entry.getKey());
        idList.add(serverIdStr);
        length += serverIdStr.length() + 1;
        String csnStr = entry.getValue().toString();
        final String csnStr = entry.getValue().toString();
        csnList.add(csnStr);
        length += csnStr.length() + 1;
      }
@@ -438,9 +436,8 @@
   */
  public boolean cover(CSN covered)
  {
    CSN change =
        this.serverIdToCSN.get(covered.getServerId());
    return change != null && !change.isOlderThan(covered);
    final CSN csn = this.serverIdToCSN.get(covered.getServerId());
    return csn != null && !csn.isOlderThan(covered);
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/common/ServerStateTest.java
@@ -120,6 +120,7 @@
    assertEquals(state1.toString(), state2.toString()) ;
  }
  @Test
  public void testCover() throws Exception
  {
    final CSN csn1Server1 = new CSN(1, 0, 1);