jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1135991 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Date Wed, 15 Jun 2011 10:39:10 GMT
Author: mduerig
Date: Wed Jun 15 10:39:10 2011
New Revision: 1135991

URL: http://svn.apache.org/viewvc?rev=1135991&view=rev
Log:
spi2microkernel prototype (WIP)
value types: decimal

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java?rev=1135991&r1=1135990&r2=1135991&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Values.java
Wed Jun 15 10:39:10 2011
@@ -99,22 +99,25 @@ public final class Values {
             }
         });
 
-        put(Integer.class, new ValueFactory() {
+        valueFactory = new ValueFactory() {
             public QValue create(Object value) throws RepositoryException {
-                return FACTORY.create((Integer) value);
+                return FACTORY.create((BigDecimal) value);
             }
 
             public QValue create(String value) throws RepositoryException {
-                return null; // todo implement create
+                return FACTORY.create(value, PropertyType.DECIMAL);   
             }
-        });
-        put(BigDecimal.class, new ValueFactory() {
+        };
+        put(BigDecimal.class, valueFactory);
+        put(TYPES[PropertyType.DECIMAL], valueFactory);
+
+        put(Integer.class, new ValueFactory() {
             public QValue create(Object value) throws RepositoryException {
-                return FACTORY.create((BigDecimal) value);
+                return FACTORY.create((Integer) value);
             }
 
             public QValue create(String value) throws RepositoryException {
-                return null; // todo implement create   
+                return null; // todo implement create
             }
         });
         // todo handle other value types
@@ -166,8 +169,10 @@ public final class Values {
             case PropertyType.BOOLEAN:
                 return value.getString();
             
-                // todo implement support for the other value types
             case PropertyType.DECIMAL:
+                return typeEncode(type, value.getString());
+
+                // todo implement support for the other value types
             case PropertyType.DATE:
             case PropertyType.BINARY:
             case PropertyType.NAME:

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1135991&r1=1135990&r2=1135991&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Wed Jun 15 10:39:10 2011
@@ -256,7 +256,6 @@ public class RepositoryTest {
         addProperty(parentNode, "boolean", getSession().getValueFactory().createValue(true));
     }
 
-    @Ignore  // todo correctly implement value types
     @Test
     public void addDecimalProperty() throws RepositoryException {
         Node parentNode = getNode(testPath);



Mime
View raw message