incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r950744 [3/3] - in /sling/trunk: ./ launchpad/integration-tests/ launchpad/integration-tests/src/ launchpad/integration-tests/src/main/ launchpad/integration-tests/src/main/java/ launchpad/integration-tests/src/main/java/org/ launchpad/inte...
Date Wed, 02 Jun 2010 20:06:28 GMT
Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test-3.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test-3.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test-3.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test-3.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test-3.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.ecma
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.ecma)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.ecma?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.ecma&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.ecma&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.jsp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.jsp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.jsp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/rendering-test.jsp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/rendering-test.jsp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel1.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel1.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel1.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel1.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel1.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel2.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel2.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel2.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel2.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel2.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel3.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel3.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel3.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test-sel3.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test-sel3.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/request-attribute-test.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/request-attribute-test.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/jsp-engine-setup.jsp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/jsp-engine-setup.jsp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/jsp-engine-setup.jsp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/servertest.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/servertest.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.jsp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/servertest.jsp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.jsp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/serverscripts/servertest.jsp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/servertest.jsp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/sling-logo.png
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/sling-logo.png)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/sling-logo.png?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/sling-logo.png&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/sling-logo.png&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
Binary files - no diff available.

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/standalone-test.ecma
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/standalone-test.ecma)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/standalone-test.ecma?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/standalone-test.ecma&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/standalone-test.ecma&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.html
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.html)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.html?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.html&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.html&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.js
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.js)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.js?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.js&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.js&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.json
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.json)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.json?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.json&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.json&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.txt
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.txt)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.txt?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.txt&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.txt&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.xml
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.xml)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.xml?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.xml&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.xml&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.zip
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.zip)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.zip?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/testfile.zip&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/testfile.zip&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
Binary files - no diff available.

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/usermanager/privileges-info.json.esp
(from r950106, sling/trunk/launchpad/testing/src/test/resources/integration-test/usermanager/privileges-info.json.esp)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/usermanager/privileges-info.json.esp?p2=sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/usermanager/privileges-info.json.esp&p1=sling/trunk/launchpad/testing/src/test/resources/integration-test/usermanager/privileges-info.json.esp&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Copied: sling/trunk/launchpad/integration-tests/src/main/resources/log4j.properties (from
r950106, sling/trunk/launchpad/testing/src/test/resources/log4j.properties)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/log4j.properties?p2=sling/trunk/launchpad/integration-tests/src/main/resources/log4j.properties&p1=sling/trunk/launchpad/testing/src/test/resources/log4j.properties&r1=950106&r2=950744&rev=950744&view=diff
==============================================================================
    (empty)

Modified: sling/trunk/launchpad/testing/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/pom.xml?rev=950744&r1=950743&r2=950744&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/pom.xml (original)
+++ sling/trunk/launchpad/testing/pom.xml Wed Jun  2 20:06:21 2010
@@ -240,12 +240,15 @@
                                     <goal>test</goal>
                                 </goals>
                                 <configuration>
+                                    <!--  needed to make it possible to scan the jar -->
+                                    <useManifestOnlyJar>false</useManifestOnlyJar>
+                                
                                     <excludes>
                                         <exclude>none</exclude>
                                     </excludes>
                                     <includes>
                                         <include>
-                                            ${integration.test.code.path}/**/*Test.java
+                                            **/launchpad/testing/TestAll.java
                                         </include>
                                     </includes>
                                     <systemProperties>
@@ -333,6 +336,9 @@
                                 <exclude>
                                     ${integration.test.code.path}/**/*.java
                                 </exclude>
+                                <exclude>
+                                     **/launchpad/testing/TestAll.java
+                                </exclude>
                             </excludes>
                         </configuration>
                     </plugin>
@@ -360,6 +366,12 @@
     </profiles>
 
     <dependencies>
+        <dependency>
+             <groupId>org.apache.sling</groupId>
+             <artifactId>org.apache.sling.launchpad.integration-tests</artifactId>
+             <version>0.0.1-SNAPSHOT</version>
+             <scope>test</scope>
+        </dependency>
 
         <!--  The basic Sling WebApp -->
         <dependency>

