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

Ludovic Poitou
10.07.2014 d45c178121e0a29e3999acd3cd884ab55a7ea9fc
Port another set of test fixes.
Fixed another set of tests that are not always working individually (because they need the server to be started and they don't check and start).
Fixed typos and also removed unused variables.
Thanks to Henry-Joseph for testing and providing the patch.
5 files modified
88 ■■■■■ changed files
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java 18 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java 19 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java 11 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java 21 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java 19 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java
@@ -29,6 +29,8 @@
import org.forgerock.opendj.io.*;
import org.forgerock.opendj.ldap.ByteString;
import static org.opends.server.util.ServerConstants.EOL;
import org.opends.server.TestCaseUtils;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.core.DirectoryServer;
@@ -48,11 +50,6 @@
 */
public class TestAddResponseProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for add requests.
   */
  private static final byte OP_TYPE_ADD_REQUEST = 0x68;
  /**
   * The protocol op type for add responses.
   */
  private static final byte OP_TYPE_ADD_RESPONSE = 0x69;
@@ -73,10 +70,12 @@
  private DN dn;
  @BeforeClass
  public void setupDN()
  public void setupDN() throws Exception
  {
    //Setup the DN to use in the response tests.
    // Starts the server if not already started
    TestCaseUtils.startServer();
    //Setup the DN to use in the response tests.
    AttributeType attribute =
        DirectoryServer.getDefaultAttributeType("testAttribute");
    ByteString attributeValue = ByteString.valueOf("testValue");
@@ -115,9 +114,8 @@
  @Test
  public void testConstructors() throws Exception
  {
    AddResponseProtocolOp addResponse;
    //Test to make sure the constructor with result code param works.
    addResponse = new AddResponseProtocolOp(resultCode);
    AddResponseProtocolOp addResponse = new AddResponseProtocolOp(resultCode);
    assertEquals(addResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code and error message
@@ -127,7 +125,7 @@
    assertEquals(addResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code, message, dn, and
    //referal params works.
    //referral params works.
    ArrayList<String> referralURLs = new ArrayList<String>();
    referralURLs.add("ds1.example.com");
    referralURLs.add("ds2.example.com");
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java
@@ -35,6 +35,7 @@
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.testng.annotations.BeforeClass;
@@ -50,13 +51,6 @@
public class TestCompareResponseProtocolOp extends LdapTestCase
{
  /**
   * The protocol op type for compare requests.
   */
  public static final byte OP_TYPE_COMPARE_REQUEST = 0x6E;
  /**
   * The protocol op type for compare responses.
   */
  public static final byte OP_TYPE_COMPARE_RESPONSE = 0x6F;
@@ -77,10 +71,12 @@
  private DN dn;
  @BeforeClass
  public void setupDN()
  public void setupDN() throws Exception
  {
    //Setup the DN to use in the response tests.
    // Starts the server if not already started
    TestCaseUtils.startServer();
    //Setup the DN to use in the response tests.
    AttributeType attribute =
        DirectoryServer.getDefaultAttributeType("testAttribute");
    ByteString attributeValue = ByteString.valueOf("testValue");
@@ -121,9 +117,8 @@
  @Test
  public void testConstructors() throws Exception
  {
    CompareResponseProtocolOp compareResponse;
    //Test to make sure the constructor with result code param works.
    compareResponse = new CompareResponseProtocolOp(resultCode);
    CompareResponseProtocolOp compareResponse = new CompareResponseProtocolOp(resultCode);
    assertEquals(compareResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code and error message
@@ -133,7 +128,7 @@
    assertEquals(compareResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code, message, dn, and
    //referal params works.
    //referral params works.
    ArrayList<String> referralURLs = new ArrayList<String>();
    referralURLs.add("ds1.example.com");
    referralURLs.add("ds2.example.com");
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java
@@ -35,6 +35,7 @@
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.testng.annotations.BeforeClass;
@@ -75,8 +76,11 @@
  private DN dn;
  @BeforeClass
  public void setupDN()
  public void setupDN() throws Exception
  {
    // Starts the server if not already started
    TestCaseUtils.startServer();
    //Setup the DN to use in the response tests.
    AttributeType attribute =
        DirectoryServer.getDefaultAttributeType("testAttribute");
@@ -118,9 +122,8 @@
  @Test
  public void testConstructors() throws Exception
  {
    DeleteResponseProtocolOp deleteResponse;
    //Test to make sure the constructor with result code param works.
    deleteResponse = new DeleteResponseProtocolOp(resultCode);
    DeleteResponseProtocolOp deleteResponse = new DeleteResponseProtocolOp(resultCode);
    assertEquals(deleteResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code and error message
@@ -130,7 +133,7 @@
    assertEquals(deleteResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code, message, dn, and
    //referal params works.
    //referral params works.
    ArrayList<String> referralURLs = new ArrayList<String>();
    referralURLs.add("ds1.example.com");
    referralURLs.add("ds2.example.com");
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java
@@ -36,6 +36,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.testng.annotations.BeforeClass;
@@ -48,14 +49,8 @@
 * This class defines a set of tests for the
 * org.opends.server.protocol.ldap.ModifyDNResponseProtocolOp class.
 */
public class TestModifyDNResponseProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for modify DN requests.
   */
  public static final byte OP_TYPE_MODIFY_DN_REQUEST = 0x6C;
public class TestModifyDNResponseProtocolOp extends DirectoryServerTestCase
{
  /**
   * The protocol op type for modify DN responses.
   */
@@ -77,8 +72,11 @@
  private DN dn;
  @BeforeClass
  public void setupDN()
  public void setupDN() throws Exception
  {
    // Starts the server if not already started
    TestCaseUtils.startServer();
    //Setup the DN to use in the response tests.
    AttributeType attribute =
        DirectoryServer.getDefaultAttributeType("testAttribute");
@@ -120,9 +118,8 @@
  @Test
  public void testConstructors() throws Exception
  {
    ModifyDNResponseProtocolOp modifyResponse;
    //Test to make sure the constructor with result code param works.
    modifyResponse = new ModifyDNResponseProtocolOp(resultCode);
    ModifyDNResponseProtocolOp modifyResponse = new ModifyDNResponseProtocolOp(resultCode);
    assertEquals(modifyResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code and error message
@@ -132,7 +129,7 @@
    assertEquals(modifyResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code, message, dn, and
    //referal params works.
    //referral params works.
    ArrayList<String> referralURLs = new ArrayList<String>();
    referralURLs.add("ds1.example.com");
    referralURLs.add("ds2.example.com");
opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java
@@ -35,6 +35,7 @@
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.*;
import org.testng.annotations.BeforeClass;
@@ -50,13 +51,6 @@
public class TestModifyResponseProtocolOp extends LdapTestCase
{
  /**
   * The protocol op type for modify requests.
   */
  public static final byte OP_TYPE_MODIFY_REQUEST = 0x66;
  /**
   * The protocol op type for modify responses.
   */
  public static final byte OP_TYPE_MODIFY_RESPONSE = 0x67;
@@ -77,10 +71,12 @@
  private DN dn;
  @BeforeClass
  public void setupDN()
  public void setupDN() throws Exception
  {
    //Setup the DN to use in the response tests.
    // Starts the server if not already started
    TestCaseUtils.startServer();
    //Setup the DN to use in the response tests.
    AttributeType attribute =
        DirectoryServer.getDefaultAttributeType("testAttribute");
    ByteString attributeValue = ByteString.valueOf("testValue");
@@ -121,9 +117,8 @@
  @Test
  public void testConstructors() throws Exception
  {
    ModifyResponseProtocolOp modifyResponse;
    //Test to make sure the constructor with result code param works.
    modifyResponse = new ModifyResponseProtocolOp(resultCode);
    ModifyResponseProtocolOp modifyResponse = new ModifyResponseProtocolOp(resultCode);
    assertEquals(modifyResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code and error message
@@ -133,7 +128,7 @@
    assertEquals(modifyResponse.getResultCode(), resultCode);
    //Test to make sure the constructor with result code, message, dn, and
    //referal params works.
    //referral params works.
    ArrayList<String> referralURLs = new ArrayList<String>();
    referralURLs.add("ds1.example.com");
    referralURLs.add("ds2.example.com");