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

fguigues
20.34.2008 2e2410712c7a0cbc20122f05c728e4f07dd1fdda
Update the SNMP Unit tests.
Delete the nbproject (will be available as a zip on https://www.opends.org/wiki/page/BuildingAndRunningOpenDSWithinNetbeans)

4 files deleted
6 files modified
790 ■■■■■ changed files
opends/build.properties 2 ●●●●● patch | view | raw | blame | history
opends/build.xml 1 ●●●● patch | view | raw | blame | history
opends/nbproject/genfiles.properties 5 ●●●●● patch | view | raw | blame | history
opends/nbproject/ide-file-targets.xml 234 ●●●●● patch | view | raw | blame | history
opends/nbproject/ide-targets.xml 38 ●●●●● patch | view | raw | blame | history
opends/nbproject/project.xml 435 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 33 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPConnectionManager.java 32 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java 6 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPTrapManagerTest.java 4 ●●●● patch | view | raw | blame | history
opends/build.properties
@@ -1,2 +1,4 @@
opendmk.lib.dir=
opends/build.xml
@@ -1911,6 +1911,7 @@
      <jvmarg value="-Demma.coverage.out.merge=false" />
      <jvmarg value="-Dorg.opends.server.BuildRoot=${basedir}" />
      <jvmarg value="-Dorg.opends.server.RunningUnitTests=true" />
      <jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}"/>
      <jvmarg value="-Dorg.opends.test.suppressOutput=${org.opends.test.suppressOutput}" />
      <jvmarg value="-Dorg.opends.test.pauseOnFailure=${org.opends.test.pauseOnFailure}" />
      <jvmarg value="-Dorg.opends.test.debug.target=${org.opends.test.debug.target}" />
opends/nbproject/genfiles.properties
File was deleted
opends/nbproject/ide-file-targets.xml
File was deleted
opends/nbproject/ide-targets.xml
File was deleted
opends/nbproject/project.xml
File was deleted
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -136,6 +136,12 @@
   */
  public static final String TEST_ROOT_DN_STRING = "o=test";
  /**
   * The string representation of the OpenDMK jar file location
   * that will be used as base to determine if snmp is included or not
   */
  public static final String PROPERTY_OPENDMK_LOCATION =
          "org.opends.server.snmp.opendmk";
  /**
   * The test text writer for the Debug Logger
@@ -254,10 +260,17 @@
      File testBinDir       = new File(testRoot, "bin");
      
      // Snmp resource
      String opendmkJarFileLocation =
              System.getProperty(PROPERTY_OPENDMK_LOCATION);
      File opendmkJar = new File(opendmkJarFileLocation, "jdmkrt.jar");
      File   snmpResourceDir = new File(buildRoot + File.separator + "src" +
                                    File.separator + "snmp" + File.separator +
                                    "resource");
      
      File snmpConfigDir = new File(snmpResourceDir, "config");
      File testSnmpResourceDir = new File (testConfigDir + File.separator +
                                    "snmp");
@@ -288,6 +301,11 @@
      copyFile(new File(testResourceDir, "client-cert.p12"),
               new File(testConfigDir, "client-cert.p12"));
      if (opendmkJar.exists()) {
          appendFile(new File(snmpConfigDir, "config.snmp.ldif"),
               new File(testConfigDir,"config.ldif"));
      }
      for (File f : testBinDir.listFiles())
      {
        try
@@ -815,6 +833,21 @@
    out.close();
  }
  public static void appendFile(File src, File dst) throws IOException {
    InputStream in = new FileInputStream(src);
    OutputStream out = new FileOutputStream(dst, true);
    // Transfer bytes from in to out
    byte[] buf = new byte[8192];
    int len;
    while ((len = in.read(buf)) > 0) {
      out.write(buf, 0, len);
    }
    in.close();
    out.close();
  }
  /**
   * Get the LDAP port the test environment Directory Server instance is
   * running on.
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPConnectionManager.java
@@ -32,6 +32,7 @@
import com.sun.management.snmp.manager.SnmpPeer;
import com.sun.management.snmp.manager.SnmpSession;
import com.sun.management.snmp.manager.usm.SnmpUsmPeer;
import java.io.File;
import java.net.InetAddress;
import static org.testng.Assert.*;
@@ -53,7 +54,7 @@
/**
 * An abstract class that all SNMP unit test should extend.
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
@Test(enabled=true, groups = {"precommit", "snmp"}, sequential = true)
public abstract class SNMPConnectionManager extends DirectoryServerTestCase {
    /**
@@ -152,7 +153,7 @@
     * @return an SNMP Connection handler
     * @throws an Exception is something went wrong.
     */
    public SNMPConnectionHandler getSNMPConnectionHandler() throws Exception {
    protected SNMPConnectionHandler getSNMPConnectionHandler() throws Exception {
        List<ConnectionHandler> handlers =
                DirectoryServer.getConnectionHandlers();
        assertNotNull(handlers);
@@ -197,9 +198,6 @@
        InternalClientConnection conn =
                InternalClientConnection.getRootConnection();
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-enabled", "true")));
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
@@ -215,6 +213,14 @@
                new org.opends.server.types.Attribute(
                "ds-cfg-traps-destination", hosts)));
       String jarFileLocation =
               System.getProperty("org.opends.server.snmp.opendmk");
       mods.add(new Modification(ModificationType.ADD,
                new org.opends.server.types.Attribute(
                "ds-cfg-opendmk-jarfile", jarFileLocation + File.separator +
                "jdmkrt.jar")));
        ModifyOperationBasis op = new ModifyOperationBasis(
                conn,
                conn.nextOperationID(),
@@ -223,6 +229,22 @@
                DN.decode("cn=SNMP Connection Handler,cn=Connection Handlers,cn=config"),
                mods);
        op.run();
        mods.clear();
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-enabled", "true")));
        op = new ModifyOperationBasis(
                conn,
                conn.nextOperationID(),
                conn.nextMessageID(),
                new ArrayList<Control>(),
                DN.decode("cn=SNMP Connection Handler,cn=Connection Handlers,cn=config"),
                mods);
        op.run();
    }
    /**
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java
@@ -60,7 +60,7 @@
 * A simple test for : - JMX connection establishment withou using SSL -
 * JMX get and set - configuration change
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
@Test(enabled=true, groups = {"precommit", "snmp"}, sequential = true)
public class SNMPSyncManagerV2AccessTest extends SNMPConnectionManager {
    @BeforeClass
@@ -86,7 +86,7 @@
            {"dsSlaveHits"}};
    }
    @Test(enabled=false,dataProvider = "listAttributes")
    @Test(enabled=true,dataProvider = "listAttributes")
    public void checkAttribute(String attributeName) {
        // get the SNMP peer agent
@@ -194,7 +194,7 @@
            {"", false}};
    }
    @Test(enabled = false,dataProvider = "listCommunities")
    @Test(enabled = true,dataProvider = "listCommunities")
    public void checkCommunity(String community, boolean expectedResult) {
        try {
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPTrapManagerTest.java
@@ -54,7 +54,7 @@
 * <p>As a reminder, if you wish to query the SNMP agent example provided
 *    as part of Java DMK, use port 8085.
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
@Test(enabled=true, groups = {"precommit", "snmp"}, sequential = true)
public class SNMPTrapManagerTest extends SNMPConnectionManager {
    @BeforeClass
@@ -63,7 +63,7 @@
        super.setUp();
    }
    
    @Test(enabled = false)
    @Test(enabled = true)
    public void checkTraps() {
        try {