1 23 24 package com.sun.enterprise.cli.framework; 25 26 import java.util.HashMap ; 27 import java.util.Vector ; 28 import java.util.Arrays ; 29 import junit.framework.*; 30 35 36 public class CommandValidatorTest extends TestCase { 37 public void testValidCommand3() throws Exception { 38 final Vector vos = new Vector (); 39 vos.add(new ValidOption("vo", "foo", 0, "value")); 40 final Vector ros = new Vector (); 41 ros.add(new ValidOption("ro", "fee", 1, "v")); 42 final Vector dos = new Vector (); 43 final ValidCommand vc = new ValidCommand("name", "*", vos, ros, dos, "useage"); 44 cv.validateCommandAndOptions(vc, new HashMap (), new Vector ()); 45 } 46 47 public void testValidCommand2() throws Exception { 48 final Vector vos = new Vector (); 49 vos.add(new ValidOption("vo", "foo", 0, "value")); 50 final Vector ros = new Vector (); 51 ros.add(new ValidOption("ro", "fee", 1, "v")); 52 final Vector dos = new Vector (); 53 final ValidCommand vc = new ValidCommand("name", "*", vos, ros, dos, "useage"); 54 cv.validateCommandAndOptions(vc, new HashMap (), new Vector ()); 55 } 56 57 public void testValidCommand1() throws Exception { 58 final Vector vos = new Vector (); 59 vos.add(new ValidOption("vo", "String", 1, "")); 60 final Vector ros = new Vector (); 61 ros.add(new ValidOption("ro", "Integer", 0, "")); 62 final Vector dos = new Vector (); 63 final ValidCommand vc = new ValidCommand("name", "3", vos, ros, dos, "useage"); 64 cv.validateCommandAndOptions(vc, new HashMap (), 65 new Vector (Arrays.asList(new String [] {"1", "2", "3"}))); 66 } 67 68 public void testValidCommandWithSimpleConstructors() throws Exception { 69 final ValidCommand vc = new ValidCommand(); 70 } 72 73 public CommandValidatorTest(String name){ 74 super(name); 75 } 76 CommandValidator cv; 77 78 protected void setUp() { 79 cv = new CommandValidator(); 80 } 81 82 protected void tearDown() { 83 } 84 85 private void nyi(){ 86 fail("Not Yet Implemented"); 87 } 88 89 public static void main(String args[]){ 90 if (args.length == 0){ 91 junit.textui.TestRunner.run(CommandValidatorTest.class); 92 } else { 93 junit.textui.TestRunner.run(makeSuite(args)); 94 } 95 } 96 private static TestSuite makeSuite(String args[]){ 97 final TestSuite ts = new TestSuite(); 98 for (int i = 0; i < args.length; i++){ 99 ts.addTest(new CommandValidatorTest(args[i])); 100 } 101 return ts; 102 } 103 } 104 | Popular Tags |