geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Woods <dwo...@apache.org>
Subject Re: svn commit: r666781 - in /geronimo/server/trunk: testsuite/commands-testsuite/ testsuite/commands-testsuite/deploy/ testsuite/commands-testsuite/deploy/src/ testsuite/commands-testsuite/deploy/src/test/ testsuite/commands-testsuite/deploy/src/test/java...
Date Wed, 11 Jun 2008 19:37:37 GMT
Any plans to pull this into branches/2.1?


-Donald


gawor@apache.org wrote:
> Author: gawor
> Date: Wed Jun 11 11:50:45 2008
> New Revision: 666781
> 
> URL: http://svn.apache.org/viewvc?rev=666781&view=rev
> Log:
> Initial testsuite for command line tools. Patch from YunFeng Ma but with bunch of modifications
(GERONIMO-4074)
> 
> Added:
>     geronimo/server/trunk/testsuite/commands-testsuite/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt   (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml   (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java
  (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/
>     geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml
  (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt   (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml   (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java
  (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/
>     geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml
  (with props)
>     geronimo/server/trunk/testsuite/commands-testsuite/pom.xml   (with props)
>     geronimo/server/trunk/testsupport/testsupport-commands/
>     geronimo/server/trunk/testsupport/testsupport-commands/pom.xml   (with props)
>     geronimo/server/trunk/testsupport/testsupport-commands/src/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/
>     geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java
  (with props)
> Modified:
>     geronimo/server/trunk/testsupport/pom.xml
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt (added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt Wed Jun 11 11:50:45
2008
> @@ -0,0 +1 @@
> +clean install
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/deploy/goals.txt
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml (added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml Wed Jun 11 11:50:45
2008
> @@ -0,0 +1,35 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  Licensed to the Apache Software Foundation (ASF) under one or more
> +  contributor license agreements.  See the NOTICE file distributed with
> +  this work for additional information regarding copyright ownership.
> +  The ASF licenses this file to You under the Apache License, Version 2.0
> +  (the "License"); you may not use this file except in compliance with
> +  the License.  You may obtain a copy of the License at
> +
> +      http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing, software
> +  distributed under the License is distributed on an "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +  See the License for the specific language governing permissions and
> +  limitations under the License.
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.testsuite</groupId>
> +        <artifactId>commands-testsuite</artifactId>
> +        <version>2.2-SNAPSHOT</version>
> +    </parent>
> +
> +    <artifactId>deployer-testsuite</artifactId>
> +    <name>Geronimo TestSuite :: Commands Testsuite :: Deployer</name>
> +
> +    <description>
> +        Test for the deploy.bat/sh
> +    </description>
> +
> +</project>
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/deploy/pom.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java
(added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java
Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,102 @@
> +/**
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *    http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +
> +package org.apache.geronimo.testsuite.deploy;
> +
> +import java.io.ByteArrayOutputStream;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +import org.apache.geronimo.testsupport.commands.CommandTestSupport;
> +import org.testng.Assert;
> +import org.testng.annotations.Test;
> +
> +@Test
> +public class DeployerTest extends CommandTestSupport {
> +
> +    protected String execute(String[] args) throws Exception {
> +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +        List<String> cmd = new ArrayList<String>();
> +        cmd.addAll(Arrays.asList("--user", "system", "--password", "manager"));
> +        if (args != null) {
> +            cmd.addAll(Arrays.asList(args));
> +        }
> +        execute(CommandTestSupport.DEPLOY, cmd, null, baos);
> +        return baos.toString();
> +    }
> +        
> +    @Test
> +    public void testListAllModules() throws Exception {
> +        String[] args = new String[]{ "list-modules" };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") < 0) {
> +            Assert.fail("list-modules failed : " + output);
> +        }
> +    }
> +    
> +    @Test
> +    public void testListStartedModules() throws Exception {
> +        String[] args = new String[]{ "list-modules", "--started" };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") < 0) {
> +            Assert.fail("list-modules failed : " + output);
> +        }
> +        if (output.indexOf("org.apache.geronimo.configs/client-corba-yoko") > 0)
{
> +            Assert.fail("list-modules failed : " + output);
> +        }
> +    }
> +    
> +    @Test
> +    public void testListStoppedModules() throws Exception {
> +        String[] args = new String[]{ "list-modules", "--stopped" };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") > 0) {
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +        if (output.indexOf("org.apache.geronimo.configs/client-corba-yoko") < 0)
{
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +    }
> +    
> +    @Test
> +    public void testOfflineDeployment() throws Exception {
> +        //todo doesn't work now
> +        /*
> +        String[] args = new String[]{ "--offline", "deploy", "" };
> + 
> +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +        execute( command, args, null, baos );
> +
> +        if (baos.toString().indexOf("org.apache.geronimo.configs/activemq-broker") >
0) {
> +                Assert.fail("deploy/list-modules failed : " + baos.toString());
> +        }
> +        if (baos.toString().indexOf("org.apache.geronimo.configs/client-corba-yoko")
< 0) {
> +                Assert.fail("deploy/list-modules failed : " + baos.toString());
> +        }
> +        */
> +    }
> +    
> +}
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/java/org/apache/geronimo/testsuite/deploy/DeployerTest.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml
(added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml
Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,32 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Licensed to the Apache Software Foundation (ASF) under one
> +    or more contributor license agreements.  See the NOTICE file
> +    distributed with this work for additional information
> +    regarding copyright ownership.  The ASF licenses this file
> +    to you under the Apache License, Version 2.0 (the
> +    "License"); you may not use this file except in compliance
> +    with the License.  You may obtain a copy of the License at
> +    
> +     http://www.apache.org/licenses/LICENSE-2.0
> +    
> +    Unless required by applicable law or agreed to in writing,
> +    software distributed under the License is distributed on an
> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +    KIND, either express or implied.  See the License for the
> +    specific language governing permissions and limitations
> +    under the License.
> +-->
> +
> +<!-- $Rev: 514087 $ $Date: 2007-03-03 14:13:40 +0800 (Sat, 03 Mar 2007) $ -->
> +
> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> +
> +<suite name="Suite1" verbose="1">
> +    <test name="commands-testsuite.deploy">
> +        <packages>
> +            <package name="org.apache.geronimo.testsuite.deploy"/>
> +        </packages>
> +    </test>
> +</suite>
> +
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/deploy/src/test/resources/testng.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt (added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt Wed Jun 11 11:50:45
2008
> @@ -0,0 +1 @@
> +clean install
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/gshell/goals.txt
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml (added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml Wed Jun 11 11:50:45
2008
> @@ -0,0 +1,36 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  Licensed to the Apache Software Foundation (ASF) under one or more
> +  contributor license agreements.  See the NOTICE file distributed with
> +  this work for additional information regarding copyright ownership.
> +  The ASF licenses this file to You under the Apache License, Version 2.0
> +  (the "License"); you may not use this file except in compliance with
> +  the License.  You may obtain a copy of the License at
> +
> +      http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing, software
> +  distributed under the License is distributed on an "AS IS" BASIS,
> +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +  See the License for the specific language governing permissions and
> +  limitations under the License.
> +-->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.testsuite</groupId>
> +        <artifactId>commands-testsuite</artifactId>
> +        <version>2.2-SNAPSHOT</version>
> +        <relativePath>../pom.xml</relativePath>
> +    </parent>
> +
> +    <artifactId>gshell-testsuite</artifactId>
> +    <name>Geronimo TestSuite :: Commands Testsuite :: GShell</name>
> +
> +    <description>
> +        Test for the gsh.bat/sh
> +    </description>
> +
> +</project>
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/gshell/pom.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java
(added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java
Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,100 @@
> +/**
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *    http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +
> +package org.apache.geronimo.testsuite.gshell.deploy;
> +
> +import java.io.ByteArrayOutputStream;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +import org.apache.geronimo.testsupport.commands.CommandTestSupport;
> +import org.testng.Assert;
> +import org.testng.annotations.Test;
> +
> +@Test
> +public class DeployTest extends CommandTestSupport {
> +        
> +    private static final String UP = "-u system -w manager";
> +    
> +    protected String execute(String[] args) throws Exception {
> +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +        List<String> cmd = new ArrayList<String>();    
> +        cmd.addAll(Arrays.asList("-c"));
> +        if (args != null) {
> +            cmd.addAll(Arrays.asList(args));
> +        }
> +        execute(CommandTestSupport.GSH, cmd, null, baos);
> +        return baos.toString();
> +    }
> +    
> +    @Test
> +    public void testListAllModules() throws Exception {
> +        String[] args = new String[]{ "deploy/list-modules " + UP };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") < 0) {
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +    }
> +    
> +    @Test
> +    public void testListStartedModules() throws Exception {
> +        String[] args = new String[]{ "deploy/list-modules " + UP + " --started" };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") < 0) {
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +        if (output.indexOf("org.apache.geronimo.configs/client-corba-yoko") > 0)
{
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +    }
> +    
> +    @Test
> +    public void testListStoppedModules() throws Exception {
> +        String[] args = new String[]{ "deploy/list-modules " + UP + " --stopped" };
> + 
> +        String output = execute(args);
> +
> +        if (output.indexOf("org.apache.geronimo.configs/activemq-broker") > 0) {
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +        if (output.indexOf("org.apache.geronimo.configs/client-corba-yoko") < 0)
{
> +            Assert.fail("deploy/list-modules failed : " + output);
> +        }
> +    }
> +    
> +    public void testListAllPlugins() throws Exception {
> +        //todo this testcase fails
> +        /*
> +        String[] args = new String[]{ "-c", "deploy/list-plugins -u system -w manager"
};
> + 
> +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +        execute( command, args, null, baos );
> +
> +        if (baos.toString().indexOf("org.apache.geronimo.configs/activemq-broker") <
0) {
> +                Assert.fail("deploy/list-modules failed : " + baos.toString());
> +        }
> +        */
> +    }
> +
> +}
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/java/org/apache/geronimo/testsuite/gshell/deploy/DeployTest.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml
(added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml
Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,32 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Licensed to the Apache Software Foundation (ASF) under one
> +    or more contributor license agreements.  See the NOTICE file
> +    distributed with this work for additional information
> +    regarding copyright ownership.  The ASF licenses this file
> +    to you under the Apache License, Version 2.0 (the
> +    "License"); you may not use this file except in compliance
> +    with the License.  You may obtain a copy of the License at
> +    
> +     http://www.apache.org/licenses/LICENSE-2.0
> +    
> +    Unless required by applicable law or agreed to in writing,
> +    software distributed under the License is distributed on an
> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +    KIND, either express or implied.  See the License for the
> +    specific language governing permissions and limitations
> +    under the License.
> +-->
> +
> +<!-- $Rev: 514087 $ $Date: 2007-03-03 14:13:40 +0800 (Sat, 03 Mar 2007) $ -->
> +
> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> +
> +<suite name="Suite1" verbose="1">
> +    <test name="commands-testsuite.gshell">
> +        <packages>
> +            <package name="org.apache.geronimo.testsuite.gshell.deploy"/>
> +        </packages>
> +    </test>
> +</suite>
> +
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/gshell/src/test/resources/testng.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsuite/commands-testsuite/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/commands-testsuite/pom.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsuite/commands-testsuite/pom.xml (added)
> +++ geronimo/server/trunk/testsuite/commands-testsuite/pom.xml Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,85 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Licensed to the Apache Software Foundation (ASF) under one
> +    or more contributor license agreements.  See the NOTICE file
> +    distributed with this work for additional information
> +    regarding copyright ownership.  The ASF licenses this file
> +    to you under the Apache License, Version 2.0 (the
> +    "License"); you may not use this file except in compliance
> +    with the License.  You may obtain a copy of the License at
> +
> +     http://www.apache.org/licenses/LICENSE-2.0
> +
> +    Unless required by applicable law or agreed to in writing,
> +    software distributed under the License is distributed on an
> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +    KIND, either express or implied.  See the License for the
> +    specific language governing permissions and limitations
> +    under the License.
> +-->
> +
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +
> +    <modelVersion>4.0.0</modelVersion>
> +
> +    <parent>
> +        <groupId>org.apache.geronimo.testsuite</groupId>
> +        <artifactId>testsuite</artifactId>
> +        <version>2.2-SNAPSHOT</version>
> +    </parent>
> +
> +    <artifactId>commands-testsuite</artifactId>
> +    <name>Geronimo TestSuite :: Commands TestSuite</name>
> +    <packaging>pom</packaging>
> +    
> +    <description>
> +        Test Geronimo Commands Functions
> +    </description>
> +     
> +    <dependencies>
> +        <dependency>
> +            <groupId>org.apache.geronimo.testsupport</groupId>
> +            <artifactId>testsupport-commands</artifactId>
> +            <version>${version}</version>
> +        </dependency>
> +    </dependencies> 
> +    
> +    <build>
> +        <pluginManagement>
> +            <plugins>
> +                <plugin>
> +                    <groupId>org.apache.maven.plugins</groupId>
> +                    <artifactId>maven-surefire-plugin</artifactId>
> +                    <configuration>
> +                        <suiteXmlFiles>
> +                            <suiteXmlFile>${project.build.testOutputDirectory}/testng.xml</suiteXmlFile>
> +                        </suiteXmlFiles>
> +                        <systemProperties>
> +                            <property>
> +                                <name>geronimoVersion</name>
> +                                <value>${version}</value>
> +                            </property>
> +                        </systemProperties>
> +                    </configuration>
> +                </plugin>
> +            </plugins>
> +        </pluginManagement>
> +        
> +        <plugins>
> +            <plugin>
> +                <groupId>org.apache.geronimo.buildsupport</groupId>
> +                <artifactId>testsuite-maven-plugin</artifactId>
> +                <inherited>false</inherited>
> +                <executions>
> +                    <execution>
> +                        <phase>install</phase>
> +                        <goals>
> +                            <goal>generate-surefire-xml</goal>
> +                        </goals>
> +                    </execution>
> +                </executions>
> +            </plugin>
> +        </plugins>
> +    </build>
> +
> +</project>
> 
> Propchange: geronimo/server/trunk/testsuite/commands-testsuite/pom.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Modified: geronimo/server/trunk/testsupport/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/pom.xml?rev=666781&r1=666780&r2=666781&view=diff
> ==============================================================================
> --- geronimo/server/trunk/testsupport/pom.xml (original)
> +++ geronimo/server/trunk/testsupport/pom.xml Wed Jun 11 11:50:45 2008
> @@ -42,6 +42,7 @@
>      <modules>
>          <module>testsupport-common</module>
>          <module>testsupport-selenium</module>
> +        <module>testsupport-commands</module>
>          <module>testsupport-packaging</module>
>          <module>test-deployment-j2ee_1.3</module>
>          <module>test-deployment-j2ee_1.4</module>
> 
> Added: geronimo/server/trunk/testsupport/testsupport-commands/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-commands/pom.xml?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsupport/testsupport-commands/pom.xml (added)
> +++ geronimo/server/trunk/testsupport/testsupport-commands/pom.xml Wed Jun 11 11:50:45
2008
> @@ -0,0 +1,59 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +    Licensed to the Apache Software Foundation (ASF) under one
> +    or more contributor license agreements.  See the NOTICE file
> +    distributed with this work for additional information
> +    regarding copyright ownership.  The ASF licenses this file
> +    to you under the Apache License, Version 2.0 (the
> +    "License"); you may not use this file except in compliance
> +    with the License.  You may obtain a copy of the License at
> +    
> +     http://www.apache.org/licenses/LICENSE-2.0
> +    
> +    Unless required by applicable law or agreed to in writing,
> +    software distributed under the License is distributed on an
> +    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +    KIND, either express or implied.  See the License for the
> +    specific language governing permissions and limitations
> +    under the License.
> +-->
> +<!-- $Rev: 649297 $ $Date: 2008-04-17 17:54:06 -0400 (Thu, 17 Apr 2008) $ -->
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> +    <modelVersion>4.0.0</modelVersion>
> +    
> +    <parent>
> +        <groupId>org.apache.geronimo.testsupport</groupId>
> +        <artifactId>testsupport</artifactId>
> +        <version>2.2-SNAPSHOT</version>
> +    </parent>
> +    
> +    <artifactId>testsupport-commands</artifactId>
> +    <name>Geronimo Test Support :: Commands</name>
> +    
> +    <dependencies>
> +        <dependency>
> +            <groupId>junit</groupId>
> +            <artifactId>junit</artifactId>
> +            <scope>compile</scope>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>org.apache.geronimo.testsupport</groupId>
> +            <artifactId>testsupport-common</artifactId>
> +            <version>${version}</version>
> +            <scope>compile</scope>
> +        </dependency>
> +        
> +        <dependency>
> +            <groupId>org.apache.geronimo.buildsupport</groupId>
> +            <artifactId>geronimo-maven-plugin</artifactId>
> +            <version>${version}</version>
> +        </dependency>
> +         
> +        <dependency>
> +            <groupId>org.apache.ant</groupId>
> +            <artifactId>ant</artifactId>
> +        </dependency>
> +    </dependencies>
> +
> +</project>
> 
> Propchange: geronimo/server/trunk/testsupport/testsupport-commands/pom.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> Added: geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java?rev=666781&view=auto
> ==============================================================================
> --- geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java
(added)
> +++ geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java
Wed Jun 11 11:50:45 2008
> @@ -0,0 +1,127 @@
> +/**
> + *  Licensed to the Apache Software Foundation (ASF) under one
> + *  or more contributor license agreements.  See the NOTICE file
> + *  distributed with this work for additional information
> + *  regarding copyright ownership.  The ASF licenses this file
> + *  to you under the Apache License, Version 2.0 (the
> + *  "License"); you may not use this file except in compliance
> + *  with the License.  You may obtain a copy of the License at
> + *
> + *    http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *  Unless required by applicable law or agreed to in writing,
> + *  software distributed under the License is distributed on an
> + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + *  KIND, either express or implied.  See the License for the
> + *  specific language governing permissions and limitations
> + *  under the License.
> + */
> +package org.apache.geronimo.testsupport.commands;
> +
> +import java.io.InputStream;
> +import java.io.OutputStream;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.Collections;
> +import java.util.List;
> +
> +import org.apache.geronimo.mavenplugins.geronimo.ServerProxy;
> +import org.apache.tools.ant.taskdefs.Execute;
> +import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
> +import org.apache.tools.ant.taskdefs.ExecuteWatchdog;
> +import org.apache.tools.ant.taskdefs.PumpStreamHandler;
> +import org.apache.tools.ant.taskdefs.condition.Os;
> +
> +public class CommandTestSupport {
> +        
> +    public static final String GSH = "gsh";
> +    public static final String DEPLOY = "deploy";
> +    
> +    protected static final long timeout = 30000;    
> +    protected static String geronimoHome;
> +    
> +    static {
> +        geronimoHome = getGeronimoHome();
> +    }
> +        
> +    private static String getGeronimoHome() {
> +        ServerProxy server = null;
> +        try {
> +            server = new ServerProxy("localhost", 1099, "system", "manager");      
    
> +        } catch (Exception e) {
> +            throw new RuntimeException("Unable to setup ServerProxy", e);
> +        }
> +        String home = server.getGeronimoHome();
> +        if (server.getLastError() != null) {
> +            throw new RuntimeException("Failed to get Geronimo home", server.getLastError());
> +        } else {
> +            return home;
> +        }
> +    }
> +        
> +    public CommandTestSupport() {
> +    }
> +    
> +    public void execute(String command, String[] args, InputStream in, OutputStream
out) throws Exception {
> +        execute(command, (args == null) ? null : Arrays.asList(args), in, out);
> +    }
> +        
> +    public void execute(String command, List<String> args, InputStream in, OutputStream
out) throws Exception {
> +        List<String> cmdLine = new ArrayList<String>();
> +        if (isWindows()) {
> +            cmdLine.add("cmd.exe");
> +            cmdLine.add("/c");
> +        }
> +        cmdLine.add(resolveCommandForOS(command));
> +        // add command-specific arguments
> +        cmdLine.addAll(getCommandArguments(command));
> +        // add user arguments
> +        if (args != null) {
> +            cmdLine.addAll(args);
> +        }
> +        
> +        ExecuteWatchdog watchdog = new ExecuteWatchdog( timeout );
> +        ExecuteStreamHandler streamHandler = new PumpStreamHandler( out, out, in );
> +        Execute exec = new Execute( streamHandler, watchdog );
> +        exec.setCommandline( cmdLine.toArray(new String[] {}) );
> +        List<String> env = getCommandEnvironment(command);
> +        if (!env.isEmpty()) {
> +            exec.setEnvironment(env.toArray(new String[] {}) );
> +        }
> +        exec.execute();
> +    }
> +    
> +    protected List<String> getCommandArguments(String command) {
> +        if (GSH.equals(command)) {
> +            return Arrays.asList("-T", "false");
> +        } else {
> +            return Collections.emptyList();
> +        }
> +    }
> +        
> +    protected List<String> getCommandEnvironment(String command) {
> +        if (DEPLOY.equals(command)) {
> +            //this makes the output can be captured in Linux
> +            return Arrays.asList("JAVA_OPTS=-Djline.terminal=jline.UnsupportedTerminal");
> +        } else {
> +            return Collections.emptyList();
> +        }
> +    }
> +
> +    protected String resolveCommandForOS(String command) {      
> +        if (isWindows()) {
> +            return geronimoHome + "/bin/" + command + ".bat";            
> +        } else {
> +            if (GSH.equals(command)) {
> +                return geronimoHome + "/bin/" + command;
> +            } else {
> +                return geronimoHome + "/bin/" + command + ".sh";
> +            }
> +        }     
> +    }
> +        
> +    public boolean isWindows() {
> +        return Os.isFamily("windows");
> +    }
> +    
> +}
> 
> Propchange: geronimo/server/trunk/testsupport/testsupport-commands/src/main/java/org/apache/geronimo/testsupport/commands/CommandTestSupport.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> 
> 

Mime
View raw message