jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1080306 - in /jackrabbit/sandbox/osgi: jackrabbit-bundle-it/ jackrabbit-bundle-it/src/main/ jackrabbit-bundle-it/src/main/java/ jackrabbit-bundle-it/src/main/java/org/ jackrabbit-bundle-it/src/main/java/org/apache/ jackrabbit-bundle-it/src...
Date Thu, 10 Mar 2011 18:21:26 GMT
Author: jukka
Date: Thu Mar 10 18:21:26 2011
New Revision: 1080306

URL: http://svn.apache.org/viewvc?rev=1080306&view=rev
Log:
JCR-2608: Making Jackrabbit content repo usable from OSGi (Equinox)

Simplify bundle setup. Use junit4osgi instead of pax exam for the possibility to run also
the full JCR test suite.

Added:
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/
      - copied from r1080192, jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/test/java/org/apache/jackrabbit/test/osgi/
Removed:
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/test/
Modified:
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/pom.xml
    jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/BundleTest.java
    jackrabbit/sandbox/osgi/jackrabbit-bundle/pom.xml
    jackrabbit/sandbox/osgi/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java

Modified: jackrabbit/sandbox/osgi/jackrabbit-bundle-it/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/osgi/jackrabbit-bundle-it/pom.xml?rev=1080306&r1=1080305&r2=1080306&view=diff
==============================================================================
--- jackrabbit/sandbox/osgi/jackrabbit-bundle-it/pom.xml (original)
+++ jackrabbit/sandbox/osgi/jackrabbit-bundle-it/pom.xml Thu Mar 10 18:21:26 2011
@@ -30,14 +30,16 @@
     <relativePath/>
   </parent>
   <artifactId>jackrabbit-bundle-it</artifactId>
+  <packaging>bundle</packaging>
   <name>Jackrabbit OSGi integration tests</name>
 
-  <properties>
-    <pax.exam.version>1.2.2</pax.exam.version>
-  </properties>
-
   <dependencies>
     <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+      <version>1.0.0</version>
+    </dependency>
+    <dependency>
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
       <version>2.0</version>
@@ -52,68 +54,51 @@
     <dependency>
       <groupId>org.apache.tika</groupId>
       <artifactId>tika-bundle</artifactId>
-      <version>0.9-SNAPSHOT</version>
+      <version>0.9</version>
       <scope>provided</scope>
     </dependency>
