incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1463585 - in /sling/trunk: ./ launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ launchpad/test-bundles/src/main/bundles/ launchpad/test-fragment/ launchpad/test-fragment/src/ launchpad/test-fragme...
Date Tue, 02 Apr 2013 15:06:52 GMT
Author: bdelacretaz
Date: Tue Apr  2 15:06:52 2013
New Revision: 1463585

URL: http://svn.apache.org/r1463585
Log:
SLING-2808 - test packages exported from a fragment bundle, disabled for now

Added:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ExportedPackagesTest.java
    sling/trunk/launchpad/test-fragment/   (with props)
    sling/trunk/launchpad/test-fragment/pom.xml
    sling/trunk/launchpad/test-fragment/src/
    sling/trunk/launchpad/test-fragment/src/main/
    sling/trunk/launchpad/test-fragment/src/main/java/
    sling/trunk/launchpad/test-fragment/src/main/java/org/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/
    sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/ClassFromFragment.java
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ExportedPackageServlet.java
Modified:
    sling/trunk/launchpad/test-bundles/src/main/bundles/list.xml
    sling/trunk/pom.xml

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ExportedPackagesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ExportedPackagesTest.java?rev=1463585&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ExportedPackagesTest.java
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ExportedPackagesTest.java
Tue Apr  2 15:06:52 2013
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+public class ExportedPackagesTest extends HttpTestBase {
+
+    private void assertExported(String pack) throws Exception {
+        final String content = getContent(HTTP_BASE_URL + "/.EXPORTED_PACKAGES.txt?package="
+ pack, CONTENT_TYPE_PLAIN);
+        final String marker = "PACKAGE FOUND:";
+        assertTrue("Expecting '" + marker + "' in content '" + content + "'", content.contains(marker));
+        assertTrue("Expecting '" + pack + "' in content '" + content + "'", content.contains(pack));
+    }
+    
+    public void testSlingApiPackage() throws Exception {
+        assertExported("org.apache.sling.api");
+    }
+    
+    public void testPackageFromTestServices() throws Exception {
+        assertExported("org.apache.sling.launchpad.testservices.exported");
+    }
+    
+    /** TODO fails due to SLING-2808 */
+    public void DISABLED_testPackageFromFragment() throws Exception {
+        assertExported("org.apache.sling.launchpad.testservices.fragment.testpackage");
+    }
+}

Modified: sling/trunk/launchpad/test-bundles/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-bundles/src/main/bundles/list.xml?rev=1463585&r1=1463584&r2=1463585&view=diff
==============================================================================
--- sling/trunk/launchpad/test-bundles/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/test-bundles/src/main/bundles/list.xml Tue Apr  2 15:06:52 2013
@@ -48,6 +48,11 @@
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.launchpad.test-fragment</artifactId>
+            <version>2.0.9-SNAPSHOT</version>
+        </bundle>
+        <bundle>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.launchpad.test-services-war</artifactId>
             <version>2.0.8</version>
             <type>war</type>

Propchange: sling/trunk/launchpad/test-fragment/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Apr  2 15:06:52 2013
@@ -0,0 +1,17 @@
+target
+sling
+bin
+logs
+jackrabbit-repository
+derby.log
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+maven-eclipse.xml
+cachedir
+
+

Added: sling/trunk/launchpad/test-fragment/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-fragment/pom.xml?rev=1463585&view=auto
==============================================================================
--- sling/trunk/launchpad/test-fragment/pom.xml (added)
+++ sling/trunk/launchpad/test-fragment/pom.xml Tue Apr  2 15:06:52 2013
@@ -0,0 +1,71 @@
+<?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>15</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.launchpad.test-fragment</artifactId>
+    <packaging>bundle</packaging>
+    <version>2.0.9-SNAPSHOT</version>
+
+    <name>Apache Sling Launchpad Testing Fragment Bundle</name>
+    <description>
+        Sling fragment bundle used by the Launchpad Testing integration tests
+    </description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-fragment</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/launchpad/test-fragment</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/launchpad/test-fragment</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.launchpad.testservices.fragment.*
+                        </Export-Package>
+                        <Private-Package>
+                            org.apache.sling.launchpad.testservices.*
+                        </Private-Package>
+                        <Fragment-Host>
+                            org.apache.sling.launchpad.test-services
+                        </Fragment-Host>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/ClassFromFragment.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/ClassFromFragment.java?rev=1463585&view=auto
==============================================================================
--- sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/ClassFromFragment.java
(added)
+++ sling/trunk/launchpad/test-fragment/src/main/java/org/apache/sling/launchpad/testservices/fragment/testpackage/ClassFromFragment.java
Tue Apr  2 15:06:52 2013
@@ -0,0 +1,20 @@
+/*
+ * 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.testservices.fragment.testpackage;
+
+public class ClassFromFragment {
+}

Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ExportedPackageServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ExportedPackageServlet.java?rev=1463585&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ExportedPackageServlet.java
(added)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/ExportedPackageServlet.java
Tue Apr  2 15:06:52 2013
@@ -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.
+ */
+package org.apache.sling.launchpad.testservices.servlets;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/** Test servlet for SLING-2808 */
+@Component(immediate=true, metatype=false)
+@Service(value=javax.servlet.Servlet.class)
+@Properties({
+    @Property(name="service.description", value="Exported packages Test Servlet"),
+    @Property(name="service.vendor", value="The Apache Software Foundation"),
+    @Property(name="sling.servlet.resourceTypes", value="sling/servlet/default"),
+    @Property(name="sling.servlet.selectors", value="EXPORTED_PACKAGES"),
+    @Property(name="sling.servlet.extensions", value="txt")
+})
+@SuppressWarnings("serial")
+public class ExportedPackageServlet extends SlingSafeMethodsServlet {
+    @Reference
+    private PackageAdmin packageAdmin;
+
+    @Override
+    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)

+            throws ServletException, IOException {
+        final String packName = request.getParameter("package");
+        final ExportedPackage p = packageAdmin.getExportedPackage(packName);
+        if(p == null) {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND, "Package not found: " +
packName);
+        } else {
+            response.setContentType("text/plain");
+            response.setCharacterEncoding("UTF-8");
+            response.getWriter().write("PACKAGE FOUND: ");
+            response.getWriter().write(p.toString());
+            response.getWriter().flush();
+        }
+    }
+}
\ No newline at end of file

Modified: sling/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=1463585&r1=1463584&r2=1463585&view=diff
==============================================================================
--- sling/trunk/pom.xml (original)
+++ sling/trunk/pom.xml Tue Apr  2 15:06:52 2013
@@ -218,6 +218,7 @@
             <modules>
                 <module>launchpad/test-services</module>
                 <module>launchpad/test-services-war</module>
+                <module>launchpad/test-fragment</module>
                 <module>launchpad/test-bundles</module>
                 <module>launchpad/integration-tests</module>
                 <module>launchpad/testing</module>



Mime
View raw message