jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1161434 [3/3] - in /jackrabbit/sandbox/microkernel: ./ src/main/java/org/apache/jackrabbit/mk/ src/main/java/org/apache/jackrabbit/mk/api/ src/main/java/org/apache/jackrabbit/mk/blobs/ src/main/java/org/apache/jackrabbit/mk/datastore/ src/...
Date Thu, 25 Aug 2011 08:18:59 GMT
Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
Thu Aug 25 08:18:57 2011
@@ -16,9 +16,10 @@
  */
 package org.apache.jackrabbit.mk.json;
 
-import java.io.IOException;
 import junit.framework.TestCase;
 
+import java.io.IOException;
+
 /**
  * Test the Jsop tokenizer and builder.
  */
@@ -26,12 +27,12 @@ public class JsopTest extends TestCase {
 
     public void testDataType() {
         String dateString = new JsopBuilder().
-            key("string").value("/Date(0)/").
-            key("date").encodedValue("\"\\/Date(0)\\/\"").
-            toString();
+                key("string").value("/Date(0)/").
+                key("date").encodedValue("\"\\/Date(0)\\/\"").
+                toString();
         assertEquals(
                 "\"string\":\"/Date(0)/\"," +
-                "\"date\":\"\\/Date(0)\\/\"",
+                        "\"date\":\"\\/Date(0)\\/\"",
                 dateString);
         JsopTokenizer t = new JsopTokenizer(dateString);
         assertEquals("string", t.readString());
@@ -173,68 +174,68 @@ public class JsopTest extends TestCase {
         boolean inArray = false;
         while (true) {
             switch (t.read()) {
-            case JsopTokenizer.END:
-                return buff.toString();
-            case JsopTokenizer.STRING:
-                buff.append(JsopBuilder.encode(t.getToken()));
-                break;
-            case JsopTokenizer.NUMBER:
-                buff.append(t.getToken());
-                break;
-            case JsopTokenizer.TRUE:
-                buff.append("true");
-                break;
-            case JsopTokenizer.FALSE:
-                buff.append("false");
-                break;
-            case JsopTokenizer.NULL:
-                buff.append("null");
-                break;
-            case JsopTokenizer.ERROR:
-                buff.append("/error/");
-                break;
-            case JsopTokenizer.COMMENT:
-                buff.append("/*").append(t.getToken()).append("*/ ");
-                break;
-            case '{':
-                buff.append(" {\n").append(space += ident);
-                break;
-            case '}':
-                space = space.substring(0, space.length() - ident.length());
-                buff.append('\n').append(space).append("}\n").append(space);
-                break;
-            case '[':
-                inArray = true;
-                buff.append("[");
-                break;
-            case ']':
-                inArray = false;
-                buff.append("]");
-                break;
-            case ',':
-                if (!inArray) {
-                    buff.append(",\n").append(space);
-                } else {
-                    buff.append(", ");
-                }
-                break;
-            case ':':
-                buff.append(": ");
-                break;
-            case '+':
-                buff.append("+ ");
-                break;
-            case '-':
-                buff.append("- ");
-                break;
-            case '^':
-                buff.append("^ ");
-                break;
-            case '/':
-                buff.append("/ ");
-                break;
-            default:
-                throw new AssertionError("token type: " + t.getTokenType());
+                case JsopTokenizer.END:
+                    return buff.toString();
+                case JsopTokenizer.STRING:
+                    buff.append(JsopBuilder.encode(t.getToken()));
+                    break;
+                case JsopTokenizer.NUMBER:
+                    buff.append(t.getToken());
+                    break;
+                case JsopTokenizer.TRUE:
+                    buff.append("true");
+                    break;
+                case JsopTokenizer.FALSE:
+                    buff.append("false");
+                    break;
+                case JsopTokenizer.NULL:
+                    buff.append("null");
+                    break;
+                case JsopTokenizer.ERROR:
+                    buff.append("/error/");
+                    break;
+                case JsopTokenizer.COMMENT:
+                    buff.append("/*").append(t.getToken()).append("*/ ");
+                    break;
+                case '{':
+                    buff.append(" {\n").append(space += ident);
+                    break;
+                case '}':
+                    space = space.substring(0, space.length() - ident.length());
+                    buff.append('\n').append(space).append("}\n").append(space);
+                    break;
+                case '[':
+                    inArray = true;
+                    buff.append("[");
+                    break;
+                case ']':
+                    inArray = false;
+                    buff.append("]");
+                    break;
+                case ',':
+                    if (!inArray) {
+                        buff.append(",\n").append(space);
+                    } else {
+                        buff.append(", ");
+                    }
+                    break;
+                case ':':
+                    buff.append(": ");
+                    break;
+                case '+':
+                    buff.append("+ ");
+                    break;
+                case '-':
+                    buff.append("- ");
+                    break;
+                case '^':
+                    buff.append("^ ");
+                    break;
+                case '/':
+                    buff.append("/ ");
+                    break;
+                default:
+                    throw new AssertionError("token type: " + t.getTokenType());
             }
         }
     }
@@ -243,24 +244,24 @@ public class JsopTest extends TestCase {
 
         JsopBuilder buff = new JsopBuilder();
         buff.append("+ ").object().
-            key("foo").value("bar").
-            key("int").value(3).
-            key("decimal").encodedValue("3.0").
-            key("obj").object().
+                key("foo").value("bar").
+                key("int").value(3).
+                key("decimal").encodedValue("3.0").
+                key("obj").object().
                 key("boolean").value(true).
                 key("null").value(null).
                 key("arr").array().
-                    array().
-                        value(1).
-                        value("\u001f ~ \u007f \u0080").
-                        value("42").
-                    endArray().
-                    array().
-                    endArray().
+                array().
+                value(1).
+                value("\u001f ~ \u007f \u0080").
+                value("42").
+                endArray().
+                array().
+                endArray().
                 endArray().
-            endObject().
-            key("some").value("more").
-        endObject();
+                endObject().
+                key("some").value("more").
+                endObject();
 
         String json = buff.toString();
         assertEquals("+ {\"foo\":\"bar\",\"int\":3,\"decimal\":3.0," +
@@ -269,9 +270,9 @@ public class JsopTest extends TestCase {
 
         buff.reset();
         buff.array().
-            object().key("x").value("1").endObject().appendWhitespace("\n").
-            object().key("y").value("2").endObject().appendWhitespace("\n").
-            endArray();
+                object().key("x").value("1").endObject().appendWhitespace("\n").
+                object().key("y").value("2").endObject().appendWhitespace("\n").
+                endArray();
         json = buff.toString();
         assertEquals("[{\"x\":\"1\"}\n,{\"y\":\"2\"}\n]", json);
 
@@ -292,8 +293,8 @@ public class JsopTest extends TestCase {
     public void testEscape() throws IOException {
         assertEquals("null", JsopBuilder.encode(null));
         JsopBuilder buff = new JsopBuilder().
-            key("back\\slash").value("\\").
-            key("back\\\\slash").value("\\\\");
+                key("back\\slash").value("\\").
+                key("back\\\\slash").value("\\\\");
         assertEquals("\"back\\\\slash\":\"\\\\\",\"back\\\\\\\\slash\":\"\\\\\\\\\"", buff.toString());
     }
 

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/CommitGateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/CommitGateTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/CommitGateTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/CommitGateTest.java
Thu Aug 25 08:18:57 2011
@@ -16,9 +16,10 @@
  */
 package org.apache.jackrabbit.mk.util;
 
-import java.util.concurrent.atomic.AtomicLong;
 import junit.framework.TestCase;
 
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * Test the commit gate.
  */
@@ -71,7 +72,7 @@ public class CommitGateTest extends Test
         for (Thread j : threads) {
             j.join();
         }
-        assertTrue("ticks: " + tick.get() + " min: " + threadCount * commitCount + " spurious:
" +  spurious.get(),
+        assertTrue("ticks: " + tick.get() + " min: " + threadCount * commitCount + " spurious:
" + spurious.get(),
                 tick.get() >= threadCount * commitCount * 0.8 && tick.get() <=
threadCount * commitCount * 1.2);
     }
 

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/IOUtilsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/IOUtilsTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/IOUtilsTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/IOUtilsTest.java
Thu Aug 25 08:18:57 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.mk.util;
 
+import junit.framework.TestCase;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
@@ -24,7 +26,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
-import junit.framework.TestCase;
 
 /**
  * Test the utility classes.
@@ -171,7 +172,7 @@ public class IOUtilsTest extends TestCas
             testVarLong(0x10000000 + x - 100, 0);
         }
         Random r = new Random(1);
-        for (int i=0; i < 100000; i++) {
+        for (int i = 0; i < 100000; i++) {
             testVarLong(r.nextLong(), 0);
             testVarLong(r.nextInt(Integer.MAX_VALUE), 0);
         }

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/NonDescendingClockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/NonDescendingClockTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/NonDescendingClockTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/NonDescendingClockTest.java
Thu Aug 25 08:18:57 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.mk.util;
 
-import org.apache.jackrabbit.mk.util.NonDescendingClock;
 import junit.framework.TestCase;
 
 public class NonDescendingClockTest extends TestCase {

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/PathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/PathTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/PathTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/PathTest.java
Thu Aug 25 08:18:57 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.mk.util;
 
-import org.apache.jackrabbit.mk.util.PathUtils;
 import junit.framework.TestCase;
 
 public class PathTest extends TestCase {
@@ -66,7 +65,7 @@ public class PathTest extends TestCase {
             // expected
         }
         try {
-            assertEquals(parent + "/" + child, PathUtils.concat(parent , "/" + child));
+            assertEquals(parent + "/" + child, PathUtils.concat(parent, "/" + child));
             fail();
         } catch (IllegalArgumentException e) {
             // expected
@@ -91,8 +90,8 @@ public class PathTest extends TestCase {
 
         // getName
         assertEquals("", PathUtils.getName("/"));
-        assertEquals(parent , PathUtils.getName("/" + parent));
-        assertEquals(child , PathUtils.getName("/" + parent + "/" + child));
+        assertEquals(parent, PathUtils.getName("/" + parent));
+        assertEquals(child, PathUtils.getName("/" + parent + "/" + child));
 
         // getParentPath
         assertEquals("/", PathUtils.getParentPath("/"));
@@ -101,16 +100,16 @@ public class PathTest extends TestCase {
 
         // isAbsolute
         assertEquals(true, PathUtils.isAbsolute("/"));
-        assertEquals(false, PathUtils.isAbsolute(parent ));
+        assertEquals(false, PathUtils.isAbsolute(parent));
         assertEquals(true, PathUtils.isAbsolute("/" + parent));
-        assertEquals(false, PathUtils.isAbsolute(child ));
+        assertEquals(false, PathUtils.isAbsolute(child));
         assertEquals(true, PathUtils.isAbsolute("/" + parent + "/" + child));
         assertEquals(false, PathUtils.isAbsolute(parent + "/" + child));
 
         // relativize
         assertEquals("", PathUtils.relativize("/", "/"));
         assertEquals("", PathUtils.relativize("/" + parent, "/" + parent));
-        assertEquals(child , PathUtils.relativize("/" + parent, "/" + parent + "/" + child));
+        assertEquals(child, PathUtils.relativize("/" + parent, "/" + parent + "/" + child));
         assertEquals(parent + "/" + child, PathUtils.relativize("/", "/" + parent + "/" +
child));
         try {
             PathUtils.relativize("x/y", "y/x");
@@ -123,20 +122,20 @@ public class PathTest extends TestCase {
 
     public void testMore() {
         String[] paths = {
-            "",
-            "/",
-            "foo",
-            "/foo",
-            "foo/bar",
-            "/foo/bar",
-            "foo/bar/baz",
-            "/foo/bar/baz",
-            "x",
-            "/x",
-            "x/y",
-            "/x/y",
-            "x/y/z",
-            "/x/y/z",
+                "",
+                "/",
+                "foo",
+                "/foo",
+                "foo/bar",
+                "/foo/bar",
+                "foo/bar/baz",
+                "/foo/bar/baz",
+                "x",
+                "/x",
+                "x/y",
+                "/x/y",
+                "x/y/z",
+                "/x/y/z",
         };
 
         for (String path : paths) {
@@ -161,7 +160,7 @@ public class PathTest extends TestCase {
     }
 
     public void testValidate() {
-        for (String invalid : new String[] {
+        for (String invalid : new String[]{
                 "//",
                 "//test",
                 "/test/",
@@ -181,7 +180,7 @@ public class PathTest extends TestCase {
                 // expected
             }
         }
-        for (String valid : new String[] {
+        for (String valid : new String[]{
                 "",
                 "/",
                 "test",

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/StringUtilsTest.java?rev=1161434&r1=1161433&r2=1161434&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/StringUtilsTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/util/StringUtilsTest.java
Thu Aug 25 08:18:57 2011
@@ -24,13 +24,13 @@ import junit.framework.TestCase;
 public class StringUtilsTest extends TestCase {
 
     public void testHex() {
-        assertEquals("0123", StringUtils.convertBytesToHex(new byte[] { (byte) 0x01, (byte)
0x23 }));
-        assertEquals("89bd", StringUtils.convertBytesToHex(new byte[] { (byte) 0x89, (byte)
0xbd }));
-        assertEquals("face", StringUtils.convertBytesToHex(new byte[] { (byte) 0xfa, (byte)
0xce }));
-        IOUtilsTest.assertEquals(new byte[] { (byte) 0xfa, (byte) 0xce }, StringUtils.convertHexToBytes("face"));
-        IOUtilsTest.assertEquals(new byte[] { (byte) 0xfa, (byte) 0xce }, StringUtils.convertHexToBytes("fAcE"));
-        IOUtilsTest.assertEquals(new byte[] { (byte) 0xfa, (byte) 0xce }, StringUtils.convertHexToBytes("FaCe"));
-        IOUtilsTest.assertEquals(new byte[] { (byte) 0x09, (byte) 0xaf }, StringUtils.convertHexToBytes("09af"));
+        assertEquals("0123", StringUtils.convertBytesToHex(new byte[]{(byte) 0x01, (byte)
0x23}));
+        assertEquals("89bd", StringUtils.convertBytesToHex(new byte[]{(byte) 0x89, (byte)
0xbd}));
+        assertEquals("face", StringUtils.convertBytesToHex(new byte[]{(byte) 0xfa, (byte)
0xce}));
+        IOUtilsTest.assertEquals(new byte[]{(byte) 0xfa, (byte) 0xce}, StringUtils.convertHexToBytes("face"));
+        IOUtilsTest.assertEquals(new byte[]{(byte) 0xfa, (byte) 0xce}, StringUtils.convertHexToBytes("fAcE"));
+        IOUtilsTest.assertEquals(new byte[]{(byte) 0xfa, (byte) 0xce}, StringUtils.convertHexToBytes("FaCe"));
+        IOUtilsTest.assertEquals(new byte[]{(byte) 0x09, (byte) 0xaf}, StringUtils.convertHexToBytes("09af"));
         for (String s : new String[]{"120", "1/", "9:", "fast", "a`", "ag", "0@", "aG"})
{
             try {
                 StringUtils.convertHexToBytes(s);



Mime
View raw message