jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1406557 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/core/ main/java/org/apache/jackrabbit/oak/plugins/index/property/ main/java/org/apache/jackrabbit/oak/plugins/memory/ main/java/org/apache/jackrabbit/oak/...
Date Wed, 07 Nov 2012 11:25:34 GMT
Author: mduerig
Date: Wed Nov  7 11:25:33 2012
New Revision: 1406557

URL: http://svn.apache.org/viewvc?rev=1406557&view=rev
Log:
OAK-372: Integrate PropertyBuilder with NodeBuilder
- improve handling of array properties

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MergingNodeStateDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/PropertyBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilderTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MergingNodeStateDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MergingNodeStateDiff.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MergingNodeStateDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MergingNodeStateDiff.java
Wed Nov  7 11:25:33 2012
@@ -210,10 +210,9 @@ class MergingNodeStateDiff implements No
         }
         PropertyState childOrder = target.getProperty(TreeImpl.OAK_CHILD_ORDER);
         if (childOrder != null) {
-            PropertyBuilder<String> builder = MemoryPropertyBuilder.create(
-                    Type.STRING, childOrder);
+            PropertyBuilder<String> builder = MemoryPropertyBuilder.copy(Type.STRING,
childOrder);
             builder.addValue(name);
-            target.setProperty(builder.getPropertyState(true));
+            target.setProperty(builder.getPropertyState());
         }
         for (ChildNodeEntry entry : state.getChildNodeEntries()) {
             addChild(child, entry.getName(), entry.getNodeState());
@@ -224,15 +223,14 @@ class MergingNodeStateDiff implements No
         target.removeNode(name);
         PropertyState childOrder = target.getProperty(TreeImpl.OAK_CHILD_ORDER);
         if (childOrder != null) {
-            PropertyBuilder<String> builder = MemoryPropertyBuilder.create(
-                    Type.STRING, childOrder);
+            PropertyBuilder<String> builder = MemoryPropertyBuilder.copy(Type.STRING,
childOrder);
             builder.removeValue(name);
-            target.setProperty(builder.getPropertyState(true));
+            target.setProperty(builder.getPropertyState());
         }
     }
 
     /**
-     * <code>ChildOrderConflictHandler</code> ignores conflicts on the
+     * {@code ChildOrderConflictHandler} ignores conflicts on the
      * {@link TreeImpl#OAK_CHILD_ORDER} property. All other conflicts are forwarded
      * to the wrapped handler.
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Wed Nov  7 11:25:33 2012
@@ -268,9 +268,9 @@ public class TreeImpl implements Tree {
             getNodeBuilder().child(name);
             if (hasOrderableChildren()) {
                 getNodeBuilder().setProperty(
-                        MemoryPropertyBuilder.create(Type.STRING, internalGetProperty(OAK_CHILD_ORDER))
+                        MemoryPropertyBuilder.copy(Type.STRING, internalGetProperty(OAK_CHILD_ORDER))
                                 .addValue(name)
-                                .getPropertyState(true));
+                                .getPropertyState());
             }
             root.updated();
         }
@@ -292,9 +292,9 @@ public class TreeImpl implements Tree {
             builder.removeNode(name);
             if (parent.hasOrderableChildren()) {
                 builder.setProperty(
-                        MemoryPropertyBuilder.create(Type.STRING, parent.internalGetProperty(OAK_CHILD_ORDER))
+                        MemoryPropertyBuilder.copy(Type.STRING, parent.internalGetProperty(OAK_CHILD_ORDER))
                                 .removeValue(name)
-                                .getPropertyState(true)
+                                .getPropertyState()
                 );
             }
             root.updated();
@@ -470,10 +470,10 @@ public class TreeImpl implements Tree {
         for (String name : getNodeBuilder().getChildNodeNames()) {
             names.add(name);
         }
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.array(
                 Type.STRING, OAK_CHILD_ORDER);
         builder.setValues(names);
-        getNodeBuilder().setProperty(builder.getPropertyState(true));
+        getNodeBuilder().setProperty(builder.getPropertyState());
     }
 
     //------------------------------------------------------------< private >---

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexUpdate.java
Wed Nov  7 11:25:33 2012
@@ -89,7 +89,7 @@ class PropertyIndexUpdate {
             Set<String> paths = entry.getValue();
             PropertyState property = index.getProperty(encoded);
             if (property != null) {
-                PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING,
encoded);
+                PropertyBuilder<String> builder = MemoryPropertyBuilder.array(Type.STRING,
encoded);
                 for (String value : property.getValue(Type.STRINGS)) {
                     if (!paths.contains(value)) {
                         builder.addValue(value);
@@ -98,7 +98,7 @@ class PropertyIndexUpdate {
                 if (builder.isEmpty()) {
                     index.removeProperty(encoded);
                 } else {
-                    index.setProperty(builder.getPropertyState(true));
+                    index.setProperty(builder.getPropertyState());
                 }
             }
         }
@@ -107,7 +107,7 @@ class PropertyIndexUpdate {
             String encoded = entry.getKey();
             Set<String> paths = entry.getValue();
             PropertyState property = index.getProperty(encoded);
-            PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING)
+            PropertyBuilder<String> builder = MemoryPropertyBuilder.array(Type.STRING)
                     .setName(encoded)
                     .assignFrom(property);
             for (String path : paths) {
@@ -121,7 +121,7 @@ class PropertyIndexUpdate {
                 throw new CommitFailedException(
                         "Uniqueness constraint violated");
             } else {
-                index.setProperty(builder.getPropertyState(true));
+                index.setProperty(builder.getPropertyState());
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
Wed Nov  7 11:25:33 2012
@@ -39,6 +39,7 @@ public class MemoryPropertyBuilder<T> im
     private final Type<T> type;
 
     private String name;
+    private boolean isArray;
     private List<T> values = Lists.newArrayList();
 
     /**
@@ -53,45 +54,71 @@ public class MemoryPropertyBuilder<T> im
     }
 
     /**
-     * Create a new instance for building {@code PropertyState} instances
+     * Create a new instance for building scalar {@code PropertyState} instances
      * of the given {@code type}.
      * @param type  type of the {@code PropertyState} instances to be built.
      * @return {@code PropertyBuilder} for {@code type}
      */
