incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1070017 - in /sling/trunk/samples: ./ installing-dependencies/ installing-dependencies/src/ installing-dependencies/src/main/ installing-dependencies/src/main/java/ installing-dependencies/src/main/java/org/ installing-dependencies/src/mai...
Date Sat, 12 Feb 2011 03:09:37 GMT
Author: justin
Date: Sat Feb 12 03:09:37 2011
New Revision: 1070017

URL: http://svn.apache.org/viewvc?rev=1070017&view=rev
Log:
adding sample of maven-dependency-plugin plus maven-sling-plugin to install dependencies into
a running Sling/Felix container

Added:
    sling/trunk/samples/installing-dependencies/
    sling/trunk/samples/installing-dependencies/pom.xml
    sling/trunk/samples/installing-dependencies/src/
    sling/trunk/samples/installing-dependencies/src/main/
    sling/trunk/samples/installing-dependencies/src/main/java/
    sling/trunk/samples/installing-dependencies/src/main/java/org/
    sling/trunk/samples/installing-dependencies/src/main/java/org/apache/
    sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/
    sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/
    sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/
    sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/MultiValuedResourceTypeTest.java
Modified:
    sling/trunk/samples/pom.xml

Added: sling/trunk/samples/installing-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/samples/installing-dependencies/pom.xml?rev=1070017&view=auto
==============================================================================
--- sling/trunk/samples/installing-dependencies/pom.xml (added)
+++ sling/trunk/samples/installing-dependencies/pom.xml Sat Feb 12 03:09:37 2011
@@ -0,0 +1,127 @@
+<?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>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>installing-dependencies-sample</artifactId>
+    <packaging>bundle</packaging>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>Dependency Install Sample</name>
+    <description>Sample project showing how to install dependencies using a combination
of maven-dependency-plugin and maven-sling-plugin</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <version>2.0.1</version>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.sling.samples.dependenciesinstall</Export-Package>
+                        <Sling-Test-Regexp>.*Test</Sling-Test-Regexp>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-testsupport</id>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <includeArtifactIds>org.apache.sling.junit.core</includeArtifactIds>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.junit.core</artifactId>
+            <version>0.1.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.api</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <profiles>
+        <profile>
+            <id>autoInstallBundles</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.sling</groupId>
+                        <artifactId>maven-sling-plugin</artifactId>
+                        <version>2.0.4-incubator</version>
+                        <executions>
+                            <execution>
+                                <id>install-bundle</id>
+                                <goals>
+                                    <goal>install</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>install-dependency1</id>
+                                <goals>
+                                    <goal>install-file</goal>
+                                </goals>
+                                <phase>install</phase>
+                                <configuration>
+                                    <bundleFileName>${project.build.directory}/dependency/org.apache.sling.junit.core-0.1.1-SNAPSHOT.jar</bundleFileName>
+                                </configuration>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <slingUrl>http://localhost:8888/system/console</slingUrl>
+                            <user>admin</user>
+                            <password>admin</password>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Added: sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/MultiValuedResourceTypeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/MultiValuedResourceTypeTest.java?rev=1070017&view=auto
==============================================================================
--- sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/MultiValuedResourceTypeTest.java
(added)
+++ sling/trunk/samples/installing-dependencies/src/main/java/org/apache/sling/samples/dependenciesinstall/MultiValuedResourceTypeTest.java
Sat Feb 12 03:09:37 2011
@@ -0,0 +1,55 @@
+package org.apache.sling.samples.dependenciesinstall;
+
+import java.util.Date;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import junit.framework.Assert;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.junit.annotations.SlingAnnotationsTestRunner;
+import org.apache.sling.junit.annotations.TestReference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SlingAnnotationsTestRunner.class)
+public class MultiValuedResourceTypeTest {
+
+    @TestReference
+    private ResourceResolverFactory resourceResolverFactory;
+
+    private String testPath;
+
+    private ResourceResolver resourceResolver;
+
+    @Before
+    public void setup() throws Exception {
+        resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
+
+        Session session = resourceResolver.adaptTo(Session.class);
+        testPath = "/test_" + new Date().getTime();
+        Node testNode = session.getRootNode().addNode(testPath.substring(1), "nt:unstructured");
+        testNode.setProperty("sling:resourceType", new String[] { "foo/bar", "bar/foo" });
+        session.save();
+    }
+    
+    @Test
+    public void test() {
+        Resource res = resourceResolver.resolve(testPath);
+        Assert.assertEquals("foo/bar", res.getResourceType());
+    }
+
+    @After
+    public void teardown() throws Exception {
+        Session session = resourceResolver.adaptTo(Session.class);
+        Node testNode = session.getNode(testPath);
+        testNode.remove();
+        session.save();
+    }
+
+}

Modified: sling/trunk/samples/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/samples/pom.xml?rev=1070017&r1=1070016&r2=1070017&view=diff
==============================================================================
--- sling/trunk/samples/pom.xml (original)
+++ sling/trunk/samples/pom.xml Sat Feb 12 03:09:37 2011
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -16,8 +16,7 @@
   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">
+--><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>
 
@@ -67,5 +66,6 @@
           <module>webloader/ui</module>
           <module>custom-login-form</module>
           <module>slingbucks</module>
-    </modules>
-</project>
+          <module>installing-dependencies-sample</module>
+  </modules>
+</project>
\ No newline at end of file



Mime
View raw message