Package net.sourceforge.clownfish.core.conf

Examples of net.sourceforge.clownfish.core.conf.Command


    /**
     * Initialise properties.
     */
    private void initLocalProperties() {
       
        Command command = getCommand();
       
        List<String> artifactTypeList = ClownfishUtil
            .parseString(getArtifactTypes());
        command.setArtifactTypeList(artifactTypeList);
    }
View Full Code Here


     * Test create clownfish.
     */
  @Test
    public void testCreateClownfish() {
       
        Command command = new Command();
       
        Mojo mojo = EasyMock.createMock(Mojo.class);
        Log log = EasyMock.createMock(Log.class);
       
        ClownfishHelper clownfishHelper = EasyMock.createMock(
View Full Code Here

    public void execute() throws MojoExecutionException {
       
        try {
            super.execute();
           
            Command command = getCommand();
            initLocalProperties();
            postExecute();
           
            if (command.isVerbose() && getLog().isInfoEnabled()) {
                showMessage(command);
            }
           
            Clownfish clownfish = getClownfish();
View Full Code Here

    protected void overrideCommandWithConfigurationFile() {
       
        super.overrideCommandWithConfigurationFile();
        if (!hasValidConfigurationFile()) return;
       
        Command command = getCommand();
        Properties props = command.getProperties();
       
        // props should never be null
        assert props != null;
       
        if (props.containsKey(ARTIFACT_TYPES_PROP_KEY)) {
            List<String> artifactTypeList = ClownfishUtil.parseString(
                    props.getProperty(ARTIFACT_TYPES_PROP_KEY));
            command.setArtifactTypeList(artifactTypeList);
        }
    }
View Full Code Here

    public void execute() throws MojoExecutionException {
             
        try {
            super.execute();
           
            Command command = getCommand();
            postExecute();
           
            if (command.isVerbose() && getLog().isInfoEnabled()) {
                logMessage(REDEPLOY_MSG, command.getTargetList());
            }
           
            Clownfish clownfish = getClownfish();

            if (!clownfish.redeploy()) {
View Full Code Here

       
        final String artifactTypes = " this, is, a,test ";
        ListMojo listMojo = new ListMojo();
        listMojo.setArtifactTypes(artifactTypes);
   
        Command command = new Command();
        command.setVerbose(true);
        command.setTargetList(Arrays.asList("target1"));

        EasyMock.expect(clownfishFactory.createClownfish(
                command, clownfishHelper, progressListenerFactory,
                maven2WrapperLog))
                .andReturn(clownfish);
View Full Code Here

    NoSuchMethodException {

        ListMojo listMojo = new ListMojo();
        listMojo.setArtifactTypes("war");

        Command command = new Command();
        command.setVerbose(true);
       
        Exception exception = new RuntimeException("test mock exception");

        org.apache.maven.plugin.logging.Log mockedLog = EasyMock.createMock(
                org.apache.maven.plugin.logging.Log.class);
View Full Code Here

       
        final String artifactTypes = "ear,war,ejb,rar,car";
        ListMojo listMojo = new ListMojo();
        listMojo.setArtifactTypes(artifactTypes);
   
        Command command = new Command();
        command.setVerbose(true);
        command.setTargetList(Arrays.asList("target1"));

        EasyMock.expect(maven2WrapperLog
                .isInfoEnabled()).andReturn(false).anyTimes();
       
         EasyMock.expect(clownfishFactory.createClownfish(
                command, clownfishHelper, progressListenerFactory,
                maven2WrapperLog))
                .andReturn(clownfish);
       
        Target target = EasyMock.createMock(Target.class);
        TargetModuleID targetModuleId = EasyMock.createMock(
                TargetModuleID.class);
       
        EasyMock.expect(targetModuleId.getTarget()).andReturn(target);
        EasyMock.expect(target.getName()).andReturn("mock target name");
        EasyMock.expect(targetModuleId.getModuleID()).andReturn(
                "mock target module id name");
        EasyMock.expect(targetModuleId.getWebURL())
                .andReturn("mock target module id url");
       
        List<TargetModuleID> targetModuleIdList =
                new ArrayList<TargetModuleID>();
        targetModuleIdList.add(targetModuleId);
        EasyMock.expect(clownfish.list()).andReturn(targetModuleIdList);
       

        clownfish.destroy();


        EasyMock.replay(clownfish);
        EasyMock.replay(clownfishFactory);
        EasyMock.replay(clownfishHelper);
        EasyMock.replay(target);
        EasyMock.replay(targetModuleId);


        listMojo.setClownfishFactory(clownfishFactory);
        listMojo.setClownfishHelper(clownfishHelper);
        listMojo.setProgressListenerFactory(progressListenerFactory);
        listMojo.setCommand(command);
        listMojo.setMaven2WrapperLog(maven2WrapperLog);
        listMojo.setLog(log);

        listMojo.setArtifactTypes(artifactTypes);
        listMojo.setConfigurationFile(TEST_CONFIGURATION_PROPERTY_FILE);
        listMojo.execute();
       
        Assert.assertEquals("ear,war,ejb,rar,car", listMojo.getArtifactTypes());
        Assert.assertEquals(5, command.getArtifactTypeList().size());
        Assert.assertEquals("ear", command.getArtifactTypeList().get(0));
        Assert.assertEquals("war", command.getArtifactTypeList().get(1));
        Assert.assertEquals("ejb", command.getArtifactTypeList().get(2));
        Assert.assertEquals("rar", command.getArtifactTypeList().get(3));
        Assert.assertEquals("car", command.getArtifactTypeList().get(4));
       
       
        EasyMock.verify(clownfish);
        EasyMock.verify(clownfishFactory);
        EasyMock.verify(clownfishHelper);
View Full Code Here

    public void execute() throws MojoExecutionException {
       
        try {
            super.execute();
           
            Command command = getCommand();
            postExecute();
           
            if (command.isVerbose() && getLog().isInfoEnabled()) {
                logMessage(UNDEPLOY_MSG, command.getTargetList());
            }
           
            Clownfish clownfish = getClownfish();

            if (!clownfish.undeploy()) {
View Full Code Here

        final String artifactTypes = "war,ejb,rar,car";
       
        ListMojo listMojo = new ListMojo();
        listMojo.setArtifactTypes(mojoArtifactTypes);
       
        Command command = new Command();
        command.setVerbose(true);
        command.setTargetList(Arrays.asList("target1"));

        EasyMock.expect(maven2WrapperLog
                .isInfoEnabled()).andReturn(false).anyTimes();
       
       
        EasyMock.expect(clownfishFactory.createClownfish(
                command, clownfishHelper, progressListenerFactory,
                maven2WrapperLog))
                .andReturn(clownfish);
       
        Properties properties = new Properties();
        properties.put("clownfish.artifactTypes", artifactTypes);
        EasyMock.expect(commandFactory.getConfigurationProperties(listMojo,
                maven2WrapperLog)).andReturn(properties);
       
        Target target = EasyMock.createMock(Target.class);
        TargetModuleID targetModuleId = EasyMock.createMock(
                TargetModuleID.class);
       
        EasyMock.expect(targetModuleId.getTarget()).andReturn(target);
        EasyMock.expect(target.getName()).andReturn("mock target name");
        EasyMock.expect(targetModuleId.getModuleID()).andReturn(
                "mock target module id name");
        EasyMock.expect(targetModuleId.getWebURL())
                .andReturn("mock target module id url");
       
        List<TargetModuleID> targetModuleIdList =
                new ArrayList<TargetModuleID>();
        targetModuleIdList.add(targetModuleId);
        EasyMock.expect(clownfish.list()).andReturn(targetModuleIdList);
       

        clownfish.destroy();


        EasyMock.replay(clownfish);
        EasyMock.replay(clownfishFactory);
        EasyMock.replay(clownfishHelper);
        EasyMock.replay(commandFactory);
        EasyMock.replay(target);
        EasyMock.replay(targetModuleId);


        listMojo.setClownfishFactory(clownfishFactory);
        listMojo.setClownfishHelper(clownfishHelper);
        listMojo.setProgressListenerFactory(progressListenerFactory);
        listMojo.setCommandFactory(commandFactory);
        listMojo.setCommand(command);
        listMojo.setMaven2WrapperLog(maven2WrapperLog);
        listMojo.setLog(log);

        listMojo.setConfigurationFile(TEST_CONFIGURATION_PROPERTY_FILE);
        listMojo.execute();
       
        Assert.assertEquals("ear", listMojo.getArtifactTypes());
        Assert.assertEquals(4, command.getArtifactTypeList().size());
        Assert.assertEquals("war", command.getArtifactTypeList().get(0));
        Assert.assertEquals("ejb", command.getArtifactTypeList().get(1));
        Assert.assertEquals("rar", command.getArtifactTypeList().get(2));
        Assert.assertEquals("car", command.getArtifactTypeList().get(3));
       
        EasyMock.verify(clownfish);
        EasyMock.verify(clownfishFactory);
        EasyMock.verify(clownfishHelper);
        EasyMock.verify(commandFactory);
View Full Code Here

TOP

Related Classes of net.sourceforge.clownfish.core.conf.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.