Search in sources :

Example 1 with JavaConfig

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

the class JavaConfigTest method testGetJVMOptions.

public void testGetJVMOptions() {
    final JavaConfig jc = getConfigConfig().getJavaConfig();
    final String[] jvmOptions = jc.getJVMOptions();
    if (jvmOptions.length < 2) {
        warning("Fewer than 2 JVM options, is this right: " + StringUtil.toString(jvmOptions));
    }
/*
        Arrays.sort( jvmOptions );
        trace("length = " + jvmOptions.length);
        for (int ii=0; ii<jvmOptions.length; ii++)
        {
            trace("jvmOptions[" + ii + "] = " + jvmOptions[ii]);
        }
        */
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig)

Example 2 with JavaConfig

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

the class JavaConfigTest method testGetters.

public void testGetters() throws Exception {
    final JavaConfig jc = getConfigConfig().getJavaConfig();
    String s;
    s = jc.getBytecodePreprocessors();
    if (s != null) {
        jc.setBytecodePreprocessors(s);
    }
    s = jc.getClasspathPrefix();
    if (s != null) {
        jc.setClasspathPrefix(s);
    }
    s = jc.getClasspathSuffix();
    if (s != null) {
        jc.setClasspathSuffix(s);
    }
    s = jc.getSystemClasspath();
    if (s != null) {
        jc.setSystemClasspath(s);
    }
    final String debugEnabledStr = jc.getDebugEnabled();
    final boolean debugEnabled = AttributeResolverHelper.resolveBoolean(jc, debugEnabledStr);
    jc.setDebugEnabled(debugEnabledStr);
    s = jc.getDebugOptions();
    if (s != null) {
        jc.setDebugOptions(s);
    }
    final String existingValue = jc.getEnvClasspathIgnored();
    final boolean envClasspathIgnored = AttributeResolverHelper.resolveBoolean(jc, existingValue);
    jc.setEnvClasspathIgnored(existingValue);
    s = jc.getJavaHome();
    if (s != null) {
        jc.setJavaHome(s);
    }
    s = jc.getJavacOptions();
    if (s != null) {
        jc.setJavacOptions(s);
    }
    final String[] options = jc.getJVMOptions();
    if (options != null) {
        jc.setJVMOptions(options);
    }
    s = jc.getNativeLibraryPathPrefix();
    if (s != null) {
        jc.setNativeLibraryPathPrefix(s);
    }
    s = jc.getNativeLibraryPathSuffix();
    if (s != null) {
        jc.setNativeLibraryPathSuffix(s);
    }
    s = jc.getRMICOptions();
    if (s != null) {
        jc.setRMICOptions(s);
    }
    s = jc.getServerClasspath();
    if (s != null) {
        jc.setServerClasspath(s);
    }
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig)

Example 3 with JavaConfig

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

the class RunMeFirstTest method initCoverageInfos.

private void initCoverageInfos() {
    final Set<AMX> all = getAllAMX();
    // set the AMX-DEBUG flags on
    final String AMX_DEBUG = "-DAMX-DEBUG.enabled=true";
    final String AMX_DEBUG2 = "-DAMX-DEBUG=true";
    // set AMX-DEBUG.enabled=true in all ConfigConfig JVM options
    final Map<String, ConfigConfig> configs = getDomainConfig().getConfigsConfig().getConfigConfigMap();
    for (final ConfigConfig config : configs.values()) {
        final JavaConfig jc = config.getJavaConfig();
        final String[] opt = jc.getJVMOptions();
        final Set<String> jvmOptions = GSetUtil.newStringSet(opt == null ? new String[0] : opt);
        if (!(jvmOptions.contains(AMX_DEBUG) || jvmOptions.contains(AMX_DEBUG2))) {
            jvmOptions.add(AMX_DEBUG);
            jc.setJVMOptions(GSetUtil.toStringArray(jvmOptions));
            // don't warn for default-config; it's not used by a running server
            if (!config.getName().equals("default-config")) {
                warning("Enabled AMX-DEBUG for config " + config.getName() + " (restart required)");
            }
        }
    }
    // setup default stuff
    final AMXDebugSupportMBean debug = getAMXDebugSupportMBean();
    debug.setAll(true);
    debug.setDefaultDebug(true);
    debug.getOutputIDs();
    for (final AMX amx : all) {
        final AMXDebugStuff debugStuff = getTestUtil().asAMXDebugStuff(amx);
        if (debugStuff == null) {
            continue;
        }
        try {
            debugStuff.enableAMXDebug(true);
        } catch (Throwable t) {
            warning("Couldn't enableAMXDebug() for " + amx.getJ2EEType());
        }
        try {
            debugStuff.enableCoverageInfo(true);
            debugStuff.clearCoverageInfo();
        } catch (Throwable t) {
            warning("Couldn't enableCoverageInfo for " + amx.getJ2EEType());
        }
    }
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig) AMXDebugSupportMBean(com.sun.appserv.management.base.AMXDebugSupportMBean) AMXDebugStuff(org.glassfish.admin.amx.util.AMXDebugStuff) ConfigConfig(com.sun.appserv.management.config.ConfigConfig) AMX(com.sun.appserv.management.base.AMX)