-    public static <T> PropertyBuilder<T> create(Type<T> type) {
+    public static <T> PropertyBuilder<T> scalar(Type<T> type) {
         return new MemoryPropertyBuilder<T>(type);
     }
 
     /**
-     * Create a new instance for building {@code PropertyState} instances
-     * of the given {@code type}. The builder is initialised with the name and
-     * the values of {@code property}.
+     * Create a new instance for building array {@code PropertyState} instances
+     * of the given {@code type}.
+     * @param type  type of the {@code PropertyState} instances to be built.
+     * @return {@code PropertyBuilder} for {@code type}
+     */
+    public static <T> PropertyBuilder<T> array(Type<T> type) {
+        return new MemoryPropertyBuilder<T>(type).setArray();
+    }
+
+    /**
+     * Create a new instance for building scalar {@code PropertyState} instances
+     * of the given {@code type}. The builder is initialised with the
+     * given {@code name}.
      * Equivalent to
      * <pre>
-     *     MemoryPropertyBuilder.create(type).assignFrom(property);
+     *     MemoryPropertyBuilder.create(type).setName(name);
      * </pre>
      * @param type  type of the {@code PropertyState} instances to be built.
-     * @param property  initial name and values
+     * @param name  initial name
      * @return {@code PropertyBuilder} for {@code type}
      */
-    public static <T> PropertyBuilder<T> create(Type<T> type, PropertyState
property) {
-        return create(type).assignFrom(property);
+    public static <T> PropertyBuilder<T> scalar(Type<T> type, String name)
{
+        return scalar(type).setName(name);
     }
 
     /**
-     * Create a new instance for building {@code PropertyState} instances
+     * Create a new instance for building array {@code PropertyState} instances
      * of the given {@code type}. The builder is initialised with the
      * given {@code name}.
      * Equivalent to
      * <pre>
-     *     MemoryPropertyBuilder.create(type).setName(name);
+     *     MemoryPropertyBuilder.create(type).setName(name).setArray();
      * </pre>
      * @param type  type of the {@code PropertyState} instances to be built.
      * @param name  initial name
      * @return {@code PropertyBuilder} for {@code type}
      */
-    public static <T> PropertyBuilder<T> create(Type<T> type, String name)
{
-        return create(type).setName(name);
+    public static <T> PropertyBuilder<T> array(Type<T> type, String name)
{
+        return scalar(type).setName(name).setArray();
+    }
+
+    /**
+     * Create a new instance for building {@code PropertyState} instances
+     * of the given {@code type}. The builder is initialised with the name and
+     * the values of {@code property}.
+     * Equivalent to
+     * <pre>
+     *     MemoryPropertyBuilder.create(type).assignFrom(property);
+     * </pre>
+     * @param type  type of the {@code PropertyState} instances to be built.
+     * @param property  initial name and values
+     * @return {@code PropertyBuilder} for {@code type}
+     */
+    public static <T> PropertyBuilder<T> copy(Type<T> type, PropertyState
property) {
+        return scalar(type).assignFrom(property);
     }
 
     @Override
@@ -127,7 +154,7 @@ public class MemoryPropertyBuilder<T> im
 
     @Override
     public boolean isArray() {
-        return count() != 1;
+        return isArray;
     }
 
     @Override
@@ -135,21 +162,17 @@ public class MemoryPropertyBuilder<T> im
         return count() == 0;
     }
 
-    @Nonnull
-    @Override
-    public PropertyState getPropertyState() {
-        return getPropertyState(false);
-    }
-
     @SuppressWarnings("unchecked")
     @Nonnull
     @Override
-    public PropertyState getPropertyState(boolean asArray) {
+    public PropertyState getPropertyState() {
         checkState(name != null, "Property has no name");
+        checkState(isArray() || values.size() == 1, "Property has multiple values");
+
         if (values.isEmpty()) {
             return EmptyPropertyState.emptyProperty(name, Type.fromTag(type.tag(), true));
         }
-        else if (isArray() || asArray) {
+        else if (isArray()) {
             switch (type.tag()) {
                 case PropertyType.STRING:
                     return MultiStringPropertyState.stringProperty(name, (Iterable<String>)
values);
@@ -199,9 +222,11 @@ public class MemoryPropertyBuilder<T> im
         if (property != null) {
             setName(property.getName());
             if (property.isArray()) {
+                isArray = true;
                 setValues((Iterable<T>) property.getValue(type.getArrayType()));
             }
             else {
+                isArray = false;
                 setValue(property.getValue(type));
             }
         }
@@ -217,6 +242,20 @@ public class MemoryPropertyBuilder<T> im
 
     @Nonnull
     @Override
+    public PropertyBuilder<T> setArray() {
+        isArray = true;
+        return this;
+    }
+
+    @Nonnull
+    @Override
+    public PropertyBuilder<T> setScalar() {
+        isArray = false;
+        return this;
+    }
+
+    @Nonnull
+    @Override
     public PropertyBuilder<T> setValue(T value) {
         values.clear();
         values.add(value);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
Wed Nov  7 11:25:33 2012
@@ -194,14 +194,14 @@ class MembershipProvider extends Authori
         } else {
             PropertyState property = groupTree.getProperty(REP_MEMBERS);
             PropertyBuilder<String> propertyBuilder = property == null
-                ? MemoryPropertyBuilder.create(WEAKREFERENCE, REP_MEMBERS)
-                : MemoryPropertyBuilder.create(WEAKREFERENCE, property);
+                ? MemoryPropertyBuilder.array(WEAKREFERENCE, REP_MEMBERS)
+                : MemoryPropertyBuilder.copy(WEAKREFERENCE, property);
             if (propertyBuilder.hasValue(memberContentId)) {
                 return false;
             } else {
                 propertyBuilder.addValue(memberContentId);
             }
-            groupTree.setProperty(propertyBuilder.getPropertyState(true));
+            groupTree.setProperty(propertyBuilder.getPropertyState());
         }
         return true;
     }
@@ -218,14 +218,14 @@ class MembershipProvider extends Authori
             // FIXME: remove usage of MemoryPropertyBuilder (OAK-372)
             PropertyState property = groupTree.getProperty(REP_MEMBERS);
             PropertyBuilder<String> propertyBuilder = property == null
-                ? MemoryPropertyBuilder.create(WEAKREFERENCE, REP_MEMBERS)
-                : MemoryPropertyBuilder.create(WEAKREFERENCE, property);
+                ? MemoryPropertyBuilder.array(WEAKREFERENCE, REP_MEMBERS)
+                : MemoryPropertyBuilder.copy(WEAKREFERENCE, property);
             if (propertyBuilder.hasValue(toRemove)) {
                 propertyBuilder.removeValue(toRemove);
                 if (propertyBuilder.isEmpty()) {
                     groupTree.removeProperty(REP_MEMBERS);
                 } else {
-                    groupTree.setProperty(propertyBuilder.getPropertyState(true));
+                    groupTree.setProperty(propertyBuilder.getPropertyState());
                 }
                 return true;
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/PropertyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/PropertyBuilder.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/PropertyBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/PropertyBuilder.java
Wed Nov  7 11:25:33 2012
@@ -66,7 +66,7 @@ public interface PropertyBuilder<T> {
     int count();
 
     /**
-     * @return  {@code true} iff {@code count() != 1}
+     * @return  {@code true} this is a builder for an array property.
      */
     boolean isArray();
 
@@ -78,31 +78,18 @@ public interface PropertyBuilder<T> {
 
     /**
      * Returns an immutable property state that matches the current state of
-     * the builder. The {@code asArray} flag can be used to coerce a property
-     * state with a single value into a multi valued property state.
-     * Equivalent to {@code getPropertyState(false)}
+     * the builder.
      *
      * @return immutable property state
-     * @throws IllegalStateException  If the name of the property is not set
+     * @throws IllegalStateException  If the name of the property is not set or
+     * {@code !(isArray() || count() == 1)}.
      */
     @Nonnull
     PropertyState getPropertyState();
 
     /**
-     * Returns an immutable property state that matches the current state of
-     * the builder. The {@code asArray} flag can be used to coerce a property
-     * state with a single value into a multi valued property state.
-     *
-     * @param asArray  If {@code true} the builder creates a multi valued property state
-     * @return immutable property state
-     * @throws IllegalStateException  If the name of the property is not set
-     */
-    @Nonnull
-    PropertyState getPropertyState(boolean asArray);
-
-    /**
      * Clone {@code property} to the property state being built. After
-     * this call {@code getPropertyState(property.isArray()).equals(property)} will hold.
+     * this call {@code getPropertyState().equals(property)} will hold.
      * @param property  the property to clone
      * @return  {@code this}
      */
@@ -118,6 +105,20 @@ public interface PropertyBuilder<T> {
     PropertyBuilder<T> setName(String name);
 
     /**
+     * Make this build an array property.
+     * @return
+     */
+    @Nonnull
+    PropertyBuilder<T> setArray();
+
+    /**
+     * Make this build a scalar property.
+     * @return
+     */
+    @Nonnull
+    PropertyBuilder<T> setScalar();
+
+    /**
      * Set the value of the property state clearing all previously set values.
      * @param value  value to set
      * @return  {@code this}

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilderTest.java?rev=1406557&r1=1406556&r2=1406557&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilderTest.java
Wed Nov  7 11:25:33 2012
@@ -29,40 +29,53 @@ public class MemoryPropertyBuilderTest {
 
     @Test
     public void testStringProperty() {
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING);
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.scalar(Type.STRING);
         builder.setName("foo").setValue("bar");
         assertEquals(StringPropertyState.stringProperty("foo", "bar"),
                 builder.getPropertyState());
 
+        builder.setArray();
         assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("bar")),
-                builder.getPropertyState(true));
+                builder.getPropertyState());
     }
 
     @Test
     public void testLongProperty() {
-        PropertyBuilder<Long> builder = MemoryPropertyBuilder.create(Type.LONG);
+        PropertyBuilder<Long> builder = MemoryPropertyBuilder.scalar(Type.LONG);
         builder.setName("foo").setValue(42L);
         assertEquals(LongPropertyState.createLongProperty("foo", 42L),
                 builder.getPropertyState());
 
+        builder.setArray();
         assertEquals(MultiLongPropertyState.createLongProperty("foo", Arrays.asList(42L)),
-                builder.getPropertyState(true));
+                builder.getPropertyState());
     }
 
     @Test
     public void testStringsProperty() {
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING);
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.array(Type.STRING);
         builder.setName("foo")
                 .addValue("one")
                 .addValue("two");
         assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("one",
"two")),
                 builder.getPropertyState());
+
+        builder.setScalar();
+        try {
+            builder.getPropertyState();
+        }
+        catch (IllegalStateException expected) {
+        }
+
+        builder.removeValue("one");
+        assertEquals(StringPropertyState.stringProperty("foo", "two"),
+                builder.getPropertyState());
     }
 
     @Test
     public void testAssignFromLong() {
         PropertyState source = LongPropertyState.createLongProperty("foo", 42L);
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING);
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.scalar(Type.STRING);
         builder.assignFrom(source);
         assertEquals(StringPropertyState.stringProperty("foo", "42"),
                 builder.getPropertyState());
@@ -71,7 +84,7 @@ public class MemoryPropertyBuilderTest {
     @Test
     public void testAssignFromString() {
         PropertyState source = StringPropertyState.stringProperty("foo", "42");
-        PropertyBuilder<Long> builder = MemoryPropertyBuilder.create(Type.LONG);
+        PropertyBuilder<Long> builder = MemoryPropertyBuilder.scalar(Type.LONG);
         builder.assignFrom(source);
         assertEquals(LongPropertyState.createLongProperty("foo", 42L),
                 builder.getPropertyState());
@@ -80,14 +93,14 @@ public class MemoryPropertyBuilderTest {
     @Test(expected = NumberFormatException.class)
     public void testAssignFromStringNumberFormatException() {
         PropertyState source = StringPropertyState.stringProperty("foo", "bar");
-        PropertyBuilder<Long> builder = MemoryPropertyBuilder.create(Type.LONG);
+        PropertyBuilder<Long> builder = MemoryPropertyBuilder.scalar(Type.LONG);
         builder.assignFrom(source);
     }
 
     @Test
     public void testAssignFromLongs() {
         PropertyState source = MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L,
2L, 3L));
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING);
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.scalar(Type.STRING);
         builder.assignFrom(source);
         assertEquals(MultiStringPropertyState.stringProperty("foo", Arrays.asList("1", "2",
"3")),
                 builder.getPropertyState());
@@ -96,7 +109,7 @@ public class MemoryPropertyBuilderTest {
     @Test
     public void testAssignFromStrings() {
         PropertyState source = MultiStringPropertyState.stringProperty("foo", Arrays.asList("1",
"2", "3"));
-        PropertyBuilder<Long> builder = MemoryPropertyBuilder.create(Type.LONG);
+        PropertyBuilder<Long> builder = MemoryPropertyBuilder.scalar(Type.LONG);
         builder.assignFrom(source);
         assertEquals(MultiLongPropertyState.createLongProperty("foo", Arrays.asList(1L, 2L,
3L)),
                 builder.getPropertyState());
@@ -105,9 +118,9 @@ public class MemoryPropertyBuilderTest {
     @Test
     public void testAssignInvariant() {
         PropertyState source = MultiStringPropertyState.stringProperty("source", Arrays.asList("1",
"2", "3"));
-        PropertyBuilder<String> builder = MemoryPropertyBuilder.create(Type.STRING);
+        PropertyBuilder<String> builder = MemoryPropertyBuilder.scalar(Type.STRING);
         builder.assignFrom(source);
-        assertEquals(source, builder.getPropertyState(true));
+        assertEquals(source, builder.getPropertyState());
     }
 
 }



Mime
View raw message