KickJava   Java API By Example, From Geeks To Geeks.

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


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 package com.sun.enterprise.management.config;
24
25
26 import com.sun.appserv.management.config.AvailabilityServiceConfig;
27
28 import com.sun.enterprise.management.AMXTestBase;
29 import com.sun.enterprise.management.ClusterSupportRequired;
30
31
32 public class AvailabilityServiceConfigTest extends AMXTestBase
33     implements ClusterSupportRequired
34 {
35     public AvailabilityServiceConfigTest()
36     {
37     }
38     
39         private AvailabilityServiceConfig
40     getIt()
41     {
42         return getConfigConfig().getAvailabilityServiceConfig();
43     }
44     
45             
46     /**
47      * Test of [g/s]etAvailabilityEnabled method, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
48      */

49     public void testAvailabilityEnabled()
50     {
51         getIt().setAvailabilityEnabled(false);
52         assertFalse("getAvailabilityEnabled() was supposed to return false.", getIt().getAvailabilityEnabled());
53         getIt().setAvailabilityEnabled(true);
54         assertTrue("getAvailabilityEnabled() was supposed to return true.", getIt().getAvailabilityEnabled());
55     }
56
57     /**
58      * Test of [g/s]etAutoManageHAStore method, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
59      */

60     public void testAutoManageHAStore()
61     {
62         boolean save = getIt().getAutoManageHAStore();
63         getIt().setAutoManageHAStore(true);
64         assertTrue("getAutoManageHAStore() was supposed to return true.", getIt().getAutoManageHAStore());
65         getIt().setAutoManageHAStore(false);
66         assertFalse("getAutoManageHAStore() was supposed to return false.", getIt().getAutoManageHAStore());
67         getIt().setAutoManageHAStore(save);
68     }
69
70     /**
71      * Test of [g/s]etHAAgentHosts methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
72      */

73     public void testHAAgentHosts()
74     {
75         String JavaDoc hosts = "hp,hp,hp,hp";
76         final String JavaDoc save = getIt().getHAAgentHosts();
77         getIt().setHAAgentHosts(hosts);
78         String JavaDoc s = getIt().getHAAgentHosts();
79         assertEquals(hosts, s);
80         getIt().setHAAgentHosts( (save == null) ? "" : save);
81     }
82
83     /**
84      * Test of [g/s]etHAAgentPort methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
85      */

86     public void testHAAgentPort()
87     {
88         String JavaDoc port = "3456";
89         final String JavaDoc save = getIt().getHAAgentPort();
90         getIt().setHAAgentPort(port);
91         String JavaDoc s = getIt().getHAAgentPort();
92         assertEquals(port, s);
93         getIt().setHAAgentPort( (save == null) ? "" : save);
94     }
95
96     /**
97      * Test of [g/s]etHAStoreHealthcheckIntervalSeconds methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
98      */

99     public void testHAStoreHealthcheckIntervalSeconds()
100     {
101         String JavaDoc time = "90";
102         final String JavaDoc save = getIt().getHAStoreHealthcheckIntervalSeconds();
103         getIt().setHAStoreHealthcheckIntervalSeconds(time);
104         String JavaDoc s = getIt().getHAStoreHealthcheckIntervalSeconds();
105         assertEquals(time, s);
106         getIt().setHAStoreHealthcheckIntervalSeconds( (save == null) ? "" : save);
107     }
108
109     /**
110      * Test of [g/s]etHAStoreName methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
111      */

112     public void testHAStoreName()
113     {
114         String JavaDoc storeName = "cluster1";
115         final String JavaDoc save = getIt().getHAStoreName();
116         getIt().setHAStoreName(storeName);
117         String JavaDoc s = getIt().getHAStoreName();
118         assertEquals(storeName, s);
119         getIt().setHAStoreName( (save == null) ? "" : save);
120     }
121     
122     /**
123      * Test of [g/s]etStorePoolName methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
124      */

125     public void testStorePoolName()
126     {
127         String JavaDoc storeName = "xxxx";
128         final String JavaDoc save = getIt().getStorePoolName();
129         getIt().setStorePoolName(storeName);
130         String JavaDoc s = getIt().getStorePoolName();
131         assertEquals(storeName, s);
132         getIt().setStorePoolName( (save == null) ? "" : save);
133     }
134
135     /**
136      * Test of [g/s]etHAStoreHealthcheckEnabled methods, of class com.sun.appserv.management.config.AvailabilityServiceConfig.
137      */

138     public void testHAStoreHealthcheckEnabled()
139     {
140         final boolean save = getIt().getHAStoreHealthcheckEnabled();
141         
142         getIt().setHAStoreHealthcheckEnabled(false);
143         assertFalse("getHAStoreHealthcheckEnabled() was supposed to return false.", getIt().getHAStoreHealthcheckEnabled());
144         getIt().setHAStoreHealthcheckEnabled(true);
145         assertTrue("getHAStoreHealthcheckEnabled() was supposed to return true.", getIt().getHAStoreHealthcheckEnabled());
146         getIt().setHAStoreHealthcheckEnabled( save );
147     }
148 }
149
150
151
Popular Tags