jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1394089 - in /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak: core/ kernel/ plugins/index/lucene/ plugins/memory/ util/
Date Thu, 04 Oct 2012 14:29:24 GMT
Author: mduerig
Date: Thu Oct  4 14:29:23 2012
New Revision: 1394089

URL: http://svn.apache.org/viewvc?rev=1394089&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- Replace usages of deprecated methods in tests with new methods

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/DefaultConflictHandlerTest.java
Thu Oct  4 14:29:23 2012
@@ -20,7 +20,6 @@ package org.apache.jackrabbit.oak.core;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -28,6 +27,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -35,8 +35,8 @@ import static org.junit.Assert.assertNul
 public class DefaultConflictHandlerTest extends AbstractCoreTest {
     private RootImpl ourRoot;
     private Root theirRoot;
-    private CoreValue ourValue;
-    private CoreValue theirValue;
+    private String ourValue;
+    private String theirValue;
 
     @Override
     protected NodeState createInitialState(MicroKernel microKernel) {
@@ -46,8 +46,8 @@ public class DefaultConflictHandlerTest 
         ourRoot = createRootImpl("");
         theirRoot = createRootImpl("");
 
-        ourValue = valueFactory.createValue("foo");
-        theirValue = valueFactory.createValue("bar");
+        ourValue = "foo";
+        theirValue = "bar";
         return store.getRoot();
     }
 
@@ -61,7 +61,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("p");
         assertNotNull(p);
-        assertEquals(ourValue, p.getValue());
+        assertEquals(ourValue, p.getValue(STRING));
     }
 
     @Test
@@ -74,7 +74,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("a");
         assertNotNull(p);
-        assertEquals(ourValue, p.getValue());
+        assertEquals(ourValue, p.getValue(STRING));
     }
 
     @Test
@@ -87,7 +87,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("a");
         assertNotNull(p);
-        assertEquals(ourValue, p.getValue());
+        assertEquals(ourValue, p.getValue(STRING));
     }
 
     @Test
@@ -112,7 +112,7 @@ public class DefaultConflictHandlerTest 
 
         Tree n = ourRoot.getTree("/n");
         assertNotNull(n);
-        assertEquals(ourValue, n.getProperty("p").getValue());
+        assertEquals(ourValue, n.getProperty("p").getValue(STRING));
     }
 
     @Test
@@ -125,7 +125,7 @@ public class DefaultConflictHandlerTest 
 
         Tree n = ourRoot.getTree("/x");
         assertNotNull(n);
-        assertEquals(ourValue, n.getProperty("p").getValue());
+        assertEquals(ourValue, n.getProperty("p").getValue(STRING));
     }
 
     @Test
@@ -151,7 +151,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("p");
         assertNotNull(p);
-        assertEquals(theirValue, p.getValue());
+        assertEquals(theirValue, p.getValue(STRING));
     }
 
     @Test
@@ -178,7 +178,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("a");
         assertNotNull(p);
-        assertEquals(theirValue, p.getValue());
+        assertEquals(theirValue, p.getValue(STRING));
     }
 
     @Test
@@ -192,7 +192,7 @@ public class DefaultConflictHandlerTest 
 
         PropertyState p = ourRoot.getTree("/").getProperty("a");
         assertNotNull(p);
-        assertEquals(theirValue, p.getValue());
+        assertEquals(theirValue, p.getValue(STRING));
     }
 
     @Test
@@ -206,7 +206,7 @@ public class DefaultConflictHandlerTest 
 
         Tree n = ourRoot.getTree("/n");
         assertNotNull(n);
-        assertEquals(theirValue, n.getProperty("p").getValue());
+        assertEquals(theirValue, n.getProperty("p").getValue(STRING));
     }
 
     @Test
@@ -232,7 +232,7 @@ public class DefaultConflictHandlerTest 
 
         Tree n = ourRoot.getTree("/x");
         assertNotNull(n);
