use of com.sun.appserv.management.base.QueryMgr in project Payara by payara.
the class NotificationServiceTest method testListen.
public void testListen() throws Exception {
// trace( "testListen: START" );
final NotificationService proxy = create();
final QueryMgr queryMgr = getQueryMgr();
final ObjectName objectName = Util.getObjectName(queryMgr);
final Object id = proxy.createBuffer(10, null);
final NotificationServiceHelper helper = new NotificationServiceHelper(proxy, id);
proxy.listenTo(objectName, null);
assert (proxy.getListeneeSet().size() == 1);
assert (Util.getObjectName((Util.asAMX(proxy.getListeneeSet().iterator().next()))).equals(objectName));
// trace( "testListen: NEWING" );
// we expect two changes, see below
final MyListener myListener = new MyListener(2);
proxy.addNotificationListener(myListener, null, null);
final String saveLevel = queryMgr.getMBeanLogLevel();
queryMgr.setMBeanLogLevel("" + Level.FINEST);
queryMgr.setMBeanLogLevel(saveLevel);
// delivery may be asynchronous; wait until done
if (!myListener.await(5, TimeUnit.SECONDS)) {
// trace( "testListen: FAILED TIMEOUT" );
assert false : "NotificationServiceTest.testListen(): TIMED OUT waiting for Notifications";
}
// trace( "testListen: NOT FAILED" );
assert (myListener.getCount() == 2);
Notification[] notifs = helper.getNotifications();
assertEquals(2, notifs.length);
assert (notifs[0].getType().equals(AttributeChangeNotification.ATTRIBUTE_CHANGE));
assert (notifs[1].getType().equals(AttributeChangeNotification.ATTRIBUTE_CHANGE));
notifs = helper.getNotifications();
assert (notifs.length == 0);
proxy.dontListenTo(objectName);
assert (proxy.getListeneeSet().size() == 0);
removeNotificationService(proxy);
// trace( "testListen: EXIT" );
}
use of com.sun.appserv.management.base.QueryMgr 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.QueryMgr in project Payara by payara.
the class PerformanceTest method xtestQueryMgr.
public synchronized void xtestQueryMgr() throws IllegalAccessException, InvocationTargetException {
final DomainRoot domainRoot = getDomainRoot();
final QueryMgr queryMgr = domainRoot.getQueryMgr();
final String domain = Util.getObjectName(queryMgr).getDomain();
printPerf("-- QueryMgr --- ");
testMethod(domainRoot, "getQueryMgr", null, 1000);
final int ITER = 20;
testMethod(queryMgr, "queryAllSet", null, ITER);
testMethod(queryMgr, "querySingletonJ2EEType", new Object[] { XTypes.BULK_ACCESS }, ITER);
testMethod(queryMgr, "queryJ2EETypeSet", new Object[] { XTypes.SSL_CONFIG }, ITER);
testMethod(queryMgr, "queryJ2EENameSet", new Object[] { "server" }, ITER);
testMethod(queryMgr, "queryJ2EETypeNames", new Object[] { XTypes.CONFIG_CONFIG }, ITER);
testMethod(queryMgr, "queryPatternSet", new Object[] { domain, "j2eeType=" + XTypes.SERVLET_MONITOR }, ITER);
testMethod(queryMgr, "queryInterfaceSet", new Object[] { SSLConfig.class.getName(), null }, ITER);
}
use of com.sun.appserv.management.base.QueryMgr in project Payara by payara.
the class ProxyTest method testQueryMgr.
public void testQueryMgr() throws Exception {
final QueryMgr proxy = (QueryMgr) getQueryMgr();
Util.getObjectName(proxy);
proxy.getContainer();
proxy.getDomainRoot();
}
use of com.sun.appserv.management.base.QueryMgr in project Payara by payara.
the class SSLConfigTest method testGetAttrs.
public void testGetAttrs() {
final QueryMgr queryMgr = getQueryMgr();
final String props = Util.makeJ2EETypeProp(XTypes.SSL_CONFIG);
final Set sslConfigs = queryMgr.queryPropsSet(props);
final Iterator iter = sslConfigs.iterator();
while (iter.hasNext()) {
final SSLConfig ssl = (SSLConfig) iter.next();
ssl.getCertNickname();
ssl.getClientAuthEnabled();
ssl.getSSL2Enabled();
ssl.getSSL2Ciphers();
ssl.getSSL3Enabled();
ssl.getSSL3TLSCiphers();
ssl.getTLSEnabled();
ssl.getTLSRollbackEnabled();
}
}
Aggregations