Search in sources :

Example 1 with DomainConfig

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

the class PerformanceTest method xtestDomainConfig.

/*
         public synchronized void
     testTargets()
         throws IllegalAccessException, InvocationTargetException
     {
         DomainConfig domainConfig = getDomainRoot().getDomainConfig();

         final long	start	= now();

         final int	ITER	= 100;
         for( int i = 0; i < ITER; ++i )
         {
             final Mapxxx servers	= domainConfig.getStandaloneServerConfigMap();
             final Mapxxx clusters	= domainConfig.getClusterConfigMap();

             final String[] serverNames	= GSetUtil.toStringArray( servers.keySet() );
             final String[] clusterNames	= GSetUtil.toStringArray( clusters.keySet() );
         }

         final long	elapsed	= now() - start;
         printPerf( "testTargets: " + ITER + " iterations: " + elapsed);
     }
     */
public synchronized void xtestDomainConfig() throws IllegalAccessException, InvocationTargetException {
    final DomainRoot domainRoot = getDomainRoot();
    final DomainConfig domainConfig = domainRoot.getDomainConfig();
    printPerf("-- DomainConfig --- ");
    final int ITER = 20;
    testMethod(domainConfig, "getNodeAgentConfigMap", null, ITER);
    testMethod(domainConfig, "getConfigConfigMap", null, ITER);
    testMethod(domainConfig, "getStandaloneServerConfigMap", null, ITER);
    testMethod(domainConfig, "getClusteredServerConfigMap", null, ITER);
    testMethod(domainConfig, "getServerConfigMap", null, ITER);
    testMethod(domainConfig, "getClusterConfigMap", null, ITER);
    testMethod(domainConfig, "getCustomResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getJNDIResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getPersistenceManagerFactoryResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getJDBCResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getJDBCConnectionPoolConfigMap", null, ITER);
    testMethod(domainConfig, "getConnectorResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getConnectorConnectionPoolConfigMap", null, ITER);
    testMethod(domainConfig, "getAdminObjectResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getResourceAdapterConfigMap", null, ITER);
    testMethod(domainConfig, "getMailResourceConfigMap", null, ITER);
    testMethod(domainConfig, "getJ2EEApplicationConfigMap", null, ITER);
    testMethod(domainConfig, "getEJBModuleConfigMap", null, ITER);
    testMethod(domainConfig, "getWebModuleConfigMap", null, ITER);
    testMethod(domainConfig, "getRARModuleConfigMap", null, ITER);
    testMethod(domainConfig, "getAppClientModuleConfigMap", null, ITER);
    testMethod(domainConfig, "getLifecycleModuleConfigMap", null, ITER);
}
Also used : DomainRoot(com.sun.appserv.management.DomainRoot) DomainConfig(com.sun.appserv.management.config.DomainConfig)

Example 2 with DomainConfig

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

the class ClusteredServerConfigTest method createClusteredServer.

public ClusteredServerConfig createClusteredServer(final String serverName, final String nodeAgentName, final int basePort) {
    final DomainConfig domainConfig = getDomainConfig();
    if (domainConfig.getServersConfig().getClusteredServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeClusteredServerConfig(serverName);
    } else if (domainConfig.getServersConfig().getStandaloneServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeStandaloneServerConfig(serverName);
    }
    final ClusterConfig clusterConfig = ClusterConfigTest.ensureDefaultInstance(domainConfig);
    if (domainConfig.getServersConfig().getClusteredServerConfigMap().get(serverName) != null) {
        domainConfig.getServersConfig().removeClusteredServerConfig(serverName);
        assert domainConfig.getServersConfig().getClusteredServerConfigMap().get(serverName) == null;
    }
    final ConfigSetup setup = new ConfigSetup(getDomainRoot());
    final Map<String, String> options = new HashMap<String, String>();
    setup.setupServerPorts(options, basePort);
    final ClusteredServerConfig csc = domainConfig.getServersConfig().createClusteredServerConfig(serverName, clusterConfig.getName(), nodeAgentName, options);
    sanityCheck(csc);
    return csc;
}
Also used : HashMap(java.util.HashMap) ClusteredServerConfig(com.sun.appserv.management.config.ClusteredServerConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig) ClusterConfig(com.sun.appserv.management.config.ClusterConfig)

Example 3 with DomainConfig

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

the class ClusteredServerConfigTest method testCreateRemove.

public void testCreateRemove() {
    final DomainConfig domainConfig = getDomainConfig();
    final NodeAgentConfig nodeAgentConfig = getDASNodeAgentConfig();
    if (nodeAgentConfig == null) {
        warning("SKIPPING ClusteredServerConfigTest.testCreateRemove: " + "no DAS Node Agent has been specified; use " + PropertyKeys.DAS_NODE_AGENT_NAME);
    } else {
        final int NUM = 5;
        final String baseName = "ClusteredServerConfigTest";
        verifyRefContainers();
        final ClusteredServerConfig[] servers = new ClusteredServerConfig[NUM];
        for (int i = 0; i < NUM; ++i) {
            final int basePort = 11000 + i * 10;
            servers[i] = createClusteredServer(baseName + "-" + i, nodeAgentConfig.getName(), basePort);
            printVerbose("Created ClusteredServerConfig: " + servers[i].getName());
            assert XTypes.CLUSTERED_SERVER_CONFIG.equals(servers[i].getJ2EEType());
            verifyRefContainers();
        }
        for (int i = 0; i < NUM; ++i) {
            final String name = servers[i].getName();
            domainConfig.getServersConfig().removeClusteredServerConfig(name);
            printVerbose("Removed ClusteredServerConfig: " + name);
        }
    }
}
Also used : NodeAgentConfig(com.sun.appserv.management.config.NodeAgentConfig) ClusteredServerConfig(com.sun.appserv.management.config.ClusteredServerConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig)

