Author: wsmoak
Date: Sat Jun 17 23:11:04 2006
New Revision: 415099

URL: http://svn.apache.org/viewvc?rev=415099&view=rev
Log:
Adapt the Shale Blank system integration test to use the new CargoTestSetup 
added to Shale Test in SHALE-193.
To run the tests, enable the 'itest' profile:  mvn install -Pitest
TODO:  Determine how to stop Tomcat from writing SESSIONS.ser to ${basedir} 
(the shale-blank directory).

Added:
    
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
   (with props)
Modified:
    struts/shale/trunk/shale-apps/shale-blank/pom.xml
    
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/WelcomeTestCase.java

Modified: struts/shale/trunk/shale-apps/shale-blank/pom.xml
URL: 
http://svn.apache.org/viewvc/struts/shale/trunk/shale-apps/shale-blank/pom.xml?rev=415099&r1=415098&r2=415099&view=diff
==============================================================================
--- struts/shale/trunk/shale-apps/shale-blank/pom.xml (original)
+++ struts/shale/trunk/shale-apps/shale-blank/pom.xml Sat Jun 17 23:11:04 2006
@@ -129,12 +129,12 @@
                                     <goal>test</goal>
                                 </goals>
                                 <configuration>
-                                    <excludes>
-                                        <exclude>none</exclude>
-                                    </excludes>
                                     <includes>
                                         <include>**/systest/**</include>
                                     </includes>
+                                    <excludes>
+                                        
<exclude>**/WelcomeTestCase.java</exclude>
+                                    </excludes>
                                     <systemProperties>
                                         <property>
                                             <name>url</name>
@@ -144,6 +144,18 @@
                                         <property>
                                             <name>cargo.tomcat5x.home</name>
                                             
<value>${cargo.tomcat5x.home}</value>
+                                        </property>
+                                        <property>
+                                            <name>cargo.tomcat5x.output</name>
+                                            
<value>${basedir}/target/tomcat5x.out</value>
+                                        </property>
+                                        <property>
+                                            <name>cargo.tomcat5x.log</name>
+                                            
<value>${basedir}/target/tomcat5x.log</value>
+                                        </property>
+                                        <property>
+                                            <name>cargo.deployable</name>
+                                            
<value>${basedir}/target/${artifactId}.war</value>
                                         </property>
                                     </systemProperties>
                                 </configuration>

Added: 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
URL: 
http://svn.apache.org/viewvc/struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java?rev=415099&view=auto
==============================================================================
--- 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
 (added)
+++ 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
 Sat Jun 17 23:11:04 2006
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.blank.systest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import org.apache.shale.test.cargo.CargoTestSetup;
+
+/**
+ * Setup for running tests in Tomcat 5x.
+ */
+public class Tomcat5xWelcomeTestCase extends TestCase {
+
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public Tomcat5xWelcomeTestCase(String testName) {
+        super(testName);
+    }
+
+    /**
+     * Set the necessary System properties, and return the suite of tests,
+     * wrapped in CargoTestSetup to start and stop the container.
+     *
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        // Set the System properties expected by CargoTestSetup
+        System.setProperty( "cargo.container.home",
+                System.getProperty("cargo.tomcat5x.home"));
+
+        System.setProperty( "cargo.container.output",
+                System.getProperty("cargo.tomcat5x.output"));
+
+        System.setProperty( "cargo.container.log",
+                System.getProperty("cargo.tomcat5x.log"));
+
+        // Create a TestSuite, and add all of the application's tests
+        TestSuite suite = new TestSuite();
+        suite.addTestSuite(WelcomeTestCase.class);
+        //suite.addTestSuite(OtherTestCase.class);
+
+        // Wrap the TestSuite in a TestSetup which will start/stop Tomcat 5x
+        return new CargoTestSetup(suite);
+    }
+
+}

Propchange: 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/Tomcat5xWelcomeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/WelcomeTestCase.java
URL: 
http://svn.apache.org/viewvc/struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/WelcomeTestCase.java?rev=415099&r1=415098&r2=415099&view=diff
==============================================================================
--- 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/WelcomeTestCase.java
 (original)
+++ 
struts/shale/trunk/shale-apps/shale-blank/src/test/java/org/apache/shale/blank/systest/WelcomeTestCase.java
 Sat Jun 17 23:11:04 2006
@@ -18,21 +18,10 @@
 
 package org.apache.shale.blank.systest;
 
-import java.io.File;
 import java.util.ResourceBundle;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.shale.test.htmlunit.AbstractHtmlUnitTestCase;
-import org.codehaus.cargo.generic.DefaultContainerFactory;
-import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory;
-import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
-import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
-import org.codehaus.cargo.container.ContainerType;
-import org.codehaus.cargo.container.InstalledLocalContainer;
-import org.codehaus.cargo.container.deployable.DeployableType;
-import org.codehaus.cargo.container.deployable.Deployable;
-import org.codehaus.cargo.container.configuration.LocalConfiguration;
-import org.codehaus.cargo.container.configuration.ConfigurationType;
 
 /**
  * <p>System test case for the <code>/welcome.jsp</code> page.</p>
@@ -62,8 +51,6 @@
             ResourceBundle.getBundle("org.apache.shale.blank.Bundle");
 
 
-    private InstalledLocalContainer container;
-
     // ------------------------------------------------------ Test Setup 
Methods
 
 
@@ -72,28 +59,6 @@
      */
     public void setUp() throws Exception {
 
-        Deployable war = new DefaultDeployableFactory().createDeployable(
-                "tomcat5x",
-                System.getProperty("basedir")+"/target/shale-blank.war",
-                DeployableType.WAR);
-
-        ConfigurationFactory configurationFactory = new 
DefaultConfigurationFactory();
-
-        LocalConfiguration configuration =
-                (LocalConfiguration) configurationFactory.createConfiguration(
-                        "tomcat5x", ConfigurationType.STANDALONE);
-
-        configuration.addDeployable(war);
-
-        container = (InstalledLocalContainer)
-                new DefaultContainerFactory().createContainer(
-                        "tomcat5x", ContainerType.INSTALLED, configuration);
-
-        container.setHome(new File(System.getProperty("cargo.tomcat5x.home")));
-        container.setOutput(new File( System.getProperty("basedir") + 
"/target/tomcat5x.out"));
-
-        container.start();
-
         super.setUp();
         page("/");
 
@@ -116,7 +81,6 @@
     public void tearDown() {
 
         super.tearDown();
-        container.stop();
 
     }
 


Reply via email to