incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r633511 - in /incubator/sling/trunk: ./ commons/mime/src/main/resources/META-INF/ commons/mime/src/test/java/org/apache/sling/commons/mime/internal/ extensions/apt/apt-parser/ extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/par...
Date Tue, 04 Mar 2008 15:17:10 GMT
Author: bdelacretaz
Date: Tue Mar  4 07:17:03 2008
New Revision: 633511

URL: http://svn.apache.org/viewvc?rev=633511&view=rev
Log:
SLING-305 - APT default servlet and related tests

Added:
    incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/
    incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
  (with props)
    incubator/sling/trunk/extensions/apt/apt-servlet/   (with props)
    incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml   (with props)
    incubator/sling/trunk/extensions/apt/apt-servlet/src/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/
    incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
  (with props)
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/SimpleAptRenderingTest.java
  (with props)
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/apt-test.apt
Modified:
    incubator/sling/trunk/commons/mime/src/main/resources/META-INF/mime.types
    incubator/sling/trunk/commons/mime/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
    incubator/sling/trunk/extensions/apt/apt-parser/pom.xml
    incubator/sling/trunk/launchpad/app/pom.xml
    incubator/sling/trunk/pom.xml

Modified: incubator/sling/trunk/commons/mime/src/main/resources/META-INF/mime.types
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/mime/src/main/resources/META-INF/mime.types?rev=633511&r1=633510&r2=633511&view=diff
==============================================================================
--- incubator/sling/trunk/commons/mime/src/main/resources/META-INF/mime.types (original)
+++ incubator/sling/trunk/commons/mime/src/main/resources/META-INF/mime.types Tue Mar  4 07:17:03
2008
@@ -98,7 +98,7 @@
 text/any                       any
 text/css                       css
 text/html                      html htm
-text/plain                     txt asc log text
+text/plain                     txt asc log text apt
 text/richtext                  rtx
 text/rtf                       rtf
 text/sgml                      sgml sgm

Modified: incubator/sling/trunk/commons/mime/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/mime/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java?rev=633511&r1=633510&r2=633511&view=diff
==============================================================================
--- incubator/sling/trunk/commons/mime/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
(original)
+++ incubator/sling/trunk/commons/mime/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
Tue Mar  4 07:17:03 2008
@@ -39,6 +39,8 @@
 
     private static final String TXT = "txt";
 
+    private static final String APT = "apt";
+
     private static final String TEXT_PLAIN = "text/plain";
 
     private MimeTypeServiceImpl service;
@@ -65,12 +67,13 @@
 
     public void testTxtMapping() throws Exception {
 
-        this.service.registerMimeType(TEXT_PLAIN, TXT, LOG);
+        this.service.registerMimeType(TEXT_PLAIN, TXT, LOG, APT);
 
-        assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + TXT));
-        assertEquals(TEXT_PLAIN, this.service.getMimeType(TXT));
-        assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + LOG));
-        assertEquals(TEXT_PLAIN, this.service.getMimeType(LOG));
+        final String [] exts = { TXT, LOG, APT };
+        for(String ext : exts) {
+            assertEquals("Extension " + ext + " (1)", TEXT_PLAIN, this.service.getMimeType("file."
+ ext));
+            assertEquals("Extension " + ext + " (2)", TEXT_PLAIN, this.service.getMimeType(ext));
+        }
 
         assertEquals(TEXT_PLAIN,
             this.service.getMimeType(("file." + TXT).toUpperCase()));
@@ -91,10 +94,11 @@
         try {
             this.service.registerMimeType(ins);
 
-            assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + TXT));
-            assertEquals(TEXT_PLAIN, this.service.getMimeType(TXT));
-            assertEquals(TEXT_PLAIN, this.service.getMimeType("file." + LOG));
-            assertEquals(TEXT_PLAIN, this.service.getMimeType(LOG));
+            final String [] exts = { TXT, LOG, APT };
+            for(String ext : exts) {
+                assertEquals("Extension " + ext + " (1)", TEXT_PLAIN, this.service.getMimeType("file."
+ ext));
+                assertEquals("Extension " + ext + " (2)", TEXT_PLAIN, this.service.getMimeType(ext));
+            }
 
             assertEquals(TEXT_PLAIN,
                 this.service.getMimeType(("file." + TXT).toUpperCase()));

