incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r801681 - in /sling/trunk/launchpad/testing/src/test: java/org/apache/sling/launchpad/webapp/integrationtest/ java/org/apache/sling/launchpad/webapp/integrationtest/issues/ resources/integration-test/serverscripts/
Date Thu, 06 Aug 2009 15:42:36 GMT
Author: bdelacretaz
Date: Thu Aug  6 15:42:36 2009
New Revision: 801681

URL: http://svn.apache.org/viewvc?rev=801681&view=rev
Log:
SLING-1075 use specific JSP script engine config during testing

Added:
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java
  (with props)
    sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp
  (with props)
Modified:
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ExecuteScriptTest.java
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ExecuteScriptTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ExecuteScriptTest.java?rev=801681&r1=801680&r2=801681&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ExecuteScriptTest.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ExecuteScriptTest.java
Thu Aug  6 15:42:36 2009
@@ -17,7 +17,7 @@
 package org.apache.sling.launchpad.webapp.integrationtest;
 
 /** Test the executeScript test method */
-public class ExecuteScriptTest extends RenderingTestBase {
+public class ExecuteScriptTest extends JspTestBase {
     
     public void testEspScript() throws Exception {
         final String content = executeScript("serverscripts/servertest.esp");

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java?rev=801681&r1=801680&r2=801681&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
Thu Aug  6 15:42:36 2009
@@ -29,7 +29,7 @@
 
 
 /** Test the {link ScriptHelper#forward) functionality */
- public class JspForwardTest extends HttpTestBase {
+ public class JspForwardTest extends JspTestBase {
 
     private String nodeUrlA;
     private String testTextA;

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java?rev=801681&r1=801680&r2=801681&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
Thu Aug  6 15:42:36 2009
@@ -29,7 +29,7 @@
 
 
 /** Test the {link ScriptHelper#include) functionality */
- public class JspIncludeTest extends HttpTestBase {
+ public class JspIncludeTest extends JspTestBase {
 
     private String nodeUrlA;
     private String testTextA;

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java?rev=801681&r1=801680&r2=801681&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
Thu Aug  6 15:42:36 2009
@@ -23,7 +23,7 @@
  *  TODO this class can be generalized to be used for any scripting language,
  *  that would help in testing all scripting engines.
  */
-public class JspScriptingTest extends HttpTestBase {
+public class JspScriptingTest extends JspTestBase {
 
     private String testRootUrl;
     private TestNode rtNode;
@@ -87,8 +87,6 @@
             final String [] scripts = { "jsp1.jsp", "jsp2.jsp" };
             for(String script : scripts) {
                 toDelete = uploadTestScript(unstructuredNode.scriptPath, script, "html.jsp");
-                // scripts are only checked every 4 seconds for a change (by default) - so
we wait 5 seconds
-                Thread.sleep(5000);
                 final String content = getContent(unstructuredNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
                 final String expected = "text from " + script + ":" + unstructuredNode.testText;
                 assertTrue("Content contains '" + expected + "'(" + content + ")", content.contains(expected));

Added: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java?rev=801681&view=auto
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java
(added)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java
Thu Aug  6 15:42:36 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.webapp.integrationtest;
+
+/** Base class for tests that use JSP - configures the JSP
+ *  scripting engine in a test-friendly way
+ */
+public class JspTestBase extends RenderingTestBase {
+
+    public static final String SCRIPT = "serverscripts/jsp-engine-setup.jsp";
+    private static boolean jspEngineConfigured;
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        if(!jspEngineConfigured) {
+            final String content = executeScript(SCRIPT);
+            assertTrue("JSP engine setup script must return success message", content.contains("Configuration
updated"));
+            jspEngineConfigured = true;
+            System.err.println("JSP script engine configured using " + SCRIPT);
+        }
+    }
+}

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

Propchange: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspTestBase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java?rev=801681&r1=801680&r2=801681&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
(original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING457Test.java
Thu Aug  6 15:42:36 2009
@@ -21,9 +21,9 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.launchpad.webapp.integrationtest.JspTestBase;
 
-public class SLING457Test extends HttpTestBase {
+public class SLING457Test extends JspTestBase {
 
     private String testRootUrl;
 

Added: sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp?rev=801681&view=auto
==============================================================================
--- sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp
(added)
+++ sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp
Thu Aug  6 15:42:36 2009
@@ -0,0 +1,65 @@
+<!--
+/*
+ * 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.
+-->
+
+<!-- 
+    Configuration script to setup the JSP scripting engine
+    for testing: sets development mode and interval 0 for
+    checking script updates.
+ -->
+
+<%@ page import="
+    org.osgi.service.cm.ConfigurationAdmin,
+    org.osgi.service.cm.Configuration,
+    java.util.Dictionary,
+    java.util.Hashtable
+"%>
+<%@page session="false"%>
+<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
+<sling:defineObjects/>
+
+<%
+out.println("<pre>");
+final String JSPConfig = "org.apache.sling.scripting.jsp.JspScriptEngineFactory";
+ConfigurationAdmin ca = sling.getService(ConfigurationAdmin.class);
+out.println("ca=" + ca);
+final Configuration c = ca.getConfiguration(JSPConfig);
+out.println("c=" + c);
+
+Dictionary d = c.getProperties();
+if(d == null) {
+    d = new Hashtable();
+}
+
+final String interval = "jasper.modificationTestInterval";
+out.println(interval + " was " + d.get(interval));
+d.put(interval, new Integer(0));
+out.println(interval + " is now " + d.get(interval));
+
+final String dev = "jasper.development";
+out.println(dev + " was " + d.get(dev));
+d.put(dev, new Boolean(true));
+out.println(dev + " is now " + d.get(dev));
+
+c.setBundleLocation(null);
+c.update(d);
+out.println("Configuration updated: " + JSPConfig);
+
+out.println("</pre>");
+%>
\ No newline at end of file

Propchange: sling/trunk/launchpad/testing/src/test/resources/integration-test/serverscripts/jsp-engine-setup.jsp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message