1 23 package com.sun.enterprise.management; 24 25 import javax.management.MBeanServerInvocationHandler ; 26 import javax.management.ObjectName ; 27 28 import java.util.Set ; 29 import java.util.Map ; 30 31 import com.sun.appserv.management.base.AMX; 32 import com.sun.appserv.management.base.Util; 33 import com.sun.appserv.management.util.misc.ExceptionUtil; 34 35 import com.sun.appserv.management.config.DomainConfig; 36 import com.sun.appserv.management.config.ConfigConfig; 37 import com.sun.appserv.management.config.JavaConfig; 38 import com.sun.appserv.management.config.SecurityServiceConfig; 39 import com.sun.appserv.management.config.AdminServiceConfig; 40 41 import com.sun.appserv.management.util.misc.GSetUtil; 42 import com.sun.appserv.management.util.misc.ExceptionUtil; 43 44 import com.sun.enterprise.management.config.*; 45 import com.sun.enterprise.management.support.AMXDebugStuff; 46 import com.sun.enterprise.management.support.AMXDebugSupportMBean; 47 48 49 52 public final class RunMeFirstTest extends AMXTestBase 53 { 54 public 55 RunMeFirstTest( ) 56 { 57 initCoverageInfos(); 58 } 59 60 private void 61 initCoverageInfos() 62 { 63 final Set <AMX> all = getAllAMX(); 64 65 final String AMX_DEBUG = "-DAMX-DEBUG.enabled=true"; 67 final String AMX_DEBUG2 = "-DAMX-DEBUG=true"; 68 69 final Map <String ,ConfigConfig> configs = getDomainConfig().getConfigConfigMap(); 71 for( final ConfigConfig config : configs.values() ) 72 { 73 final JavaConfig jc = config.getJavaConfig(); 74 final Set <String > jvmOptions = GSetUtil.newStringSet( jc.getJVMOptions() ); 75 76 if ( ! ( jvmOptions.contains( AMX_DEBUG ) || jvmOptions.contains( AMX_DEBUG2 ) )) 77 { 78 jvmOptions.add( AMX_DEBUG ); 79 jc.setJVMOptions( GSetUtil.toStringArray( jvmOptions ) ); 80 81 if ( ! config.getName().equals( "default-config" ) ) 83 { 84 warning( "Enabled AMX-DEBUG for config " + config.getName()+ 85 " (restart required)" ); 86 } 87 } 88 } 89 90 final AMXDebugSupportMBean debug = getAMXDebugSupportMBean(); 92 debug.setAll( true ); 93 debug.setDefaultDebug( true ); 94 debug.getOutputIDs(); 95 96 for( final AMX amx : all ) 97 { 98 final AMXDebugStuff debugStuff = getTestUtil().asAMXDebugStuff( amx ); 99 100 if ( debugStuff == null ) 101 { 102 continue; 103 } 104 105 try 106 { 107 debugStuff.enableAMXDebug( true ); 108 } 109 catch( Throwable t ) 110 { 111 warning( "Couldn't enableAMXDebug() for " + amx.getJ2EEType() ); 112 } 113 114 try 115 { 116 debugStuff.enableCoverageInfo( true ); 117 debugStuff.clearCoverageInfo(); 118 } 119 catch( Throwable t ) 120 { 121 warning( "Couldn't enableCoverageInfo for " + amx.getJ2EEType() ); 122 } 123 } 124 } 125 } 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | Popular Tags |