Modified: incubator/sling/trunk/extensions/apt/apt-parser/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/pom.xml?rev=633511&r1=633510&r2=633511&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/pom.xml (original)
+++ incubator/sling/trunk/extensions/apt/apt-parser/pom.xml Tue Mar  4 07:17:03 2008
@@ -68,7 +68,8 @@
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.apt.parser.internal,
-                            org.apache.maven.doxia.*
+                            org.apache.maven.doxia.*,
+                            org.codehaus.plexus.util.*
                         </Private-Package>
                     </instructions>
                 </configuration>
@@ -85,7 +86,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>test</scope>
         </dependency>
     </dependencies>
 </project>

Added: incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java?rev=633511&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
(added)
+++ incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
Tue Mar  4 07:17:03 2008
@@ -0,0 +1,125 @@
+/*
+ * 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.apt.parser.internal;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.doxia.macro.Macro;
+import org.apache.maven.doxia.macro.MacroExecutionException;
+import org.apache.maven.doxia.macro.MacroRequest;
+import org.apache.maven.doxia.sink.Sink;
+
+/** Test the SlingAptParserImpl.
+ * 
+ *  See http://maven.apache.org/doxia/references/apt-format.html for the 
+ *  APT syntax reference
+ *  
+ *  We don't need to test all details as (I assume) everything's tested in
+ *  the doxia module that we use, but it's nice to verify our understanding
+ *  of the doxia APT syntax. 
+ */
+public class SlingAptParserImplTest extends TestCase implements MacroResolver {
+    
+    final SlingAptParserImpl parser = new SlingAptParserImpl(this);
+    
+    private static class SlingTestMacro implements Macro {
+        public void execute(Sink sink, MacroRequest request) throws MacroExecutionException
{
+            sink.text("MACRO:" + getClass().getSimpleName());
+            sink.text(", value=" + request.getParameter("value"));
+        }
+    }
+    
+    public Macro resolveMacro(String macroId) {
+        if(SlingTestMacro.class.getSimpleName().equals(macroId)) {
+            return new SlingTestMacro();
+        }
+        return null;
+    }
+
+    protected void parse(String input, String expected) throws Exception {
+        final StringWriter out = new StringWriter();
+        parser.parse(new StringReader(input), out);
+        assertEquals(expected, out.toString().trim());
+    }
+    
+    public void testNullReader() throws Exception {
+        final StringWriter out = new StringWriter();
+        try {
+            parser.parse(null, out);
+            fail("Expected NullPointerException for null input Reader");
+        } catch(NullPointerException fineThatsWhatWeExpect) {
+        }
+    }
+    
+    public void testEmpty() throws Exception {
+        parse("", "");
+    }
+    
+    public void testParaA() throws Exception {
+        parse(" para 1\n para 2","<p>para 1 para 2</p>");
+    }
+
+    public void testParaB() throws Exception {
+        parse(" para 1\n\n para 2","<p>para 1</p><p>para 2</p>");
+    }
+
+    public void testLinkA() throws Exception {
+        parse(
+            " Para {{http://www.perdu.com}}", 
+            "<p>Para <a href=\"http://www.perdu.com\">http://www.perdu.com</a></p>"
+        );
+    }
+
+    public void testLinkB() throws Exception {
+        parse(
+            " Para {{{http://www.perdu.com}text here}}", 
+            "<p>Para <a href=\"http://www.perdu.com\">text here</a></p>"
+        );
+    }
+
+    public void testHeadA() throws Exception {
+        parse("Heading here\n\n para 1","<h1>Heading here</h1><p>para 1</p>");
+    }
+    
+    public void testMacro() throws Exception {
+        parse("%{SlingTestMacro|value=foo}", "MACRO:SlingTestMacro, value\\=foo");
+    }
+    
+    public void testSections() throws Exception {
+        parse(
+            "Top\n\n* s1\n\n** s2\n\n** s2b\n\n*** s3\n\n para",
+            "<h1>Top</h1><h2>s1</h2><h3>s2</h3>\n<h3>s2b</h3><h4>s3</h4><p>para</p>"
+        );
+    }
+
+    public void testList() throws Exception {
+        parse(
+            " * 1\n para 1\n\n  * 2\n\n  * 3\n\n  para 2",
+            "<ul><li><p>1 para 1</p><ul><li><p>2</p></li><li><p>3</p><p>para
2</p></li></ul></li></ul>"
+        );
+    }
+
+    public void testMacroNotFound() throws Exception {
+        final String badName = "MacroThatDoesNotExist"; 
+        parse("%{" + badName + "}", "APT macro not found: '" + badName + "'");
+    }
+}
\ No newline at end of file

Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/extensions/apt/apt-parser/src/test/java/org/apache/sling/apt/parser/internal/SlingAptParserImplTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Propchange: incubator/sling/trunk/extensions/apt/apt-servlet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar  4 07:17:03 2008
@@ -0,0 +1,11 @@
+target
+bin
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+
+

