incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1000497 - in /sling/trunk/launchpad: integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ integration-tests/src/main/resources/integration-test/ test-services/ test-services/src/main/java/org/apache/sling/laun...
Date Thu, 23 Sep 2010 15:27:50 GMT
Author: bdelacretaz
Date: Thu Sep 23 15:27:50 2010
New Revision: 1000497

URL: http://svn.apache.org/viewvc?rev=1000497&view=rev
Log:
SLING-1798 - test enums from a JSP script

Added:
    sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
  (with props)
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
  (with props)
Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
    sling/trunk/launchpad/test-services/pom.xml

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java?rev=1000497&r1=1000496&r2=1000497&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
Thu Sep 23 15:27:50 2010
@@ -96,6 +96,21 @@ public class JspScriptingTest extends Js
             }
         }
     }
+    
+    public void testEnum() throws Exception {
+        String toDelete = null;
+        try {
+            toDelete = uploadTestScript(unstructuredNode.scriptPath, "enum-test.jsp", "txt.jsp");
+            final String content = getContent(unstructuredNode.nodeUrl + ".txt", CONTENT_TYPE_PLAIN);
+            for(String expected : new String[] { "FOO=FOO", "BAR=BAR"}) {
+                assertTrue("Content contains '" + expected + "'(" + content + ")", content.contains(expected));
+            }
+        } finally {
+            if(toDelete != null) {
+                testClient.delete(toDelete);
+            }
+        }
+    }
 
     private void checkContent(TestNode tn) throws Exception {
         final String content = getContent(tn.nodeUrl + ".html", CONTENT_TYPE_HTML);

Added: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp?rev=1000497&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
Thu Sep 23 15:27:50 2010
@@ -0,0 +1,33 @@
+<%--
+/*
+ * 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.
+ */
+--%>
+<%@page 
+  session="false"
+  contentType="text/plain"
+  import="org.apache.sling.launchpad.testservices.exported.TestEnum"
+%>
+
+1) FOO=<%
+  out.println(TestEnum.parse("this contains foo.").toString());
+%>
+
+2) BAR=<%
+  out.println(TestEnum.BAR.toString());
+%>
\ No newline at end of file

Propchange: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/enum-test.jsp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/trunk/launchpad/test-services/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/pom.xml?rev=1000497&r1=1000496&r2=1000497&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/pom.xml (original)
+++ sling/trunk/launchpad/test-services/pom.xml Thu Sep 23 15:27:50 2010
@@ -54,6 +54,9 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Export-Package>
+                          org.apache.sling.launchpad.testservices.exported.*
+                        </Export-Package>
                         <Private-Package>
                             org.apache.sling.launchpad.testservices.*
                         </Private-Package>

Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java?rev=1000497&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
(added)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
Thu Sep 23 15:27:50 2010
@@ -0,0 +1,13 @@
+package org.apache.sling.launchpad.testservices.exported;
+
+public enum TestEnum {
+    FOO,
+    BAR;
+    
+    public static TestEnum parse(String str) {
+        if(str.contains("foo")) {
+            return FOO;
+        }
+        return BAR;
+    }
+}

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/exported/TestEnum.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message