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 41 42 43 48 49 54 55 public class SSLCommandTest extends TestCase { 56 57 public void testvalidateOptionsValid() throws Exception { 58 testCommand.setOption("type", "iiop-service"); 59 assertEquals(testCommand.validateOptions(), true); 60 } 61 62 public void testvalidateOptionsInvalidType() throws Exception { 63 testCommand.setOption("type", "invalidType"); 64 try{ 65 testCommand.validateOptions(); 66 }catch (CommandValidationException cve){ 67 assertEquals(cve.getMessage(), "CLI165 Invalid type option value. "); 68 } 69 } 70 71 public void testvalidateOptionsInvalidOperand() throws Exception { 72 testCommand.setOption("type", "http-listener"); 73 try{ 74 testCommand.validateOptions(); 75 }catch (CommandValidationException cve){ 76 assertEquals(cve.getMessage(), 77 "CLI170 Operand is required for option value http-listener."); 78 } 79 } 80 81 public SSLCommandTest(String name){ 82 super(name); 83 } 84 85 SSLCommand testCommand = null; 86 87 protected void setUp() throws Exception { 88 final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance(); 89 ValidCommand validCommand = cliDescriptorsReader.getCommand(null); 90 LocalStringsManagerFactory.setCommandLocalStringsManagerProperties( 91 CLIDescriptorsReader.getInstance().getProperties()); 92 testCommand = new SSLCommand(); 93 testCommand.setName("sampleCommand"); 94 } 95 96 97 98 protected void tearDown() { 99 } 100 101 private void nyi(){ 102 fail("Not Yet Implemented"); 103 } 104 105 public static Test suite(){ 106 TestSuite suite = new TestSuite(SSLCommandTest.class); 107 return suite; 108 } 109 110 public static void main(String args[]) throws Exception { 111 final TestRunner runner= new TestRunner(); 112 final TestResult result = runner.doRun(SSLCommandTest.suite(), false); 113 System.exit(result.errorCount() + result.failureCount()); 114 } 115 } 116 117 | Popular Tags |