1 23 24 29 package com.sun.enterprise.management.config; 30 31 import java.util.Collections ; 32 import java.util.Map ; 33 34 import com.sun.appserv.management.base.Container; 35 import com.sun.appserv.management.base.XTypes; 36 37 import com.sun.appserv.management.config.AMXConfig; 38 import com.sun.appserv.management.config.DomainConfig; 39 import com.sun.appserv.management.config.MailResourceConfig; 40 import com.sun.appserv.management.config.SecurityServiceConfig; 41 42 43 44 46 public final class MailResourceConfigTest extends ResourceConfigTestBase 47 { 48 private static final String MAIL_RESOURCE_HOST = "localhost"; 49 private static final String MAIL_RESOURCE_USER = "someone"; 50 private static final String MAIL_RESOURCE_FROM = "someone@somewhere.com"; 51 52 public MailResourceConfigTest() 53 { 54 if ( checkNotOffline( "ensureDefaultInstance" ) ) 55 { 56 ensureDefaultInstance( getDomainConfig() ); 57 } 58 } 59 60 public static String 61 getDefaultInstanceName() 62 { 63 return getDefaultInstanceName( "MailResourceConfig" ); 64 } 65 66 public static MailResourceConfig 67 ensureDefaultInstance( final DomainConfig dc ) 68 { 69 MailResourceConfig result = dc.getMailResourceConfigMap().get( getDefaultInstanceName() ); 70 71 if ( result == null ) 72 { 73 result = createInstance( dc, getDefaultInstanceName(), 74 MAIL_RESOURCE_HOST, MAIL_RESOURCE_USER, MAIL_RESOURCE_FROM, null); 75 } 76 77 return result; 78 } 79 80 public static MailResourceConfig 81 createInstance( 82 final DomainConfig ss, 83 final String name, 84 final String host, 85 final String user, 86 final String from, 87 Map <String ,String > optional) 88 { 89 return ss.createMailResourceConfig( name, host, user, from, optional ); 90 } 91 92 protected String 93 getProgenyTestName() 94 { 95 return( "jndi/MailResourceConfigMgrTest" ); 96 } 97 98 protected Container 99 getProgenyContainer() 100 { 101 return getDomainConfig(); 102 } 103 104 protected String 105 getProgenyJ2EEType() 106 { 107 return XTypes.MAIL_RESOURCE_CONFIG; 108 } 109 110 111 protected void 112 removeProgeny( final String name ) 113 { 114 getDomainConfig().removeMailResourceConfig( name ); 115 } 116 117 protected final AMXConfig 118 createProgeny( final String name, final Map <String ,String > options ) 119 { 120 final MailResourceConfig config = 121 getDomainConfig().createMailResourceConfig( name, 122 MAIL_RESOURCE_HOST, 123 MAIL_RESOURCE_USER, 124 MAIL_RESOURCE_FROM, 125 options); 126 assert( config != null ); 127 return( config ); 128 } 129 130 } 131 132 133 | Popular Tags |