jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1547419 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ oak-it/osgi/ oak-it/osgi/src/test/config/ oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/
Date Tue, 03 Dec 2013 15:07:35 GMT
Author: jukka
Date: Tue Dec  3 15:07:35 2013
New Revision: 1547419

URL: http://svn.apache.org/r1547419
Log:
OAK-795: OSGi init issues

Configure a TarMK instance for the OSGi IT.
Upgrade to latest Pax Exam version.

Added:
    jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.cfg
      - copied, changed from r1547404, jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.mk.osgi.MicroKernelService.cfg
Removed:
    jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.mk.osgi.MicroKernelService.cfg
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
    jackrabbit/oak/trunk/oak-it/osgi/pom.xml
    jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java?rev=1547419&r1=1547418&r2=1547419&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
Tue Dec  3 15:07:35 2013
@@ -27,7 +27,6 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import com.google.common.base.Preconditions;
-import com.mongodb.MongoClient;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -39,7 +38,6 @@ import org.apache.jackrabbit.oak.api.Blo
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.spi.commit.Observable;
 import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
-import org.apache.jackrabbit.oak.plugins.segment.mongo.MongoStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
@@ -55,31 +53,20 @@ public class SegmentNodeStoreService imp
     @Property(description="The unique name of this instance")
     public static final String NAME = "name";
 
-    @Property(description="TarMK directory (if unset, use MongoDB)")
+    @Property(description="TarMK directory")
     public static final String DIRECTORY = "repository.home";
 
-    @Property(description="TarMK mode (64 for memory mapping, 32 for normal file access)")
+    @Property(description="TarMK mode (64 for memory mapping, 32 for normal file access)",
value="64")
     public static final String MODE = "tarmk.mode";
 
     @Property(description="TarMK maximum file size (MB)", intValue=256)
     public static final String SIZE = "tarmk.size";
 
-    @Property(description="MongoDB host")
-    public static final String HOST = "host";
-
-    @Property(description="MongoDB host", intValue=27017)
-    public static final String PORT = "port";
-
-    @Property(description="MongoDB database", value="Oak")
-    public static final String DB = "db";
-
-    @Property(description="Cache size (MB)", intValue=200)
+    @Property(description="Cache size (MB)", intValue=256)
     public static final String CACHE = "cache";
 
     private String name;
 
-    private MongoClient mongo;
-
     private SegmentStore store;
 
     private NodeStore delegate;
@@ -95,37 +82,26 @@ public class SegmentNodeStoreService imp
         Dictionary<?, ?> properties = context.getProperties();
         name = "" + properties.get(NAME);
 
-        String host = lookup(context, HOST);
-        if (host == null) {
-            String directory = lookup(context, DIRECTORY);
-            if (directory == null) {
-                directory = "tarmk";
-            }
-
-            String mode = lookup(context, MODE);
-            if (mode == null) {
-                mode = System.getProperty(MODE,
-                        System.getProperty("sun.arch.data.model", "32"));
-            }
-
-            String size = lookup(context, SIZE);
-            if (size == null) {
-                size = System.getProperty(SIZE, "256");
-            }
-
-            mongo = null;
-            store = new FileStore(
-                    new File(directory),
-                    Integer.parseInt(size), "64".equals(mode));
-        } else {
-            int port = Integer.parseInt(String.valueOf(properties.get(PORT)));
-            String db = String.valueOf(properties.get(DB));
-            int cache = Integer.parseInt(String.valueOf(properties.get(CACHE)));
+        String directory = lookup(context, DIRECTORY);
+        if (directory == null) {
+            directory = "tarmk";
+        }
 
-            mongo = new MongoClient(host, port);
-            store = new MongoStore(mongo.getDB(db), cache);
+        String mode = lookup(context, MODE);
+        if (mode == null) {
+            mode = System.getProperty(MODE,
+                    System.getProperty("sun.arch.data.model", "32"));
         }
 
+        String size = lookup(context, SIZE);
+        if (size == null) {
+            size = System.getProperty(SIZE, "256");
+        }
+
+        store = new FileStore(
+                new File(directory),
+                Integer.parseInt(size), "64".equals(mode));
+
         delegate = new SegmentNodeStore(store);
     }
 
@@ -144,9 +120,7 @@ public class SegmentNodeStoreService imp
         delegate = null;
 
         store.close();
-        if (mongo != null) {
-            mongo.close();
-        }
+        store = null;
     }
 
     //------------------------------------------------------------< Observable >---

Modified: jackrabbit/oak/trunk/oak-it/osgi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/osgi/pom.xml?rev=1547419&r1=1547418&r2=1547419&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/osgi/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/osgi/pom.xml Tue Dec  3 15:07:35 2013
@@ -32,7 +32,7 @@
 
   <properties>
     <skip.deployment>true</skip.deployment>
-    <pax.exam.version>2.4.0</pax.exam.version>
+    <pax.exam.version>3.4.0</pax.exam.version>
   </properties>
 
   <build>
@@ -131,19 +131,19 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>4.0.2</version>
+      <version>3.2.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-link-assembly</artifactId>
+      <artifactId>pax-exam-link-mvn</artifactId>
       <version>${pax.exam.version}</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.ops4j.pax.url</groupId>
       <artifactId>pax-url-aether</artifactId>
-      <version>1.3.3</version>
+      <version>1.5.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>

Copied: jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.cfg
(from r1547404, jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.mk.osgi.MicroKernelService.cfg)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.cfg?p2=jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.cfg&p1=jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.mk.osgi.MicroKernelService.cfg&r1=1547404&r2=1547419&rev=1547419&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.mk.osgi.MicroKernelService.cfg
(original)
+++ jackrabbit/oak/trunk/oak-it/osgi/src/test/config/org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.cfg
Tue Dec  3 15:07:35 2013
@@ -12,4 +12,5 @@
 # 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.
-name="Oak"
+name=Oak
+repository.home=target/tarmk

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=1547419&r1=1547418&r2=1547419&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 15:07:35 2013
@@ -28,22 +28,24 @@ import java.net.URISyntaxException;
 
 import javax.inject.Inject;
 
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.options.DefaultCompositeOption;
 import org.ops4j.pax.exam.options.SystemPropertyOption;
-import org.ops4j.pax.exam.options.UrlProvisionOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
 public class OSGiIT {
 
     @Configuration
@@ -83,10 +85,19 @@ public class OSGiIT {
 
     @Test
     public void listServices() throws InvalidSyntaxException {
-        for (ServiceReference<?> reference
+        for (ServiceReference reference
                 : context.getAllServiceReferences(null, null)) {
             System.out.println(reference);
         }
     }
 
+    @Inject
+    private NodeStore store;
+
+    @Test
+    public void testNodeStore() {
+        System.out.println(store);
+        // System.out.println(store.getRoot());
+    }
+
 }



Mime
View raw message