Example 4 with JavaConfig

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

the class ProfilerConfigTest method testCreateRemoveProfiler.

public synchronized void testCreateRemoveProfiler() throws Exception {
    if (checkNotOffline("testIllegalCreate")) {
        ensureDefaultInstance(getConfigConfig().getJavaConfig());
        final JavaConfig javaConfig = getConfigConfig().getJavaConfig();
        javaConfig.removeProfilerConfig();
        assert javaConfig.getProfilerConfig() == null : "Can't remove ProfilerConfig from " + JMXUtil.toString(Util.getObjectName(javaConfig));
        ensureDefaultInstance(javaConfig);
        assert javaConfig.getProfilerConfig() != null;
        Util.getExtra(javaConfig.getProfilerConfig()).getMBeanInfo();
        testGetters(javaConfig.getProfilerConfig());
        javaConfig.removeProfilerConfig();
        ensureDefaultInstance(javaConfig);
        assert javaConfig.getProfilerConfig() != null;
        Util.getExtra(javaConfig.getProfilerConfig()).getMBeanInfo();
        testGetters(javaConfig.getProfilerConfig());
    }
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig)

Example 5 with JavaConfig

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

the class JavaConfigTest method testSetJVMOptions.

public void testSetJVMOptions() {
    final String newOption1 = "-DJavaConfigTest.OK=true";
    final String newOption2 = "-XJavaConfigTest.OK=true";
    final JavaConfig jc = getConfigConfig().getJavaConfig();
    final Set<String> beforeSet = GSetUtil.newUnmodifiableStringSet(jc.getJVMOptions());
    // add our new options
    final Set<String> requestSet = new HashSet<String>(beforeSet);
    requestSet.add(newOption1);
    requestSet.add(newOption2);
    jc.setJVMOptions(GSetUtil.toStringArray(requestSet));
    Set<String> afterSet = GSetUtil.newUnmodifiableStringSet(jc.getJVMOptions());
    // make sure our new options are present
    assert (afterSet.contains(newOption1));
    assert (afterSet.contains(newOption2));
    // make sure all prior options are still present
    for (final String beforeOption : beforeSet) {
        assert (afterSet.contains(beforeOption));
    }
    // now remove our two options
    requestSet.remove(newOption1);
    requestSet.remove(newOption2);
    jc.setJVMOptions(GSetUtil.toStringArray(requestSet));
    // verify our two options are gone
    afterSet = GSetUtil.newUnmodifiableStringSet(jc.getJVMOptions());
    assert (!afterSet.contains(newOption1));
    assert (!afterSet.contains(newOption2));
    // make sure all prior options are still present
    assert (afterSet.equals(beforeSet));
}
Also used : JavaConfig(com.sun.appserv.management.config.JavaConfig) HashSet(java.util.HashSet)

Aggregations

JavaConfig (com.sun.appserv.management.config.JavaConfig)5 AMX (com.sun.appserv.management.base.AMX)1 AMXDebugSupportMBean (com.sun.appserv.management.base.AMXDebugSupportMBean)1 ConfigConfig (com.sun.appserv.management.config.ConfigConfig)1 HashSet (java.util.HashSet)1 AMXDebugStuff (org.glassfish.admin.amx.util.AMXDebugStuff)1