/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions copyright 2014 ForgeRock AS
*/
/**
* An abstract class that all SNMP unit test should extend.
*/
{
"precommit", "snmp"
}, sequential = true)
{
/**
* Snmp Port
*/
private int snmpPort;
/**
* Snmp Trap Port
*/
private int trapSnmpPort;
/**
* Set Up the Directory Server
*
* @throws java.lang.Exception
*/
{
// Make sure that the server is up and running.
synchronized (this)
{
this.wait(500);
}
if (snmpHandler == null)
{
throw new Exception("Unable to get a SNMP connector");
}
}
/**
* Set Down the Directory Server.
*
* @throws java.lang.Exception
*/
{
}
/**
* Gets the Snmp port on which the Connection Handler is listening
*
* @return
*/
protected int getSnmpPort()
{
return this.snmpPort;
}
/**
* Gets the Snmp trap port on which the Connection Handler is
* listening
*
* @return
*/
protected int getTrapSnmpPort()
{
return this.trapSnmpPort;
}
/**
* Gets an SNMP V3 peer agent (proxy)
*
* @param port
* @return
*/
{
try
{
}
{
return null;
}
}
/**
* Gets an SNMP V2 agent peer (proxy)
*
* @param port
* @return
*/
{
try
{
}
{
return null;
}
}
/**
* Get a reference to the SNMP connection handler.
*
* @return an SNMP Connection handler
* @throws an
* Exception is something went wrong.
*/
{
{
if (handler instanceof SNMPConnectionHandler)
{
break;
}
}
if (snmpConnectionHandler == null)
{
enableSnmp();
synchronized (this)
{
this.wait(500);
}
{
if (handler instanceof SNMPConnectionHandler)
{
break;
}
}
}
return snmpConnectionHandler;
}
/**
* Enable SNMP with the port chosen in TestCaseUtils.
*
* @throws Exception
* if the handler cannot be enabled.
*/
{
"ds-cfg-traps-destination", hosts)));
.getProperty("org.opends.server.snmp.opendmk");
+ "jdmkrt.jar")));
.valueOf("cn=SNMP Connection Handler,cn=Connection Handlers,cn=config"),
mods);
.valueOf("cn=SNMP Connection Handler,cn=Connection Handlers,cn=config"),
mods);
}
/**
* Enable JMX with the port chosen in TestCaseUtils.
*
* @throws Exception
* if the handler cannot be enabled.
*/
{
"ds-cfg-enabled", "true")));
.valueOf("cn=JMX Connection Handler,cn=Connection Handlers,cn=config"),
mods);
}
}