KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.logging.Level JavaDoc;
26
27 import com.sun.appserv.management.config.ConfigConfig;
28 import com.sun.appserv.management.config.DiagnosticServiceConfig;
29
30 import com.sun.enterprise.management.AMXTestBase;
31
32 /**
33  */

34 public final class DiagnosticServiceConfigTest extends AMXTestBase
35 {
36     public DiagnosticServiceConfigTest()
37     {
38     }
39     
40         public void
41     testCreateRemove()
42     {
43         final ConfigConfig config = getConfigConfig();
44         
45         // set defaults
46
boolean computeChecksum = true;
47         boolean captureInstallLog = true;
48         boolean captureSystemInfo = true;
49         boolean captureHADBInfo = true;
50         boolean captureAppDD = true;
51         boolean verifyConfig = true;
52         String JavaDoc minLogLevel = Level.INFO.toString();
53         String JavaDoc maxLongEntries = "10000";
54         
55         DiagnosticServiceConfig ds = config.getDiagnosticServiceConfig();
56         if ( ds != null )
57         {
58             // remember current settings
59
computeChecksum = ds.getComputeChecksum();
60             captureInstallLog = ds.getCaptureInstallLog();
61             captureSystemInfo = ds.getCaptureSystemInfo();
62             captureHADBInfo = ds.getCaptureHADBInfo();
63             captureAppDD = ds.getCaptureAppDD();
64             verifyConfig = ds.getVerifyConfig();
65             minLogLevel = ds.getMinLogLevel();
66             maxLongEntries = ds.getMaxLogEntries();
67             
68             config.removeDiagnosticServiceConfig();
69             ds = null;
70         }
71         
72         ds = config.createDiagnosticServiceConfig();
73         config.removeDiagnosticServiceConfig(); ds = null;
74         
75         // re-create it so one stays around
76
ds = config.createDiagnosticServiceConfig();
77         ds.setComputeChecksum( computeChecksum );
78         ds.setCaptureInstallLog( captureInstallLog);
79         ds.setCaptureSystemInfo( captureSystemInfo );
80         ds.setCaptureHADBInfo( captureHADBInfo );
81         ds.setCaptureAppDD( captureAppDD );
82         ds.setVerifyConfig( verifyConfig );
83         ds.setMinLogLevel( minLogLevel );
84         ds.setMaxLogEntries( maxLongEntries );
85     }
86  
87 }
88
89
90
Popular Tags