KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > test > serverplugins > glassfish > GlassfishTestSuite


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.test.serverplugins.glassfish;
21
22 import org.netbeans.modules.test.serverplugins.jboss.*;
23 import org.netbeans.junit.NbTestSuite;
24 import org.netbeans.modules.test.serverplugins.api.ConstantsProvider;
25 import org.netbeans.modules.test.serverplugins.api.ServerProvider;
26 import org.netbeans.modules.test.serverplugins.generic.GenericInstanceTest;
27 import org.netbeans.modules.test.serverplugins.generic.GenericRunTest;
28 import org.netbeans.modules.test.serverplugins.generic.GenericTestSuite;
29 import org.netbeans.modules.test.serverplugins.jboss.JBossServerProvider;
30 import org.openide.util.NbBundle;
31
32 /**
33  * JBoss implementation of the GenericTestSuite
34  *
35  * @author Michal Mocnak
36  */

37 public class GlassfishTestSuite extends GenericTestSuite {
38     
39     private static GlassfishConstantsProvider cProvider;
40     private static GlassfishServerProvider sProvider;
41     
42     private GlassfishTestSuite(String JavaDoc name) {
43         super(name);
44     }
45     
46     /**
47      * Returns JBoss specific instance of the NbTestSuite
48      *
49      * @return instance of the NbTestSuite
50      */

51     public static NbTestSuite suite() {
52         // Create new JBossTestSuite
53
GlassfishTestSuite suite = new GlassfishTestSuite(NbBundle.getMessage(GlassfishTestSuite.class, "SUITE_NAME"));
54         
55         // Set test cases into
56
suite.addTest(new GenericInstanceTest("addInstanceTest",
57                 suite.getConstantsProvider(), suite.getServerProvider()));
58         suite.addTest(new GenericRunTest("startServerTest",
59                 suite.getConstantsProvider(), suite.getServerProvider()));
60         suite.addTest(new GenericRunTest("stopServerTest",
61                 suite.getConstantsProvider(), suite.getServerProvider()));
62         suite.addTest(new GenericRunTest("startDebugServerTest",
63                 suite.getConstantsProvider(), suite.getServerProvider()));
64         suite.addTest(new GenericRunTest("stopServerTest",
65                 suite.getConstantsProvider(), suite.getServerProvider()));
66         suite.addTest(new GenericInstanceTest("removeInstanceTest",
67                 suite.getConstantsProvider(), suite.getServerProvider()));
68         
69         return suite;
70     }
71     
72     public synchronized ConstantsProvider getConstantsProvider() {
73         if (null == cProvider)
74             cProvider = new GlassfishConstantsProvider();
75         
76         return cProvider;
77     }
78     
79     public synchronized ServerProvider getServerProvider() {
80         if (null == sProvider)
81             sProvider = new GlassfishServerProvider((GlassfishConstantsProvider) getConstantsProvider());
82         
83         return sProvider;
84     }
85 }
Popular Tags