KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > cli > commands > StopAppservCommandTest


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.cli.commands;
24
25 /**
26    Note that this test requires resources for testing. These resources
27    are construct4ed from the two files P1 & P2 located in the current
28    directory. If these file names are changed then the corresponding
29    names in this submodules build.xml file should be changed also
30 */

31 import com.sun.enterprise.cli.framework.*;
32 //import java.util.ArrayList;
33
//import java.util.Arrays;
34
//import java.util.HashMap;
35
//import java.util.List;
36
//import java.util.Properties;
37
import junit.framework.*;
38 import junit.textui.TestRunner;
39 import java.util.Vector JavaDoc;
40
41
42
43 /**
44  *
45  * @author prashanth.abbagani@sun.com
46  * @version $Revision: 1.2 $
47  */

48
49 /**
50    Execute these tests using gmake (and Ant) by:
51    cd <commands>
52    gmake ANT_TARGETS=CommandTest.java
53 */

54
55 public class StopAppservCommandTest extends TestCase {
56
57     public void testrunCommandNoDomains() throws Exception JavaDoc{
58         try{
59             testCommand.setOption("domaindir", System.getProperty("java.io.tmpdir"));
60             testCommand.runCommand();
61         } catch (Exception JavaDoc e)
62         {
63             //bug in code, missing localized string 'NoDomainsToStop' in LocalStrings.properties
64
assertEquals(e.getMessage(), "Key not found (NoDomainsToStop)");
65         }
66     }
67
68     public StopAppservCommandTest(String JavaDoc name){
69         super(name);
70     }
71
72     StopAppservCommand testCommand = null;
73
74     protected void setUp() throws Exception JavaDoc{
75         final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance();
76         ValidCommand validCommand = cliDescriptorsReader.getCommand(null);
77         LocalStringsManagerFactory.setCommandLocalStringsManagerProperties(
78                 CLIDescriptorsReader.getInstance().getProperties());
79         testCommand = new StopAppservCommand();
80         testCommand.setName("sampleCommand");
81     }
82   
83   
84
85     protected void tearDown() {
86     }
87
88     private void nyi(){
89         fail("Not Yet Implemented");
90     }
91
92     public static Test suite(){
93         TestSuite suite = new TestSuite(StopAppservCommandTest.class);
94         return suite;
95     }
96
97     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
98         final TestRunner runner= new TestRunner();
99         final TestResult result = runner.doRun(StopAppservCommandTest.suite(), false);
100         System.exit(result.errorCount() + result.failureCount());
101     }
102 }
103
104
Popular Tags