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 com.sun.enterprise.util.SystemPropertyConstants; 40 import java.io.File ; 41 46 47 52 53 public class BaseTransformationRuleCommandTest extends TestCase { 54 55 public void testvalidateWebServiceNameWhenValid() throws Exception { 56 testCommand.validateWebServiceName("webserviceName#With#Hash", true); 57 } 58 59 public void testvalidateWebServiceNameWhenInvalid1() throws Exception { 60 try{ 61 testCommand.validateWebServiceName("webserviceNameWithoutHash", true); 62 } 63 catch (CommandValidationException cve){ 64 assertEquals(cve.getMessage(), 65 "CLI186 Invalid format entered for the webservice name"); 66 } 67 } 68 69 public void testvalidateWebServiceNameWhenInvalid2() throws Exception { 70 try{ 71 testCommand.validateWebServiceName("webserviceNameWithHashAtEnd#", true); 72 } 73 catch (CommandValidationException cve){ 74 assertEquals(cve.getMessage(), 75 "CLI186 Invalid format entered for the webservice name"); 76 } 77 } 78 79 public BaseTransformationRuleCommandTest(String name){ 80 super(name); 81 } 82 83 BaseTransformationRuleCommand testCommand = null; 84 85 protected void setUp() throws Exception { 86 final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance(); 91 ValidCommand validCommand = cliDescriptorsReader.getCommand(null); 92 LocalStringsManagerFactory.setCommandLocalStringsManagerProperties( 93 CLIDescriptorsReader.getInstance().getProperties()); 94 testCommand = new BaseTransformationRuleCommand() { 95 public void runCommand() 96 throws CommandException, CommandValidationException 97 { 98 } 99 public boolean validateOptions() throws CommandValidationException 100 { 101 return true; 102 } 103 }; 104 testCommand.setName("sampleCommand"); 105 } 106 107 108 109 protected void tearDown() { 110 } 111 112 private void nyi(){ 113 fail("Not Yet Implemented"); 114 } 115 116 public static Test suite(){ 117 TestSuite suite = new TestSuite(BackupCommandsTest.class); 118 return suite; 119 } 120 121 public static void main(String args[]) throws Exception { 122 final TestRunner runner= new TestRunner(); 123 final TestResult result = runner.doRun(BackupCommandsTest.suite(), false); 124 System.exit(result.errorCount() + result.failureCount()); 125 } 126 } 127 128 | Popular Tags |