Skip to content

Commit 878917f

Browse files
Enable the SNMP tests in the default build (#705)
Co-authored-by: Maxim Thomas <maxim.thomas@gmail.com>
1 parent b0184e6 commit 878917f

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

opendj-server-legacy/pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,6 @@
648648
<showDeprecation>false</showDeprecation>
649649
<showWarnings>false</showWarnings>
650650
<testCompilerArgument>-nowarn</testCompilerArgument>
651-
<testExcludes>
652-
<testExclude>**/org/opends/server/snmp/**</testExclude>
653-
</testExcludes>
654651
</configuration>
655652
</execution>
656653
</executions>
@@ -1260,9 +1257,6 @@
12601257
<!-- <enableProcessChecker>all</enableProcessChecker>-->
12611258
<forkedProcessTimeoutInSeconds>2400</forkedProcessTimeoutInSeconds>
12621259
<forkedProcessExitTimeoutInSeconds>120</forkedProcessExitTimeoutInSeconds>
1263-
<excludes>
1264-
<exclude>org/opends/server/snmp/**</exclude>
1265-
</excludes>
12661260
<includes>
12671261
<include>**/Test*.java</include>
12681262
<include>**/*Test.java</include>
@@ -1289,7 +1283,7 @@
12891283
<org.opends.server.BuildRoot>${basedir}</org.opends.server.BuildRoot>
12901284
<org.opends.server.BuildDir>${project.build.directory}</org.opends.server.BuildDir>
12911285
<org.opends.test.replicationDbImpl>LOG</org.opends.test.replicationDbImpl>
1292-
<jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}" />
1286+
<org.opends.server.snmp.opendmk>${opendmk.lib.dir}</org.opends.server.snmp.opendmk>
12931287
<org.opends.server.CleanupDirectories>true</org.opends.server.CleanupDirectories>
12941288
<org.opends.test.suppressOutput>true</org.opends.test.suppressOutput>
12951289
<org.opends.test.pauseOnFailure>false</org.opends.test.pauseOnFailure>

opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPConnectionManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* Copyright 2008 Sun Microsystems, Inc.
1515
* Portions copyright 2014-2016 ForgeRock AS.
16+
* Portions copyright 2026 3A Systems, LLC
1617
*/
1718
package org.opends.server.snmp;
1819

@@ -139,7 +140,7 @@ protected SnmpUsmPeer getSnmpV3Peer(int port)
139140

140141
try
141142
{
142-
String host = InetAddress.getLocalHost().getCanonicalHostName();
143+
String host = "localhost";
143144
SnmpOidTableSupport oidTable = new DIRECTORY_SERVER_MIBOidTable();
144145
SnmpOid.setSnmpOidTable(oidTable);
145146

@@ -166,7 +167,7 @@ protected SnmpPeer getSnmpV2Peer(int port)
166167

167168
try
168169
{
169-
String host = InetAddress.getLocalHost().getCanonicalHostName();
170+
String host = "localhost";
170171
SnmpOidTableSupport oidTable = new DIRECTORY_SERVER_MIBOidTable();
171172
SnmpOid.setSnmpOidTable(oidTable);
172173
return new SnmpPeer(host, port);

opendj-server-legacy/src/test/java/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* Copyright 2008 Sun Microsystems, Inc.
1515
* Portions Copyright 2014-2016 ForgeRock AS.
16+
* Portions Copyright 2024-2026 3A Systems, LLC
1617
*/
1718
package org.opends.server.snmp;
1819

@@ -34,7 +35,7 @@
3435
/**
3536
* SNMP tests.
3637
*/
37-
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
38+
@Test(groups = {"precommit", "snmp"}, sequential = true)
3839
public class SNMPSyncManagerV2AccessTest extends SNMPConnectionManager {
3940

4041
@BeforeClass
@@ -60,7 +61,7 @@ Object[][] listAttributes() {
6061
{"dsSlaveHits"}};
6162
}
6263

63-
@Test(enabled=false,dataProvider = "listAttributes")
64+
@Test(dataProvider = "listAttributes")
6465
public void checkAttribute(String attributeName) {
6566

6667
// get the SNMP peer agent
@@ -76,7 +77,7 @@ public void checkAttribute(String attributeName) {
7677
new SnmpParameters();
7778

7879
// Set to the allowed the community string
79-
params.setRdCommunity("OpenDS@OpenDS");
80+
params.setRdCommunity("OpenDJ@OpenDJ");
8081

8182
// The newly created parameter must be associated to the agent.
8283
//
@@ -163,17 +164,17 @@ Object[][] listCommunities() {
163164
return new Object[][]{
164165
{"public", false},
165166
{"private", false},
166-
{"OpenDS@OpenDS", true},
167+
{"OpenDJ@OpenDJ", true},
167168
{"dummy", false},
168169
{"", false}};
169170
}
170171

171-
@Test(enabled = false,dataProvider = "listCommunities")
172+
@Test(dataProvider = "listCommunities")
172173
public void checkCommunity(String community, boolean expectedResult) {
173174

174175
try {
175176

176-
String host = InetAddress.getLocalHost().getCanonicalHostName();
177+
String host = "localhost";
177178
// Initialize the SNMP Manager API.
178179
// Specify the OidTable containing all the MIB II knowledge.
179180
// Use the OidTable generated by mibgen when compiling MIB II.

0 commit comments

Comments
 (0)