jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1547396 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java oak-it/osgi/test-bundles.xml
Date Tue, 03 Dec 2013 14:15:08 GMT
Author: jukka
Date: Tue Dec  3 14:15:07 2013
New Revision: 1547396

URL: http://svn.apache.org/r1547396
Log:
OAK-795: Osgi init issues

Remove the troublesome ContentRepository initialization in oak-core
Fix the OSGi IT setup

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
    jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
    jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java?rev=1547396&r1=1547395&r2=1547396&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
Tue Dec  3 14:15:07 2013
@@ -24,8 +24,6 @@ import java.util.Properties;
 
 import com.google.common.collect.ImmutableMap;
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.Oak;
-import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
@@ -62,9 +60,6 @@ public class Activator implements Bundle
 
     private Whiteboard whiteboard;
 
-    // see OAK-795 for a reason why the nodeStore tracker is disabled
-    // private ServiceTracker nodeStoreTracker;
-
     private final OsgiIndexProvider indexProvider = new OsgiIndexProvider();
 
     private final OsgiIndexEditorProvider indexEditorProvider = new OsgiIndexEditorProvider();
@@ -106,16 +101,12 @@ public class Activator implements Bundle
 
         microKernelTracker = new ServiceTracker(context, MicroKernel.class.getName(), this);
         microKernelTracker.open();
-        // nodeStoreTracker = new ServiceTracker(
-        // context, NodeStore.class.getName(), this);
-        // nodeStoreTracker.open();
 
         registerSecurityProvider();
     }
 
     @Override
     public void stop(BundleContext bundleContext) throws Exception {
-        // nodeStoreTracker.close();
         microKernelTracker.close();
         indexProvider.stop();
         indexEditorProvider.stop();
@@ -144,19 +135,6 @@ public class Activator implements Bundle
                     new Properties()));
             registrations.add(registerMBean(whiteboard, CacheStatsMBean.class,
                 store.getCacheStats(), CacheStatsMBean.TYPE, store.getCacheStats().getName()));
-        } else if (service instanceof NodeStore) {
-            NodeStore store = (NodeStore) service;
-            OakInitializer.initialize(store, repositoryInitializerTracker, indexEditorProvider);
-            Oak oak = new Oak(store)
-                .with(securityProvider)
-                .with(validatorProvider)
-                .with(indexProvider)
-                .with(whiteboard)
-                .with(indexEditorProvider);
-            services.put(reference, context.registerService(
-                    ContentRepository.class.getName(),
-                    oak.createContentRepository(),
-                    new Properties()));
         }
         return service;
     }

Modified: jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java?rev=1547396&r1=1547395&r2=1547396&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
(original)
+++ jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
Tue Dec  3 14:15:07 2013
@@ -16,18 +16,18 @@
  */
 package org.apache.jackrabbit.oak.osgi;
 
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemProperties;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
-import java.util.regex.Pattern;
 
 import javax.inject.Inject;
-import javax.jcr.Repository;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
@@ -36,13 +36,10 @@ import org.ops4j.pax.exam.junit.Configur
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.ops4j.pax.exam.options.SystemPropertyOption;
 import org.ops4j.pax.exam.options.UrlProvisionOption;
-
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.systemProperties;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
 
 @RunWith(JUnit4TestRunner.class)
 public class OSGiIT {
@@ -57,6 +54,7 @@ public class OSGiIT {
                 systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
                 jarBundle("jcr.jar"),
                 jarBundle("guava.jar"),
+                jarBundle("commons-codec.jar"),
                 jarBundle("jackrabbit-api.jar"),
                 jarBundle("jackrabbit-jcr-commons.jar"),
                 jarBundle("oak-commons.jar"),
@@ -81,33 +79,21 @@ public class OSGiIT {
     }
 
     @Inject
-    private MicroKernel kernel;
-
-    @Test
-    @Ignore("OAK-454")
-    public void testMicroKernel() {
-        assertNotNull(kernel);
-        assertTrue(Pattern.matches("[0-9a-f]+", kernel.getHeadRevision()));
-    }
-
-    @Inject
-    private ContentRepository oakRepository;
+    private BundleContext context;
 
     @Test
-    @Ignore("OAK-795")
-    public void testOakRepository() {
-        assertNotNull(oakRepository);
-        // TODO: try something with oakRepository
+    public void listBundles() {
+        for (Bundle bundle : context.getBundles()) {
+            System.out.println(bundle);
+        }
     }
 
-    @Inject
-    private Repository jcrRepository;
-
     @Test
-    @Ignore("OAK-795")
-    public void testJcrRepository() {
-        assertNotNull(jcrRepository);
-        // TODO: try something with jcrRepository
+    public void listServices() throws InvalidSyntaxException {
+        for (ServiceReference<?> reference
+                : context.getAllServiceReferences(null, null)) {
+            System.out.println(reference);
+        }
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml?rev=1547396&r1=1547395&r2=1547396&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml (original)
+++ jackrabbit/oak/trunk/oak-it/osgi/test-bundles.xml Tue Dec  3 14:15:07 2013
@@ -30,6 +30,7 @@
       <includes>
         <include>javax.jcr:jcr</include>
         <include>com.google.guava:guava</include>
+        <include>commons-codec:commons-codec</include>
         <include>org.apache.jackrabbit:jackrabbit-api</include>
         <include>org.apache.jackrabbit:jackrabbit-jcr-commons</include>
         <include>org.apache.jackrabbit:oak-commons</include>



Mime
View raw message