jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1138431 - /jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
Date Wed, 22 Jun 2011 12:25:52 GMT
Author: mduerig
Date: Wed Jun 22 12:25:52 2011
New Revision: 1138431

URL: http://svn.apache.org/viewvc?rev=1138431&view=rev
Log:
spi2microkernel prototype (WIP)
tests

Modified:
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java?rev=1138431&r1=1138430&r2=1138431&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
Wed Jun 22 12:25:52 2011
@@ -222,7 +222,7 @@ public class MicrokernelTest {
 
     @Ignore // fixme fix IAE in microkernel
     @Test
-    public void journalAddNode() {
+    public void journalAddNode() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String init = mk.getHeadRevision();
 
@@ -233,15 +233,26 @@ public class MicrokernelTest {
         String journal = mk.getJournal(head, head);
         System.out.println(journal);
 
-        JsopTokenizer tokenizer = new JsopTokenizer(journal);
-        while (tokenizer.read() != JsopTokenizer.END) {
-            System.out.println(tokenizer.readString());
-        }
+        JSONArray jsonArray = (JSONArray) new JSONParser().parse(journal);
+        JSONObject jsonObject = (JSONObject) jsonArray.get(0);
+        String changes = (String) jsonObject.get("changes");
+        System.out.println(changes);
+
+        JsopTokenizer tokenizer = new JsopTokenizer(changes);
+        tokenizer.read('+');
+        System.out.println(tokenizer.readString());
+        tokenizer.read(':');
+        tokenizer.read('{');
+        System.out.println(tokenizer.readString());
+        tokenizer.read(':');
+        tokenizer.read();
+        System.out.println(tokenizer.getToken());
+        tokenizer.read('}');
     }
 
-    @Ignore
+    @Ignore // fixme fix IAE in microkernel
     @Test
-    public void journalSetProperty() {
+    public void journalSetProperty() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String init = mk.getHeadRevision();
 
@@ -256,15 +267,22 @@ public class MicrokernelTest {
         String journal = mk.getJournal(head, head);
         System.out.println(journal);
 
-        JsopTokenizer tokenizer = new JsopTokenizer(journal);
-        while (tokenizer.read() != JsopTokenizer.END) {
-            System.out.println(tokenizer.readString());
-        }
+        JSONArray jsonArray = (JSONArray) new JSONParser().parse(journal);
+        JSONObject jsonObject = (JSONObject) jsonArray.get(0);
+        String changes = (String) jsonObject.get("changes");
+        System.out.println(changes);
+
+        JsopTokenizer tokenizer = new JsopTokenizer(changes);
+        tokenizer.read('^');
+        System.out.println(tokenizer.readString());
+        tokenizer.read(':');
+        tokenizer.read(JsopTokenizer.NUMBER);
+        System.out.println(tokenizer.getToken());
     }
 
-    @Ignore
+    @Ignore // fixme fix IAE in microkernel
     @Test
-    public void journalSetProperty2() {
+    public void journalSetProperty2() throws ParseException {
         MicroKernel mk = getMicroKernel();
         String init = mk.getHeadRevision();
 
@@ -279,10 +297,16 @@ public class MicrokernelTest {
         String journal = mk.getJournal(head, head);
         System.out.println(journal);
 
-        JsopTokenizer tokenizer = new JsopTokenizer(journal);
-        while (tokenizer.read() != JsopTokenizer.END) {
-            System.out.println(tokenizer.readString());
-        }
+        JSONArray jsonArray = (JSONArray) new JSONParser().parse(journal);
+        JSONObject jsonObject = (JSONObject) jsonArray.get(0);
+        String changes = (String) jsonObject.get("changes");
+        System.out.println(changes);
+        
+        JsopTokenizer tokenizer = new JsopTokenizer(changes);
+        tokenizer.read('^');
+        System.out.println(tokenizer.readString());
+        tokenizer.read(':');
+        assertEquals("bar", tokenizer.readString());
     }
 
     //------------------------------------------< private >---



Mime
View raw message