use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class ContainerTest method checkGetByName.
private void checkGetByName(final Container container) throws Exception {
final Set<String> containedJ2EETypes = container.getContaineeJ2EETypes();
for (final String j2eeType : containedJ2EETypes) {
final Map<String, AMX> containeeMap = container.getContaineeMap(j2eeType);
for (final String name : containeeMap.keySet()) {
final AMX containee = container.getContainee(j2eeType, name);
assert (containee != null) : "can't get containee of type " + j2eeType + ", name = " + name + " in " + Util.getObjectName(container);
assert (containee.getJ2EEType().equals(j2eeType));
assert (containee.getName().equals(name));
final Set<AMX> byName = container.getByNameContaineeSet(GSetUtil.newStringSet(j2eeType), name);
assert (byName.size() == 1);
assert (byName.iterator().next() == containee);
}
}
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class ListenerTest method testAddRemoveNotificationListener.
public void testAddRemoveNotificationListener() throws Exception {
final long start = now();
final Set<AMX> all = getAllAMX();
final NotificationListener listener1 = new DummyListener();
final NotificationListener listener2 = new DummyListener();
final NotificationFilter filter = new NotificationFilterSupport();
final Object handback = "handback";
for (final AMX amx : all) {
amx.getNotificationInfo();
amx.addNotificationListener(listener1, null, null);
amx.addNotificationListener(listener2, filter, handback);
}
for (final AMX amx : all) {
amx.removeNotificationListener(listener1);
amx.removeNotificationListener(listener2, filter, handback);
}
printElapsed("Added/removed NotificationListener", all.size(), start);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class QueryMgrTest method checkAMXWithObjectNames.
private void checkAMXWithObjectNames(final String msg, final Set<? extends AMX> set1, final Set<ObjectName> set2) {
if (set1.size() != set2.size()) {
failure(msg + "set sizes don't match: " + set1.size() + " != " + set2.size());
}
final Set<ObjectName> set1ObjectNames = new HashSet<ObjectName>();
for (final AMX item : set1) {
final ObjectName objectName = Util.getObjectName(item);
if (set1ObjectNames.contains(objectName)) {
failure("set1 contains the same proxy twice with ObjectName: " + objectName);
}
set1ObjectNames.add(objectName);
}
checkSetsEqual(msg, set1ObjectNames, set2);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class QueryMgrTest method testQueryInterfaceObjectNames.
/**
* Final all available interfaces, then for each type of interface, query
* for all items that have the interface and verify that's the interface
* they return from getInterfaceName().
*/
public void testQueryInterfaceObjectNames() throws Exception {
final long start = now();
final QueryMgr queryMgr = getQueryMgr();
final Set<AMX> allAMX = getQueryMgr().queryAllSet();
final Set<ObjectName> allAMXObjectNames = Util.toObjectNames(allAMX);
final Set<String> interfaceNames = getAllInterfaceNames(allAMX);
for (final String interfaceName : interfaceNames) {
final Set amxs = queryMgr.queryInterfaceSet(interfaceName, allAMXObjectNames);
final Iterator amxIter = amxs.iterator();
while (amxIter.hasNext()) {
final AMX amx = Util.asAMX(amxIter.next());
assert (interfaceName.equals(Util.getExtra(amx).getInterfaceName()));
}
}
printElapsed("testQueryInterfaceObjectNames", start);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class ProxyTest method testAllGetters.
public void testAllGetters() throws Exception {
final long start = now();
final Set<AMX> proxies = getAllAMX();
for (final AMX amx : proxies) {
testProxyGetters(amx);
}
printElapsed("testAllGetters", start);
}
Aggregations