FileDocCategorySizeDatePackage
GetClientStubsCommandTest.javaAPI DocGlassfish v2 API5469Fri May 04 22:25:18 BST 2007com.sun.enterprise.cli.commands

GetClientStubsCommandTest

public class GetClientStubsCommandTest extends TestCase
Execute these tests using gmake (and Ant) by: cd gmake ANT_TARGETS=CommandTest.java

Fields Summary
GetClientStubsCommand
testCommand
Constructors Summary
public GetClientStubsCommandTest(String name)

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        final TestRunner runner= new TestRunner();
        final TestResult result = runner.doRun(GetClientStubsCommandTest.suite(), false);
        System.exit(result.errorCount() + result.failureCount());
    
private voidnyi()

        fail("Not Yet Implemented");
    
protected voidsetUp()


        
        //Properties systemProperties = new java.util.Propertis();
        //systemProperties.put("com.sun.aas.configRoot",)
        //String configProperty = SystemPropertyConstants.CONFIG_ROOT_PROPERTY;
        //System.out.println(configProperty + " = " + System.getProperty(configProperty));
        final CLIDescriptorsReader cliDescriptorsReader = CLIDescriptorsReader.getInstance();
        ValidCommand validCommand = cliDescriptorsReader.getCommand(null);
        LocalStringsManagerFactory.setCommandLocalStringsManagerProperties(
            CLIDescriptorsReader.getInstance().getProperties());
        testCommand = new GetClientStubsCommand();
        testCommand.setName("sampleCommand");
    
public static junit.framework.Testsuite()

        TestSuite suite = new TestSuite(GetClientStubsCommandTest.class);
        return suite;
    
protected voidtearDown()

    
public voidtestvalidateOptionsInvalidDirectory()

        //create a file and set it as download directory
        final String enc = "ISO-8859-1";
        final File f = new File(System.getProperty("java.io.tmpdir"),
                                "ordinaryFile");
        f.deleteOnExit();
        final PrintWriter pw = new PrintWriter (
                new OutputStreamWriter(new FileOutputStream(f), enc));
        pw.println("xyz");
        pw.close();
        Vector operands = new Vector();
        operands.add(f.getAbsolutePath());
        testCommand.setOperands(operands);
        try{
            testCommand.validateOptions();
        }catch (CommandValidationException cve){
            assertEquals(cve.getMessage(), "CLI153 " + f.getAbsolutePath() + 
                            " does not exist or does not have write permission");
        }
    
public voidtestvalidateOptionsValid()

        Vector operands = new Vector();
        operands.add(System.getProperty("java.io.tmpdir"));
        testCommand.setOperands(operands);
        assertEquals(testCommand.validateOptions(), true);