Added: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/testing/TestAll.java?rev=950744&view=auto
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
(added)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
Wed Jun  2 20:06:21 2010
@@ -0,0 +1,170 @@
+/*
+ * 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.sling.launchpad.testing;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Pattern;
+
+/**
+ *
+ */
+public class TestAll extends TestCase {
+    private static final Logger LOGGER = LoggerFactory.getLogger(TestAll.class);
+
+    @SuppressWarnings("unchecked")
+    public static Test suite() {
+        ClassLoader sysClassLoader = TestAll.class.getClassLoader();
+        
+        
+        
+        List<String> matchingClasses = new ArrayList<String>();
+        // Get the URLs
+        URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
+        String testPattern = System.getProperty("integrationTestPattern",
+                "**/launchpad/webapp/integrationtest/**/*Test");
+        String testRegex = convertToRegex(testPattern);
+        Pattern pattern = Pattern.compile(testRegex);
+        LOGGER.info("Using Pattern " + testRegex);
+        for (URL u : urls) {
+            try {
+                matchingClasses.addAll(scanFile(new File(u.toURI()), pattern));
+            } catch (URISyntaxException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+        ClassLoader cl = TestAll.class.getClassLoader();
+        Set<Class<TestCase>> classSet = new HashSet<Class<TestCase>>();
+        for (String classFile : matchingClasses) {
+            String className = classFileToName(classFile);
+            try {
+                Class<TestCase> c = (Class<TestCase>) cl.loadClass(className);
+                if (!c.isInterface() && !Modifier.isAbstract(c.getModifiers()) )
{
+                    LOGGER.info("Added "+className);
+                    classSet.add(c);
+                }
+            } catch (ClassNotFoundException e) {
+                e.printStackTrace();
+            }
+        }
+        TestSuite suite = new TestSuite(classSet.toArray(new Class[classSet.size()]),"Sling
Inregration Tests matching "+testPattern);
+      
+        return suite;
+    }
+
+    /**
+     * @param classFile
+     * @return
+     */
+    private static String classFileToName(String classFile) {
+        String className =  classFile.substring(0, classFile.length() - (".class".length()))
+                .replace('/', '.');
+        if ( className.charAt(0) == '.' ) {
+            className = className.substring(1);
+        }
+        return className;
+    }
+
+    /**
+     * @param testPattern
+     * @return
+     */
+    private static String convertToRegex(String testPattern) {
+        return testPattern.replace("**/", ".a?").replace("*", ".a?").replace(
+                ".a?", ".*?").replace("/", "\\/")
+                + "\\.class$";
+    }
+
+    /**
+     * @param u
+     * @return
+     * @throws IOException
+     * @throws URISyntaxException
+     */
+    private static List<String> scanFile(File f, Pattern pattern)
+            throws URISyntaxException, IOException {
+        List<String> classPathMatches = new ArrayList<String>();
+        if (f.isFile()) {
+            scanJar(f, pattern, classPathMatches);
+        } else {
+            scanDir(f, pattern, classPathMatches, f.getPath().length());
+        }
+        return classPathMatches;
+    }
+
+    /**
+     * @param f
+     * @param pattern
+     * @return
+     */
+    private static void scanDir(File f, Pattern pattern,
+            List<String> classPathMatches, int trim) {
+        if (f.isFile()) {
+            String name = f.getPath().substring(trim);
+            if (pattern.matcher(name).matches()) {
+                classPathMatches.add(name);
+            }
+        } else {
+            for (File cf : f.listFiles()) {
+                scanDir(cf, pattern, classPathMatches, trim);
+            }
+        }
+    }
+
+    /**
+     * @param u
+     * @return
+     * @throws URISyntaxException
+     * @throws IOException
+     */
+    private static void scanJar(File f, Pattern pattern,
+            List<String> classPathMatches) throws URISyntaxException,
+            IOException {
+        JarFile jarFile = new JarFile(f);
+        for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements();) {
+            JarEntry je = e.nextElement();
+            String entryName = je.getName();
+            if (pattern.matcher(entryName).matches()) {
+                classPathMatches.add(entryName);
+            }
+        }
+        jarFile.close();
+    }
+
+}

Propchange: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: sling/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=950744&r1=950743&r2=950744&view=diff
==============================================================================
--- sling/trunk/pom.xml (original)
+++ sling/trunk/pom.xml Wed Jun  2 20:06:21 2010
@@ -146,6 +146,7 @@
                 <module>launchpad/test-services</module>
                 <module>launchpad/test-services-war</module>
                 <module>launchpad/testing</module>
+                <module>launchpad/integration-tests</module>
             </modules>
         </profile>
       <!-- Profile for including samples -->



Mime
View raw message