1 23 package com.sun.enterprise.cli.commands; 24 25 31 import com.sun.enterprise.cli.framework.*; 32 import junit.framework.*; 38 import junit.textui.TestRunner; 39 import java.util.Vector ; 40 45 46 51 52 public class DeployCommandTest extends TestCase { 53 54 public void testValidateOptionsInvalidOptions() throws Exception { 55 try{ 56 testCommand.setOption("createtables", "true"); 57 testCommand.setOption("dropandcreatetables", "true"); 58 testCommand.validateOptions(); 59 } 60 catch (CommandValidationException cve){ 61 assertEquals(cve.getMessage(), 62 "CLI169 Options createtables and dropandcreatetables are mutually exclusive. You must specify one or the other but not both."); 63 } 64 } 65 66 public void testValidateOptionsValidOptions() throws Exception { 67 Vector operands = new Vector (); 68 operands.add("earFile"); 69 testCommand.setOperands(operands); 70 testCommand.validateOptions(); 71 } 72 73 public DeployCommandTest(String name){ 74 super(name); 75 } 76 77 DeployCommand testCommand = null; 78 79 protected void setUp() throws Exception { 80 final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance(); 85 ValidCommand validCommand = cliDescriptorsReader.getCommand(null); 86 LocalStringsManagerFactory.setCommandLocalStringsManagerProperties( 87 CLIDescriptorsReader.getInstance().getProperties()); 88 testCommand = new DeployCommand(); 89 testCommand.setName("sampleCommand"); 90 } 91 92 93 94 protected void tearDown() { 95 } 96 97 private void nyi(){ 98 fail("Not Yet Implemented"); 99 } 100 101 public static Test suite(){ 102 TestSuite suite = new TestSuite(BackupCommandsTest.class); 103 return suite; 104 } 105 106 public static void main(String args[]) throws Exception { 107 final TestRunner runner= new TestRunner(); 108 final TestResult result = runner.doRun(BackupCommandsTest.suite(), false); 109 System.exit(result.errorCount() + result.failureCount()); 110 } 111 } 112 113 | Popular Tags |