KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.io.File JavaDoc;
41 import java.io.PrintWriter JavaDoc;
42 import java.io.OutputStreamWriter JavaDoc;
43 import java.io.FileOutputStream JavaDoc;
44 /**
45  *
46  * @author prashanth.abbagani@sun.com
47  * @version $Revision: 1.2 $
48  */

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

55
56 public class WebServiceRegistryCommandTest extends TestCase {
57
58     public void testcreateStringArrayParam() throws Exception JavaDoc{
59         String JavaDoc[] params = testCommand.createStringArrayParam("value1,value2");
60         assertEquals(params[0], "value1");
61         assertEquals(params[1], "value2");
62     }
63
64     public void testcreateStringArrayParamWithVariable() throws Exception JavaDoc{
65         testCommand.setOption("registryjndinames", "value1,value2");
66         String JavaDoc[] params = testCommand.createStringArrayParam("{$registryjndinames}");
67         assertEquals(params[0], "value1");
68         assertEquals(params[1], "value2");
69     }
70
71     public WebServiceRegistryCommandTest(String JavaDoc name){
72         super(name);
73     }
74
75     WebServiceRegistryCommand testCommand = null;
76
77     protected void setUp() throws Exception JavaDoc{
78         //Properties systemProperties = new java.util.Propertis();
79
//systemProperties.put("com.sun.aas.configRoot",)
80
//String configProperty = SystemPropertyConstants.CONFIG_ROOT_PROPERTY;
81
//System.out.println(configProperty + " = " + System.getProperty(configProperty));
82
final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance();
83         ValidCommand validCommand = cliDescriptorsReader.getCommand(null);
84         LocalStringsManagerFactory.setCommandLocalStringsManagerProperties(
85             CLIDescriptorsReader.getInstance().getProperties());
86         testCommand = new WebServiceRegistryCommand();
87         testCommand.setName("sampleCommand");
88     }
89   
90   
91
92     protected void tearDown() {
93     }
94
95     private void nyi(){
96         fail("Not Yet Implemented");
97     }
98
99     public static Test suite(){
100         TestSuite suite = new TestSuite(WebServiceRegistryCommandTest.class);
101         return suite;
102     }
103
104     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
105         final TestRunner runner= new TestRunner();
106         final TestResult result = runner.doRun(WebServiceRegistryCommandTest.suite(), false);
107         System.exit(result.errorCount() + result.failureCount());
108     }
109 }
110
111
Popular Tags