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

GenerateReportCommandTest

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

Fields Summary
GenerateReportCommand
testCommand
Constructors Summary
public GenerateReportCommandTest(String name)

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

        final TestRunner runner= new TestRunner();
        final TestResult result = runner.doRun(GenerateReportCommandTest.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 GenerateReportCommand();
        testCommand.setName("sampleCommand");
    
public static junit.framework.Testsuite()

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

    
public voidtestvalidateOptionsInvalidLogEndDate()

        try{
            testCommand.setOption("local", "true");
            testCommand.setOption("targetdir", "currentdir");
            testCommand.setOption("logstartdate", "10202004");
            testCommand.validateOptions();
        }catch (CommandValidationException cve){
            assertEquals(cve.getMessage(), "optionrequiredwithoption");
        }
    
public voidtestvalidateOptionsInvalidTarget()

        try{
            testCommand.setOption("local", "true");
            testCommand.validateOptions();
        }catch (CommandValidationException cve){
            assertEquals(cve.getMessage(), "CLI179 option targetdir required in local mode");
        }
        
    
public voidtestvalidateOptionsValid()

        testCommand.setOption("local", "true");
        testCommand.setOption("targetdir", "currentdir");
        testCommand.setOption("logstartdate", "10202004");
        testCommand.setOption("logenddate", "10212004");
        assertEquals(testCommand.validateOptions(), true);