1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 27 import com.sun.appserv.management.base.Container; 28 import com.sun.appserv.management.base.XTypes; 29 30 import com.sun.appserv.management.config.AMXConfig; 31 import com.sun.appserv.management.config.ClusterConfig; 32 import com.sun.appserv.management.config.DomainConfig; 33 34 35 import com.sun.enterprise.management.AMXTestBase; 36 import com.sun.enterprise.management.Capabilities; 37 import com.sun.enterprise.management.ClusterSupportRequired; 38 39 42 public final class ClusterConfigTest extends ConfigMgrTestBase 43 implements ClusterSupportRequired 44 { 45 public 46 ClusterConfigTest () 47 { 48 if ( checkNotOffline( "ensureDefaultInstance" ) ) 49 { 50 ensureDefaultInstance( getDomainConfig() ); 51 } 52 } 53 54 public static String 55 getDefaultInstanceName() 56 { 57 return getDefaultInstanceName( "test-cluster" ); 58 } 59 60 public static ClusterConfig 61 ensureDefaultInstance( final DomainConfig domainConfig ) 62 { 63 ClusterConfig result = 64 domainConfig.getClusterConfigMap().get( getDefaultInstanceName() ); 65 66 if ( result == null ) 67 { 68 result = domainConfig.createClusterConfig( 69 getDefaultInstanceName(), null, null ); 70 } 71 72 return result; 73 } 74 75 protected Container 76 getProgenyContainer() 77 { 78 return getDomainConfig(); 79 } 80 81 protected String 82 getProgenyJ2EEType() 83 { 84 return XTypes.CLUSTER_CONFIG; 85 } 86 87 88 protected void 89 removeProgeny( final String name ) 90 { 91 getDomainConfig().removeClusterConfig( name ); 92 } 93 94 95 protected final AMXConfig 96 createProgeny( 97 final String name, 98 final Map <String ,String > options ) 99 { 100 assert( name != null && name.length() >= 1 ); 101 return getDomainConfig().createClusterConfig( name, null, options ); 102 } 103 104 public void 105 testCreateWithIllegalConfig() 106 { 107 try 108 { 109 getDomainConfig().createClusterConfig( "dummy-cluster-1", "no such config", null ); 110 failure( "expecting failure creating cluster with illegal config name" ); 111 112 getDomainConfig().createClusterConfig( "dummy-cluster-2", "server-config", null ); 113 failure( "expecting failure creating cluster with name 'server-config'" ); 114 115 getDomainConfig().createClusterConfig( "dummy-cluster-2", "default-config", null ); 116 failure( "expecting failure creating name 'default-config'" ); 117 } 118 catch( Exception e ) 119 { 120 } 122 } 123 } 124 125 126 127 128 129 130 131 132 | Popular Tags |