KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > ResourceAdapterConfigTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /*
25  * $Header: /cvs/glassfish/admin/mbeanapi-impl/tests/com/sun/enterprise/management/config/ResourceAdapterConfigTest.java,v 1.4 2005/12/25 03:41:41 tcfujii Exp $
26  * $Revision: 1.4 $
27  * $Date: 2005/12/25 03:41:41 $
28  */

29 package com.sun.enterprise.management.config;
30
31
32 import com.sun.appserv.management.config.DomainConfig;
33 import com.sun.appserv.management.config.ResourceAdapterConfig;
34
35
36 import com.sun.enterprise.management.AMXTestBase;
37 import com.sun.enterprise.management.Capabilities;
38
39
40 /**
41  */

42 public final class ResourceAdapterConfigTest extends AMXTestBase
43 {
44         public
45     ResourceAdapterConfigTest()
46     {
47         if ( checkNotOffline( "ensureDefaultInstance" ) )
48         {
49             ensureDefaultInstance( getDomainConfig() );
50         }
51     }
52     
53         public static String JavaDoc
54     getDefaultInstanceName()
55     {
56         return getDefaultInstanceName( "ResourceAdapterConfig" );
57     }
58     
59         public static ResourceAdapterConfig
60     ensureDefaultInstance( final DomainConfig domainConfig )
61     {
62         ResourceAdapterConfig result =
63             domainConfig.getResourceAdapterConfigMap().get( getDefaultInstanceName() );
64         
65         if ( result == null )
66         {
67             result = createInstance( domainConfig, getDefaultInstanceName() );
68         }
69         
70         return result;
71     }
72     
73         public static ResourceAdapterConfig
74     createInstance(
75         final DomainConfig domainConfig,
76         final String JavaDoc name )
77     {
78         final ResourceAdapterConfig rac =
79             domainConfig.createResourceAdapterConfig( name, null );
80         
81         return rac;
82     }
83     
84         private void
85     testGetters( final ResourceAdapterConfig resAdapterConfig )
86     {
87         resAdapterConfig.getResourceAdapterName();
88         resAdapterConfig.getThreadPoolIDs();
89     }
90     
91         public void
92     testCreateRemove()
93     {
94         if ( checkNotOffline( "testCreateSSL" ) )
95         {
96             final ResourceAdapterConfig resAdapterConfig =
97                 createInstance( getDomainConfig(),
98                     "ResourceAdapterConfigTest.testCreateRemove" );
99
100             try
101             {
102                 testGetters( resAdapterConfig );
103             }
104             finally
105             {
106                 getDomainConfig().removeResourceAdapterConfig( resAdapterConfig.getName() );
107             }
108         }
109     }
110     
111 }
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Popular Tags