1 23 24 package com.sun.enterprise.management.ext.logging; 25 26 import java.util.Set ; 27 28 import com.sun.appserv.management.base.XTypes; 29 30 import com.sun.appserv.management.helper.StatefulLoggingHelper; 31 32 import com.sun.appserv.management.ext.logging.Logging; 33 import static com.sun.appserv.management.ext.logging.Logging.*; 34 import com.sun.appserv.management.ext.logging.LogQueryResult; 35 36 37 import com.sun.enterprise.management.AMXTestBase; 38 import com.sun.enterprise.management.Capabilities; 39 40 41 44 public final class StatefulLoggingHelperTest extends AMXTestBase 45 { 46 public 47 StatefulLoggingHelperTest( ) 48 { 49 } 50 51 final Set <Logging> 52 getAllLogging() 53 { 54 return getQueryMgr().queryJ2EETypeSet( XTypes.LOGGING ); 55 } 56 57 public StatefulLoggingHelper 58 createHelper( final Logging logging ) 59 { 60 return new StatefulLoggingHelper( logging ); 61 } 62 63 public void 64 testCreate() 65 { 66 final Set <Logging> loggings = getAllLogging(); 67 68 for( final Logging logging : loggings ) 69 { 70 assert( createHelper(logging) != null ); 71 } 72 } 73 74 private void 75 validateResult( final LogQueryResult result ) 76 { 77 assert( result != null ); 78 assert( result.getFieldNames() != null ); 79 assert( result.getEntries() != null ); 80 } 81 82 83 public void 84 testQuery() 85 { 86 final long start = now(); 87 88 final Set <Logging> loggings = getAllLogging(); 89 90 for( final Logging logging : loggings ) 91 { 92 assert( logging != null ); 93 final StatefulLoggingHelper helper = createHelper(logging); 94 95 final LogQueryResult result = helper.query(); 96 validateResult( result ); 97 } 98 99 printElapsed( "testQuery", start); 100 } 101 102 } 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | Popular Tags |