Search in sources :

Example 6 with DomainRoot

use of com.sun.appserv.management.DomainRoot in project Payara by payara.

the class ContainerTest method checkContainerContainsChild.

public void checkContainerContainsChild(final ObjectName containeeObjectName) throws Exception {
    final MBeanServerConnection conn = getMBeanServerConnection();
    assert (containeeObjectName != null);
    assert (conn.isRegistered(containeeObjectName));
    final AMX containedProxy = getProxyFactory().getProxy(containeeObjectName, AMX.class);
    if (containedProxy instanceof DomainRoot) {
        // DomainRoot has no Container
        return;
    }
    final ObjectName containerObjectName = (ObjectName) conn.getAttribute(containeeObjectName, "ContainerObjectName");
    if (!conn.isRegistered(containerObjectName)) {
        warning("Container " + StringUtil.quote(containerObjectName) + " for " + StringUtil.quote(containeeObjectName) + " is not registered.");
        return;
    }
    final AMX parentProxy = containedProxy.getContainer();
    if (parentProxy instanceof Container) {
        if (!(parentProxy instanceof Container)) {
            trace("WARNING: proxy is instance of Container, but not Container: " + Util.getExtra(parentProxy).getObjectName());
        } else {
            final Container container = (Container) parentProxy;
            if (container != null) {
                final Set<AMX> containees = container.getContaineeSet();
                final Set<ObjectName> containeeObjectNames = Util.toObjectNames(containees);
                if (!containeeObjectNames.contains(Util.getExtra(containedProxy).getObjectName())) {
                    trace("ERROR: Container " + Util.getExtra(parentProxy).getObjectName() + " does not contain its child: " + containeeObjectName);
                    assertTrue(false);
                }
            }
        }
    }
}
Also used : Container(com.sun.appserv.management.base.Container) DomainRoot(com.sun.appserv.management.DomainRoot) AMX(com.sun.appserv.management.base.AMX) MBeanServerConnection(javax.management.MBeanServerConnection) ObjectName(javax.management.ObjectName)

Example 7 with DomainRoot

use of com.sun.appserv.management.DomainRoot in project Payara by payara.

the class TestMain method initOffline.

private static DomainRoot initOffline(final File domainXML) {
    final MBeanServer server = MBeanServerFactory.createMBeanServer("test");
    assert (domainXML.exists() && domainXML.length() != 0);
    final OfflineConfigIniter initer = new OfflineConfigIniter(server, domainXML);
    final DomainRoot domainRoot = initer.getDomainRoot();
    return domainRoot;
}
Also used : OfflineConfigIniter(com.sun.appserv.management.config.OfflineConfigIniter) DomainRoot(com.sun.appserv.management.DomainRoot) MBeanServer(javax.management.MBeanServer)

Aggregations

DomainRoot (com.sun.appserv.management.DomainRoot)7 MBeanServerConnection (javax.management.MBeanServerConnection)2 AMX (com.sun.appserv.management.base.AMX)1 Container (com.sun.appserv.management.base.Container)1 QueryMgr (com.sun.appserv.management.base.QueryMgr)1 DomainConfig (com.sun.appserv.management.config.DomainConfig)1 OfflineConfigIniter (com.sun.appserv.management.config.OfflineConfigIniter)1 SSLConfig (com.sun.appserv.management.config.SSLConfig)1 MBeanServer (javax.management.MBeanServer)1 ObjectName (javax.management.ObjectName)1