Example 4 with DomainConfig

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

the class CustomMBeanConfigTest method testCreateRemove.

public synchronized void testCreateRemove() {
    if (!checkNotOffline("testCreateRemove")) {
        return;
    }
    final DomainConfig domainConfig = getDomainConfig();
    final Map<String, String> optional = createProps();
    final Set<CustomMBeanConfig> created = new HashSet<CustomMBeanConfig>();
    final Map<String, CustomMBeanConfig> existing = getDomainConfig().getResourcesConfig().getCustomMBeanConfigMap();
    unregisterAnyTestMBeans();
    final Set<ObjectName> customsBefore = getRegisteredCustoms();
    if (customsBefore.size() != 0) {
        printVerbose("custom MBeans already registered:\n" + CollectionUtil.toString(customsBefore, "\n"));
    }
    final int NUM = 3;
    for (int i = 0; i < NUM; ++i) {
        final String testName = TEST_NAME_BASE + i;
        if (existing.containsKey(testName)) {
            RefHelper.removeAllRefsTo(existing.get(testName), true);
            // leftover from a failed test...
            removeCustomMBean(testName);
        }
        final CustomMBeanConfig config = create(domainConfig, TEST_NAME_BASE + i, optional);
        assert (getCustomMBeanConfigs().get(config.getName()) == config);
        created.add(config);
        sanityCheck(config);
        verifyPropsAdded(config, optional);
    }
    _testGetAll();
    _testAttrs();
    for (final CustomMBeanConfig config : created) {
        // printVerbose( "removing: " + Util.getObjectName( config ) );
        final String name = config.getName();
        removeCustomMBean(name);
        assert (getCustomMBeanConfigs().get(name) == null);
    }
    _testGetAll();
    mySleep(100);
    final Set<ObjectName> customsAfter = getRegisteredCustoms();
    customsAfter.removeAll(customsBefore);
    if (customsAfter.size() != 0) {
        warning("after removing custom MBeans, " + "they are still registered (not an AMX bug):\n" + CollectionUtil.toString(customsAfter, "\n"));
    }
    unregisterAnyTestMBeans();
}
Also used : CustomMBeanConfig(com.sun.appserv.management.config.CustomMBeanConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig) HashSet(java.util.HashSet) ObjectName(javax.management.ObjectName)

Example 5 with DomainConfig

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

the class DanglingRefsTest method _testDanglingResourceRefConfigs.

private void _testDanglingResourceRefConfigs() throws ClassNotFoundException {
    final DomainConfig domainConfig = getDomainConfig();
    final Set<ResourceConfig> resourcesSet = getQueryMgr().queryInterfaceSet(ResourceConfig.class.getName(), null);
    final Set<ResourceRefConfig> refs = RefHelper.findAllResourceRefConfigs(getQueryMgr());
    final Map<String, ResourceConfig> resourcesMap = Util.createNameMap(resourcesSet);
    for (final ResourceRefConfig ref : refs) {
        final String name = ref.getName();
        final ResourceConfig resourceConfig = resourcesMap.get(name);
        if (resourceConfig == null) {
            String msg = "Resource reference '" + Util.getObjectName(ref) + "' refers to a non-existent resource";
            boolean removedOK = false;
            try {
                final ResourceRefConfigCR container = (ResourceRefConfigCR) ref.getContainer();
                container.removeResourceRefConfig(name);
                removedOK = true;
            } catch (Exception e) {
                msg = msg + ", and trying to remove it throws an Exception " + "(remove it manually from domain.xml)" + ", see bug #6298512";
            }
            if (!removedOK) {
                warning(msg);
            }
        } else {
        // printVerbose( "ResourceRefConfig '" + name + "' is OK" );
        }
    }
}
Also used : ResourceRefConfigCR(com.sun.appserv.management.config.ResourceRefConfigCR) ResourceConfig(com.sun.appserv.management.config.ResourceConfig) ResourceRefConfig(com.sun.appserv.management.config.ResourceRefConfig) DomainConfig(com.sun.appserv.management.config.DomainConfig)

Aggregations

DomainConfig (com.sun.appserv.management.config.DomainConfig)12 AMX (com.sun.appserv.management.base.AMX)2 ClusteredServerConfig (com.sun.appserv.management.config.ClusteredServerConfig)2 ConfigConfig (com.sun.appserv.management.config.ConfigConfig)2 DomainRoot (com.sun.appserv.management.DomainRoot)1 AdminServiceConfig (com.sun.appserv.management.config.AdminServiceConfig)1 ClusterConfig (com.sun.appserv.management.config.ClusterConfig)1 CustomMBeanConfig (com.sun.appserv.management.config.CustomMBeanConfig)1 NodeAgentConfig (com.sun.appserv.management.config.NodeAgentConfig)1 ResourceConfig (com.sun.appserv.management.config.ResourceConfig)1 ResourceRefConfig (com.sun.appserv.management.config.ResourceRefConfig)1 ResourceRefConfigCR (com.sun.appserv.management.config.ResourceRefConfigCR)1 SecurityServiceConfig (com.sun.appserv.management.config.SecurityServiceConfig)1 StandaloneServerConfig (com.sun.appserv.management.config.StandaloneServerConfig)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Set (java.util.Set)1 ObjectName (javax.management.ObjectName)1