-        assertEquals(theirValue, n.getProperty("p").getValue());
+        assertEquals(theirValue, n.getProperty("p").getValue(STRING));
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplFuzzIT.java
Thu Oct  4 14:29:23 2012
@@ -25,8 +25,6 @@ import javax.security.auth.Subject;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
-import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -72,15 +70,12 @@ public class RootImplFuzzIT {
 
     private int counter;
 
-    private CoreValueFactory vf;
-
     @Before
     public void setup() {
         counter = 0;
 
         MicroKernel mk1 = new MicroKernelImpl("./target/mk1/" + random.nextInt());
         store1 = new KernelNodeStore(mk1);
-        vf = store1.getValueFactory();
         mk1.commit("", "+\"/root\":{}", mk1.getHeadRevision(), "");
         root1 = new RootImpl(store1, null, new Subject(),
                 new AccessControlProviderImpl(), new CompositeQueryIndexProvider());
@@ -221,9 +216,9 @@ public class RootImplFuzzIT {
         static class SetProperty extends Operation {
             private final String parentPath;
             private final String propertyName;
-            private final CoreValue propertyValue;
+            private final String propertyValue;
 
-            SetProperty(String parentPath, String name, CoreValue value) {
+            SetProperty(String parentPath, String name, String value) {
                 this.parentPath = parentPath;
                 this.propertyName = name;
                 this.propertyValue = value;
@@ -359,7 +354,7 @@ public class RootImplFuzzIT {
     private Operation createAddProperty() {
         String parent = chooseNodePath();
         String name = createPropertyName();
-        CoreValue value = createValue();
+        String value = createValue();
         return new SetProperty(parent, name, value);
     }
 
@@ -368,7 +363,7 @@ public class RootImplFuzzIT {
         if (path == null) {
             return null;
         }
-        CoreValue value = createValue();
+        String value = createValue();
         return new SetProperty(PathUtils.getParentPath(path), PathUtils.getName(path), value);
     }
 
@@ -429,14 +424,14 @@ public class RootImplFuzzIT {
         return null;
     }
 
-    private CoreValue createValue() {
-        return vf.createValue("V" + counter++);
+    private String createValue() {
+        return ("V" + counter++);
     }
 
     private static void checkEqual(Tree tree1, Tree tree2) {
         String message =
                 tree1.getPath() + "!=" + tree2.getPath()
-                + " (seed " + SEED + ")";
+                + " (seed " + SEED + ')';
         assertEquals(message, tree1.getPath(), tree2.getPath());
         assertEquals(message, tree1.getChildrenCount(), tree2.getChildrenCount());
         assertEquals(message, tree1.getPropertyCount(), tree2.getPropertyCount());

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
Thu Oct  4 14:29:23 2012
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -196,9 +195,8 @@ public class RootImplTest extends Abstra
 
         checkEqual(root1.getTree("/"), root2.getTree("/"));
 
-        CoreValue value = valueFactory.createValue("V1");
         root2.getTree("/").addChild("one").addChild("two").addChild("three")
-                .setProperty("p1", value);
+                .setProperty("p1", "V1");
         root2.commit();
 
         root1.rebase();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
Thu Oct  4 14:29:23 2012
@@ -17,22 +17,21 @@
 package org.apache.jackrabbit.oak.core;
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
-import javax.jcr.PropertyType;
-
+import com.google.common.collect.Sets;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Tree.Status;
+import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.api.Type.LONG;
+import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -75,8 +74,8 @@ public class TreeImplTest extends Abstra
         propertyState = tree.getProperty("a");
         assertNotNull(propertyState);
         assertFalse(propertyState.isArray());
-        assertEquals(PropertyType.LONG, propertyState.getValue().getType());
-        assertEquals(1, propertyState.getValue().getLong());
+        assertEquals(LONG, propertyState.getType());
+        assertEquals(1, (long) propertyState.getValue(LONG));
     }
 
     @Test
@@ -102,21 +101,17 @@ public class TreeImplTest extends Abstra
         RootImpl root = createRootImpl(null);
         Tree tree = root.getTree("/");
 
-        Map<String, CoreValue> expectedProperties = new HashMap<String, CoreValue>();
-        expectedProperties.put("a", valueFactory.createValue(1));
-        expectedProperties.put("b", valueFactory.createValue(2));
-        expectedProperties.put("c", valueFactory.createValue(3));
+        Set<PropertyState> expectedProperties = Sets.newHashSet(
+            PropertyStates.longProperty("a", 1),
+            PropertyStates.longProperty("b", 2),
+            PropertyStates.longProperty("c", 3));
 
         Iterable<? extends PropertyState> properties = tree.getProperties();
         for (PropertyState property : properties) {
-            CoreValue value = expectedProperties.remove(property.getName());
-            assertNotNull(value);
-            assertFalse(property.isArray());
-            assertEquals(value, property.getValue());
+            assertTrue(expectedProperties.remove(property));
         }
 
         assertTrue(expectedProperties.isEmpty());
-
         assertEquals(3, tree.getPropertyCount());
     }
 
@@ -178,12 +173,11 @@ public class TreeImplTest extends Abstra
         Tree tree = root.getTree("/");
 
         assertFalse(tree.hasProperty("new"));
-        CoreValue value = valueFactory.createValue("value");
-        tree.setProperty("new", value);
+        tree.setProperty("new", "value");
         PropertyState property = tree.getProperty("new");
         assertNotNull(property);
         assertEquals("new", property.getName());
-        assertEquals(value, property.getValue());
+        assertEquals("value", property.getValue(STRING));
 
         root.commit();
         tree = root.getTree("/");
@@ -191,7 +185,7 @@ public class TreeImplTest extends Abstra
         property = tree.getProperty("new");
         assertNotNull(property);
         assertEquals("new", property.getName());
-        assertEquals(value, property.getValue());
+        assertEquals("value", property.getValue(STRING));
     }
 
     @Test
@@ -233,17 +227,16 @@ public class TreeImplTest extends Abstra
 
         assertEquals(3, tree.getPropertyCount());
 
-        CoreValue value = valueFactory.createValue("foo");
-        tree.setProperty("a", value);
+        tree.setProperty("a", "foo");
         assertEquals(3, tree.getPropertyCount());
 
         tree.removeProperty("a");
         assertEquals(2, tree.getPropertyCount());
 
-        tree.setProperty("x", value);
+        tree.setProperty("x", "foo");
         assertEquals(3, tree.getPropertyCount());
 
-        tree.setProperty("a", value);
+        tree.setProperty("a", "foo");
         assertEquals(4, tree.getPropertyCount());
     }
 
@@ -252,7 +245,7 @@ public class TreeImplTest extends Abstra
         RootImpl root = createRootImpl(null);
         Tree tree = root.getTree("/");
 
-        tree.setProperty("P0", valueFactory.createValue("V1"));
+        tree.setProperty("P0", "V1");
         root.commit();
         tree = root.getTree("/");
         assertTrue(tree.hasProperty("P0"));
@@ -300,16 +293,14 @@ public class TreeImplTest extends Abstra
     public void propertyStatus() throws CommitFailedException {
         RootImpl root = createRootImpl(null);
         Tree tree = root.getTree("/");
-        CoreValue value1 = valueFactory.createValue("V1");
-        CoreValue value2 = valueFactory.createValue("V2");
 
-        tree.setProperty("new", value1);
+        tree.setProperty("new", "value1");
         assertEquals(Tree.Status.NEW, tree.getPropertyStatus("new"));
         root.commit();
 
         tree = root.getTree("/");
         assertEquals(Tree.Status.EXISTING, tree.getPropertyStatus("new"));
-        tree.setProperty("new", value2);
+        tree.setProperty("new", "value2");
         assertEquals(Tree.Status.MODIFIED, tree.getPropertyStatus("new"));
         root.commit();
 
@@ -323,7 +314,7 @@ public class TreeImplTest extends Abstra
         assertNull(tree.getPropertyStatus("new"));
 
         Tree x = root.getTree("/x");
-        x.setProperty("y", value1);
+        x.setProperty("y", "value1");
         x.remove();
         assertEquals(Status.REMOVED, x.getPropertyStatus("y"));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateTest.java
Thu Oct  4 14:29:23 2012
@@ -33,6 +33,7 @@ import org.junit.Test;
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
+import static org.apache.jackrabbit.oak.api.Type.LONG;
 
 public class KernelNodeStateTest extends AbstractCoreTest {
 
@@ -53,11 +54,11 @@ public class KernelNodeStateTest extends
     @Test
     public void testGetProperty() {
         assertEquals("a", state.getProperty("a").getName());
-        assertEquals(1, state.getProperty("a").getValue().getLong());
+        assertEquals(1, (long) state.getProperty("a").getValue(LONG));
         assertEquals("b", state.getProperty("b").getName());
-        assertEquals(2, state.getProperty("b").getValue().getLong());
+        assertEquals(2, (long) state.getProperty("b").getValue(LONG));
         assertEquals("c", state.getProperty("c").getName());
-        assertEquals(3, state.getProperty("c").getValue().getLong());
+        assertEquals(3, (long) state.getProperty("c").getValue(LONG));
         assertNull(state.getProperty("x"));
     }
 
@@ -67,7 +68,7 @@ public class KernelNodeStateTest extends
         List<Long> values = new ArrayList<Long>();
         for (PropertyState property : state.getProperties()) {
             names.add(property.getName());
-            values.add(property.getValue().getLong());
+            values.add(property.getValue(LONG));
         }
         Collections.sort(names);
         Collections.sort(values);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/KernelNodeStoreTest.java
Thu Oct  4 14:29:23 2012
@@ -21,7 +21,6 @@ package org.apache.jackrabbit.oak.kernel
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.Observer;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -30,6 +29,7 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.api.Type.LONG;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -75,14 +75,13 @@ public class KernelNodeStoreTest {
 
         testBuilder.removeNode("x");
 
-        CoreValue fortyTwo = store.getValueFactory().createValue(42);
-        newNodeBuilder.setProperty("n", fortyTwo);
+        newNodeBuilder.setProperty("n", 42);
 
         // Assert changes are present in the builder
         NodeState testState = rootBuilder.getNodeState().getChildNode("test");
         assertNotNull(testState.getChildNode("newNode"));
         assertNull(testState.getChildNode("x"));
-        assertEquals(fortyTwo, testState.getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(42, (long) testState.getChildNode("newNode").getProperty("n").getValue(LONG));
 
         // Assert changes are not yet present in the branch
         testState = branch.getRoot().getChildNode("test");
@@ -95,7 +94,7 @@ public class KernelNodeStoreTest {
         testState = branch.getRoot().getChildNode("test");
         assertNotNull(testState.getChildNode("newNode"));
         assertNull(testState.getChildNode("x"));
-        assertEquals(fortyTwo, testState.getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(42, (long) testState.getChildNode("newNode").getProperty("n").getValue(LONG));
 
         // Assert changes are not yet present in the trunk
         testState = store.getRoot().getChildNode("test");
@@ -108,7 +107,7 @@ public class KernelNodeStoreTest {
         testState = store.getRoot().getChildNode("test");
         assertNotNull(testState.getChildNode("newNode"));
         assertNull(testState.getChildNode("x"));
-        assertEquals(fortyTwo, testState.getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(42, (long) testState.getChildNode("newNode").getProperty("n").getValue(LONG));
     }
 
     @Test
@@ -127,8 +126,7 @@ public class KernelNodeStoreTest {
         NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
         NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
 
-        CoreValue fortyTwo = store.getValueFactory().createValue(42);
-        newNodeBuilder.setProperty("n", fortyTwo);
+        newNodeBuilder.setProperty("n", 42);
 
         testBuilder.removeNode("a");
 
@@ -147,7 +145,7 @@ public class KernelNodeStoreTest {
         assertNull(before.getChildNode("test").getChildNode("newNode"));
         assertNotNull(after.getChildNode("test").getChildNode("newNode"));
         assertNull(after.getChildNode("test").getChildNode("a"));
-        assertEquals(fortyTwo, after.getChildNode("test").getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(42, (long) after.getChildNode("test").getChildNode("newNode").getProperty("n").getValue(LONG));
         assertEquals(newRoot, after);
     }
 
@@ -168,8 +166,7 @@ public class KernelNodeStoreTest {
         NodeBuilder testBuilder = rootBuilder.getChildBuilder("test");
         NodeBuilder newNodeBuilder = testBuilder.getChildBuilder("newNode");
 
-        final CoreValue fortyTwo = store.getValueFactory().createValue(42);
-        newNodeBuilder.setProperty("n", fortyTwo);
+        newNodeBuilder.setProperty("n", 42);
 
         testBuilder.removeNode("a");
 
@@ -183,7 +180,7 @@ public class KernelNodeStoreTest {
         assertNotNull(test.getChildNode("newNode"));
         assertNotNull(test.getChildNode("fromHook"));
         assertNull(test.getChildNode("a"));
-        assertEquals(fortyTwo, test.getChildNode("newNode").getProperty("n").getValue());
+        assertEquals(42, (long) test.getChildNode("newNode").getProperty("n").getValue(LONG));
         assertEquals(test, store.getRoot().getChildNode("test"));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexTest.java
Thu Oct  4 14:29:23 2012
@@ -16,11 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-import static org.apache.jackrabbit.oak.spi.query.IndexUtils.DEFAULT_INDEX_HOME;
-
 import javax.security.auth.Subject;
 
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
@@ -40,6 +35,11 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.query.QueryIndex;
 import org.junit.Test;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static org.apache.jackrabbit.oak.spi.query.IndexUtils.DEFAULT_INDEX_HOME;
+
 public class LuceneIndexTest implements LuceneIndexConstants {
 
     @Test
@@ -53,7 +53,7 @@ public class LuceneIndexTest implements 
                 new AccessControlProviderImpl(), new CompositeQueryIndexProvider());
         Tree tree = root.getTree("/");
 
-        tree.setProperty("foo", MemoryValueFactory.INSTANCE.createValue("bar"));
+        tree.setProperty("foo", "bar");
         root.commit();
 
         QueryIndex index = new LuceneIndex(testID);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneQueryTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneQueryTest.java
Thu Oct  4 14:29:23 2012
@@ -16,11 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
-import static org.apache.jackrabbit.oak.spi.query.IndexUtils.DEFAULT_INDEX_HOME;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Iterator;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
@@ -38,6 +33,11 @@ import org.apache.jackrabbit.oak.spi.que
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.spi.query.IndexUtils.DEFAULT_INDEX_HOME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 /**
  * base class for lucene search tests
  */
@@ -73,8 +73,7 @@ public class LuceneQueryTest extends Abs
                 index = index.addChild(p);
             }
         }
-        index.addChild("test-lucene").setProperty("type",
-                vf.createValue("lucene"));
+        index.addChild("test-lucene").setProperty("type", "lucene");
         root.commit();
     }
 
@@ -82,8 +81,8 @@ public class LuceneQueryTest extends Abs
     public void simpleSql2() throws Exception {
 
         Tree test = root.getTree("/").addChild("test");
-        test.addChild("a").setProperty("name", vf.createValue("hello"));
-        test.addChild("b").setProperty("name", vf.createValue("nothello"));
+        test.addChild("a").setProperty("name", "hello");
+        test.addChild("b").setProperty("name", "nothello");
         root.commit();
 
         String sql = "select * from [nt:base] where name = 'hello'";

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Thu Oct  4 14:29:23 2012
@@ -16,19 +16,19 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
+import com.google.common.collect.ImmutableMap;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.junit.Test;
+
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 import static junit.framework.Assert.fail;
-
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
+import static org.apache.jackrabbit.oak.api.Type.STRING;
 
 public class MemoryNodeBuilderTest {
 
@@ -49,7 +49,7 @@ public class MemoryNodeBuilderTest {
         NodeBuilder childB = root.getChildBuilder("x");
 
         assertNull(childA.getProperty("test"));
-        childB.setProperty("test", new StringValue("foo"));
+        childB.setProperty("test", "foo");
         assertNotNull(childA.getProperty("test"));
     }
 
@@ -59,11 +59,11 @@ public class MemoryNodeBuilderTest {
         NodeBuilder childA = root.getChildBuilder("x");
         NodeBuilder childB = root.getChildBuilder("x");
 
-        childB.setProperty("test", new StringValue("foo"));
-        childA.setProperty("test", new StringValue("bar"));
+        childB.setProperty("test", "foo");
+        childA.setProperty("test", "bar");
         assertEquals(
                 "bar",
-                childB.getProperty("test").getValue().getString());
+                childB.getProperty("test").getValue(STRING));
     }
 
     @Test
@@ -72,7 +72,7 @@ public class MemoryNodeBuilderTest {
         NodeBuilder childA = root.getChildBuilder("x");
         NodeBuilder childB = root.getChildBuilder("x");
 
-        childB.setProperty("test", new StringValue("foo"));
+        childB.setProperty("test", "foo");
         childA.removeProperty("test");
         assertNull(childB.getProperty("test"));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java?rev=1394089&r1=1394088&r2=1394089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java
Thu Oct  4 14:29:23 2012
@@ -29,6 +29,7 @@ import org.junit.Test;
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
+import static org.apache.jackrabbit.oak.api.Type.STRING;
 
 public class JsopUtilTest extends AbstractOakTest {
 
@@ -72,7 +73,7 @@ public class JsopUtilTest extends Abstra
         t = t.getChild("a");
         assertEquals(0, t.getChildrenCount());
         assertTrue(t.hasProperty("id"));
-        assertEquals("123", t.getProperty("id").getValue().getString());
+        assertEquals("123", t.getProperty("id").getValue(STRING));
 
         String rm = "/ - \"test\"";
         JsopUtil.apply(root, rm, vf);



Mime
View raw message