1 23 24 package com.sun.enterprise.management.config; 25 26 import java.util.Collections ; 27 import java.util.Map ; 28 29 import com.sun.appserv.management.base.Container; 30 import com.sun.appserv.management.base.XTypes; 31 import com.sun.appserv.management.config.AMXConfig; 32 import com.sun.appserv.management.config.DomainConfig; 33 import com.sun.appserv.management.config.AdminObjectResourceConfig; 34 35 37 public final class AdminObjectResourceConfigTest extends ResourceConfigTestBase 38 { 39 private static final String ADM_OBJ_RES_TYPE = "user"; 40 private static final String ADM_OBJ_RES_ADAPTER = "cciblackbox-tx"; 41 42 43 public AdminObjectResourceConfigTest() 44 { 45 if ( checkNotOffline( "ensureDefaultInstance" ) ) 46 { 47 ensureDefaultInstance( getDomainConfig() ); 48 } 49 } 50 51 public static String 52 getDefaultInstanceName() 53 { 54 return getDefaultInstanceName( "AdminObjectResourceConfig" ); 55 } 56 57 public static AdminObjectResourceConfig 58 ensureDefaultInstance( final DomainConfig domainConfig ) 59 { 60 AdminObjectResourceConfig result = 61 domainConfig.getAdminObjectResourceConfigMap().get( getDefaultInstanceName() ); 62 63 if ( result == null ) 64 { 65 result = createInstance( 66 domainConfig, 67 getDefaultInstanceName(), 68 ADM_OBJ_RES_TYPE, 69 ADM_OBJ_RES_ADAPTER, 70 null ); 71 } 72 73 return result; 74 } 75 76 public static AdminObjectResourceConfig 77 createInstance( 78 final DomainConfig domainConfig, 79 final String name, 80 final String resType, 81 final String resAdapter, 82 final Map <String ,String > optional ) 83 { 84 return domainConfig.createAdminObjectResourceConfig( name, 85 resType, resAdapter, optional ); 86 } 87 88 89 90 protected Container 91 getProgenyContainer() 92 { 93 return getDomainConfig(); 94 } 95 96 protected String 97 getProgenyJ2EEType() 98 { 99 return XTypes.ADMIN_OBJECT_RESOURCE_CONFIG; 100 } 101 102 103 protected void 104 removeProgeny( final String name ) 105 { 106 getDomainConfig().removeAdminObjectResourceConfig( name ); 107 } 108 109 protected String 110 getProgenyTestName() 111 { 112 return( "jndi/AdminObjectResourceConfigMgrTest" ); 113 } 114 115 protected final AMXConfig 116 createProgeny(final String name, final Map <String ,String > options ) 117 { 118 final AdminObjectResourceConfig config = getDomainConfig().createAdminObjectResourceConfig( 119 name, 120 ADM_OBJ_RES_TYPE, 121 ADM_OBJ_RES_ADAPTER, 122 options); 123 124 addReference( config ); 125 126 return( config ); 127 } 128 } 129 130 131 | Popular Tags |