Added: incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml?rev=633511&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml (added)
+++ incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml Tue Mar  4 07:17:03 2008
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>1-incubator-SNAPSHOT</version>
+    <relativePath>../../../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>org.apache.sling.extensions.apt.servlet</artifactId>
+  <packaging>bundle</packaging>
+  <version>2.0.0-incubator-SNAPSHOT</version>
+
+  <name>Sling - APT servlet</name>
+  <description>Servlet for *.apt requests, uses the apt-parser to convert *.apt files
to HTML.</description>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/commons/apt-parser</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/commons/apt-parser</developerConnection>
+    <url>http://svn.apache.org/viewvc/incubator/sling/trunk/commons/apt-parser</url>
+  </scm>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>org.apache.sling.apt.servlet.*</Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.extensions.apt.parser</artifactId>
+      <version>${pom.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: incubator/sling/trunk/extensions/apt/apt-servlet/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java?rev=633511&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
(added)
+++ incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
Tue Mar  4 07:17:03 2008
@@ -0,0 +1,84 @@
+package org.apache.sling.apt.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
+import org.apache.sling.apt.parser.SlingAptParser;
+
+/**
+* Parses APT structured text files and renders them in HTML
+*
+* @scr.service
+*  interface="javax.servlet.Servlet"
+*
+* @scr.component
+*  immediate="true"
+*  metatype="false"
+*
+* @scr.property
+*  name="service.description"
+*  value="Sling APT Servlet"
+*
+* @scr.property
+*  name="service.vendor"
+*  value="The Apache Software Foundation"
+*
+* Use this as the default GET servlet for apt requests
+* @scr.property
+*  name="sling.servlet.resourceTypes"
+*  value="sling/servlet/default"
+*
+* TODO for now we have to use this weird extension, added after the
+* full filename. We should add a sling.servlet.contentExtension parameter
+* to the servlet selection mechanism, and use that to tell sling to map
+* an html request to an apt file using this servlet.
+* 
+* @scr.property
+*  name="sling.servlet.extensions"
+*  value="aptml"
+*/
+
+public class SlingAptServlet extends SlingSafeMethodsServlet {
+    
+    /** @scr.reference */
+    protected SlingAptParser parser;
+    
+    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws IOException {
+        final InputStream stream = request.getResource().adaptTo(InputStream.class);
+        if(stream == null) {
+            response.sendError(
+                HttpServletResponse.SC_BAD_REQUEST, 
+                "Resource does not adapt to an InputStream: " + request.getResource()
+            );
+        }
+        
+        // TODO which encoding to use for input??
+        // Should find out from the JCR resource node
+        final String encoding = "UTF-8";
+        final Reader r = new InputStreamReader(stream, encoding);
+        final Writer w = new StringWriter();
+        try {
+            parser.parse(r, w);
+        } catch(Exception e) {
+            response.sendError(
+                HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+                "Exception while parsing APT content: " + e
+            );
+        }
+
+        final byte [] bytes = w.toString().getBytes(encoding);
+        response.setContentType("text/html");
+        response.setCharacterEncoding(encoding);
+        response.setContentLength(bytes.length);
+        response.getOutputStream().write(bytes);
+    }
+}
\ No newline at end of file

Propchange: incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/extensions/apt/apt-servlet/src/main/java/org/apache/sling/apt/servlet/SlingAptServlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: incubator/sling/trunk/launchpad/app/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/app/pom.xml?rev=633511&r1=633510&r2=633511&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/app/pom.xml (original)
+++ incubator/sling/trunk/launchpad/app/pom.xml Tue Mar  4 07:17:03 2008
@@ -421,6 +421,22 @@
             <version>2.0.0-incubator-SNAPSHOT</version>
             <optional>true</optional>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>
+                org.apache.sling.extensions.apt.servlet
+            </artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>
+                org.apache.sling.extensions.apt.parser
+            </artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+            <optional>true</optional>
+        </dependency>
 
         <!--
             Commons Dependencies provided by the Apache Felix project

Added: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/SimpleAptRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/SimpleAptRenderingTest.java?rev=633511&view=auto
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/SimpleAptRenderingTest.java
(added)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/apt/SimpleAptRenderingTest.java
Tue Mar  4 07:17:03 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.apt;
+
+import org.apache.sling.launchpad.webapp.integrationtest.HttpTestBase;
+
+public class SimpleAptRenderingTest extends HttpTestBase {
+    
+    public void testAptDocument() throws Exception {
+        testClient.mkdirs(WEBDAV_BASE_URL, "/apt-test");
+        final String toDelete = uploadTestScript("/apt-test", "apt/apt-test.apt", "apt-test.apt");
+        try {
+            // .apt returns plain text
+            getContent(HTTP_BASE_URL + "/apt-test/apt-test.apt", CONTENT_TYPE_PLAIN);
+            
+            // .apt.aptml converts APT to html
+            final String content = getContent(HTTP_BASE_URL + "/apt-test/apt-test.apt.aptml",
CONTENT_TYPE_HTML);
+            assertTrue("h1 parsed as expected (" + content + ")", content.contains("<h1>Simple
APT file test"));
+            assertTrue("h2 parsed as expected (" + content + ")", content.contains("<h2>h2
heading"));
+            assertTrue("h3 parsed as expected (" + content + ")", content.contains("<h3>h3
heading"));
+        } finally {
+            testClient.delete(toDelete);
+        }
+    }
+}

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

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

Added: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/apt-test.apt
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/apt-test.apt?rev=633511&view=auto
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/apt-test.apt
(added)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/apt/apt-test.apt
Tue Mar  4 07:17:03 2008
@@ -0,0 +1,11 @@
+Simple APT file test - this is an h1 heading
+
+* h2 heading
+
+  Text paragraph
+  with several lines
+  which must be indented in the APT file.
+  
+** h3 heading
+
+  And so on...  
\ No newline at end of file

Modified: incubator/sling/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/pom.xml?rev=633511&r1=633510&r2=633511&view=diff
==============================================================================
--- incubator/sling/trunk/pom.xml (original)
+++ incubator/sling/trunk/pom.xml Tue Mar  4 07:17:03 2008
@@ -118,6 +118,10 @@
         <module>launchpad/launchpad-content</module>
         <module>launchpad/app</module>
 
+        <!-- Extensions -->
+        <module>extensions/apt/apt-parser</module>
+        <module>extensions/apt/apt-servlet</module>
+
     </modules>
     <distributionManagement>
         <!-- place our releases in the incubator's repository -->



Mime
View raw message