-
-    <!-- Test tooling -->
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam</artifactId>
-      <version>${pax.exam.version}</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-container-default</artifactId>
-      <version>${pax.exam.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-junit</artifactId>
-      <version>${pax.exam.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-jcr-commons</artifactId>
-      <version>2.3-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.4</version>
-      <scope>test</scope>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.commons.log</artifactId>
+      <version>2.1.2</version>
+      <scope>provided</scope>
     </dependency>
   </dependencies>
 
   <build>
     <plugins>
       <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Test-Suite>
+              org.apache.jackrabbit.test.osgi.BundleTest
+            </Test-Suite>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
         <artifactId>maven-deploy-plugin</artifactId>
         <configuration>
           <skip>true</skip>
         </configuration>
       </plugin>
       <plugin>
-        <groupId>org.ops4j.pax.exam</groupId>
-        <artifactId>maven-paxexam-plugin</artifactId>
-        <version>${pax.exam.version}</version>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-junit4osgi-plugin</artifactId>
+        <version>1.0.0</version>
         <executions>
           <execution>
             <goals>
-              <goal>generate-depends-file</goal>
-              <goal>generate-config</goal>
+              <goal>test</goal>
             </goals>
+            <configuration>
+              <deployprojectartifact>true</deployprojectartifact>
+            </configuration>
           </execution>
         </executions>
-        <configuration>
-          <options>
-            <profiles>ds,log</profiles>
-          </options>
-        </configuration>
       </plugin>
     </plugins>
   </build>

Modified: jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/BundleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/BundleTest.java?rev=1080306&r1=1080192&r2=1080306&view=diff
==============================================================================
--- jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/BundleTest.java
(original)
+++ jackrabbit/sandbox/osgi/jackrabbit-bundle-it/src/main/java/org/apache/jackrabbit/test/osgi/BundleTest.java
Thu Mar 10 18:21:26 2011
@@ -17,33 +17,37 @@
 package org.apache.jackrabbit.test.osgi;
 
 import javax.jcr.Repository;
+import javax.jcr.Session;
 
 import junit.framework.Assert;
 
-import org.apache.jackrabbit.commons.JcrUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
-import org.osgi.framework.BundleContext;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.osgi.framework.ServiceReference;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
-public class BundleTest {
+public class BundleTest extends OSGiTestCase {
 
-    @Test
-    public void testJackrabbitBundle(BundleContext context) throws Exception {
+    public void testJackrabbitBundle() throws Exception {
         ServiceReference reference =
-            context.getServiceReference(Repository.class.getName());
+            getServiceReference(Repository.class.getName());
         Assert.assertNotNull(reference);
         Assert.assertEquals(
                 "Jackrabbit",
                 reference.getProperty(Repository.REP_NAME_DESC));
 
-        Repository repository = JcrUtils.getRepository();
-        Assert.assertNotNull(repository);
+        Object service = getServiceObject(reference);
+        assertTrue(service instanceof Repository);
+
+        Repository repository = (Repository) service;
         Assert.assertEquals(
                 "Jackrabbit",
                 repository.getDescriptor(Repository.REP_NAME_DESC));
+
+        Session session = repository.login();
+        try {
+            assertEquals("/", session.getRootNode().getPath());
+        } finally {
+            session.logout();
+        }
     }
 
 }

Modified: jackrabbit/sandbox/osgi/jackrabbit-bundle/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/osgi/jackrabbit-bundle/pom.xml?rev=1080306&r1=1080305&r2=1080306&view=diff
==============================================================================
--- jackrabbit/sandbox/osgi/jackrabbit-bundle/pom.xml (original)
+++ jackrabbit/sandbox/osgi/jackrabbit-bundle/pom.xml Thu Mar 10 18:21:26 2011
@@ -45,20 +45,12 @@
             <Embed-Dependency>*;groupId=!org.osgi|javax.jcr</Embed-Dependency>
             <Embed-Transitive>true</Embed-Transitive>
             <Export-Package>
-              org.apache.jackrabbit.api.*;version=${project.version},
-              org.apache.jackrabbit.commons.*;version=${project.version},
-              org.apache.jackrabbit.util.*;version=${project.version},
-              org.apache.jackrabbit.value.*;version=${project.version}
+              org.apache.jackrabbit.api.*;version=${project.version}
             </Export-Package>
             <Import-Package>
               *,
               <!-- Optional dependencies from jackrabbit-core -->
               org.apache.jackrabbit.test;resolution:=optional,
-              org.apache.pdfbox;resolution:=optional,
-              org.apache.pdfbox.cos;resolution:=optional,
-              org.apache.pdfbox.pdmodel;resolution:=optional,
-              org.apache.pdfbox.pdmodel.encryption;resolution:=optional,
-              org.apache.pdfbox.util;resolution:=optional,
               <!-- Optional dependencies from jackrabbit-webdav -->
               javax.servlet;resolution:=optional,
               javax.servlet.http;resolution:=optional,
@@ -109,16 +101,12 @@
           <artifactId>jcr</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>org.apache.tika</groupId>
-          <artifactId>tika-parsers</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>edu.ucar</groupId>
-          <artifactId>netcdf</artifactId>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-api</artifactId>
         </exclusion>
         <exclusion>
           <groupId>org.slf4j</groupId>
-          <artifactId>slf4j-api</artifactId>
+          <artifactId>jcl-over-slf4j</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
@@ -136,6 +124,10 @@
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-api</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.slf4j</groupId>
+          <artifactId>jcl-over-slf4j</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
   </dependencies>

Modified: jackrabbit/sandbox/osgi/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/osgi/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java?rev=1080306&r1=1080305&r2=1080306&view=diff
==============================================================================
--- jackrabbit/sandbox/osgi/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java
(original)
+++ jackrabbit/sandbox/osgi/jackrabbit-bundle/src/main/java/org/apache/jackrabbit/bundle/Activator.java
Thu Mar 10 18:21:26 2011
@@ -21,7 +21,6 @@ import java.util.Hashtable;
 
 import javax.jcr.Repository;
 
-import org.apache.jackrabbit.core.RepositoryFactoryImpl;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.osgi.framework.BundleActivator;
@@ -37,7 +36,6 @@ public class Activator implements Bundle
     public void start(BundleContext context) throws Exception {
         repository = RepositoryImpl.create(
                 RepositoryConfig.install(new File("jackrabbit")));
-        RepositoryFactoryImpl.setDefaultRepository(repository);
 
         Hashtable<String, String> properties = new Hashtable<String, String>();
         for (String key : repository.getDescriptorKeys()) {
@@ -53,7 +51,6 @@ public class Activator implements Bundle
     public void stop(BundleContext context) throws Exception {
         registration.unregister();
 
-        RepositoryFactoryImpl.setDefaultRepository(null);
         repository.shutdown();
     }
 



Mime
View raw message