You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2015/03/05 06:43:33 UTC
svn commit: r1664229 - in /jackrabbit/oak/trunk/oak-jcr: ./
src/main/java/org/apache/jackrabbit/oak/jcr/osgi/
src/test/java/org/apache/jackrabbit/oak/jcr/osgi/
Author: chetanm
Date: Thu Mar 5 05:43:32 2015
New Revision: 1664229
URL: http://svn.apache.org/r1664229
Log:
OAK-2579 - RepositoryManager must not register WhiteboardExecutor with Oak
Added:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java (with props)
Modified:
jackrabbit/oak/trunk/oak-jcr/pom.xml
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java
Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1664229&r1=1664228&r2=1664229&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Thu Mar 5 05:43:32 2015
@@ -355,5 +355,9 @@
<version>1.4</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
+ </dependency>
</dependencies>
</project>
Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java?rev=1664229&r1=1664228&r2=1664229&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManager.java Thu Mar 5 05:43:32 2015
@@ -58,6 +58,9 @@ public class RepositoryManager {
private static final int DEFAULT_OBSERVATION_QUEUE_LENGTH = 1000;
private static final boolean DEFAULT_COMMIT_RATE_LIMIT = false;
+ //TODO Exposed for testing purpose due to SLING-4472
+ static boolean ignoreFrameworkProperties = false;
+
private final WhiteboardEditorProvider editorProvider =
new WhiteboardEditorProvider();
@@ -67,8 +70,6 @@ public class RepositoryManager {
private final WhiteboardIndexProvider indexProvider =
new WhiteboardIndexProvider();
- private final WhiteboardExecutor executor = new WhiteboardExecutor();
-
private Tracker<RepositoryInitializer> initializers;
private Whiteboard whiteboard;
@@ -115,15 +116,16 @@ public class RepositoryManager {
editorProvider.start(whiteboard);
indexEditorProvider.start(whiteboard);
indexProvider.start(whiteboard);
- executor.start(whiteboard);
registration = registerRepository(bundleContext);
}
private static Object prop(Map<String, ?> config, BundleContext bundleContext, String name) {
- //Prefer framework property first
- Object value = bundleContext.getProperty(name);
- if (value != null) {
- return value;
+ if (!ignoreFrameworkProperties) {
+ //Prefer framework property first
+ Object value = bundleContext.getProperty(name);
+ if (value != null) {
+ return value;
+ }
}
//Fallback to one from config
@@ -138,7 +140,6 @@ public class RepositoryManager {
}
initializers.stop();
- executor.stop();
indexProvider.stop();
indexEditorProvider.stop();
editorProvider.stop();
@@ -153,8 +154,7 @@ public class RepositoryManager {
.with(editorProvider)
.with(indexEditorProvider)
.with(indexProvider)
- .withAsyncIndexing()
- .with(executor);
+ .withAsyncIndexing();
for(RepositoryInitializer initializer : initializers.getServices()){
oak.with(initializer);
Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java?rev=1664229&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java Thu Mar 5 05:43:32 2015
@@ -0,0 +1,70 @@
+/*
+ * 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.jackrabbit.oak.jcr.osgi;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
+import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepositoryManagerTest {
+ @Rule
+ public final OsgiContext context = new OsgiContext();
+
+ @Test
+ public void executorSetup() throws Exception {
+ context.registerService(SecurityProvider.class, new OpenSecurityProvider());
+ context.registerService(NodeStore.class, new MemoryNodeStore());
+
+ //Due to SLING-4472
+ RepositoryManager.ignoreFrameworkProperties = true;
+ context.registerInjectActivateService(new RepositoryManager());
+
+ Executor executor = context.getService(Executor.class);
+ assertNotNull("Repository initialization should have registered an Executor", executor);
+
+ final AtomicBoolean invoked = new AtomicBoolean();
+ final CountDownLatch latch = new CountDownLatch(1);
+ executor.execute(new Runnable() {
+ @Override
+ public void run() {
+ invoked.set(true);
+ latch.countDown();
+ }
+ });
+
+ latch.await(5, TimeUnit.SECONDS);
+ assertTrue(invoked.get());
+ }
+
+}
+
+
Propchange: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/osgi/RepositoryManagerTest.java
------------------------------------------------------------------------------
svn:eol-style = native