jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r800875 - in /jackrabbit/branches/1.x/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/persistence/ test/java/org/apache/jackrabbit/core/
Date Tue, 04 Aug 2009 17:07:19 GMT
Author: jukka
Date: Tue Aug  4 17:07:18 2009
New Revision: 800875

URL: http://svn.apache.org/viewvc?rev=800875&view=rev
Log:
1.x: Fix merge problems for JCR-442

Modified:
    jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryCopier.java
    jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
    jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/RepositoryCopierTest.java

Modified: jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryCopier.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryCopier.java?rev=800875&r1=800874&r2=800875&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryCopier.java
(original)
+++ jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryCopier.java
Tue Aug  4 17:07:18 2009
@@ -174,7 +174,7 @@
     }
 
     private void copyVersionStore(
-            VersionManagerImpl source, VersionManagerImpl target)
+            VersionManagerImpl source, VersionManagerImpl target,
             DataStore store)
             throws Exception {
         logger.info("Copying version histories");
@@ -198,7 +198,7 @@
 
             PersistenceCopier copier = new PersistenceCopier(
                     source.getWorkspaceInfo(names[i]).getPersistenceManager(),
-                    target.getWorkspaceInfo(names[i]).getPersistenceManager());
+                    target.getWorkspaceInfo(names[i]).getPersistenceManager(),
                     target.getDataStore());
             copier.excludeNode(RepositoryImpl.SYSTEM_ROOT_NODE_ID);
             copier.copy(RepositoryImpl.ROOT_NODE_ID);

Modified: jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java?rev=800875&r1=800874&r2=800875&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
(original)
+++ jackrabbit/branches/1.x/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
Tue Aug  4 17:07:18 2009
@@ -152,9 +152,9 @@
             InternalValue[] values = sourceState.getValues();
             if (sourceState.getType() == PropertyType.BINARY) {
                 for (int i = 0; i < values.length; i++) {
-                    InputStream stream = values[i].getStream();
+                    InputStream stream = values[i].getBLOBFileValue().getStream();
                     try {
-                        values[i] = InternalValue.create(stream, store);
+                        values[i] = InternalValue.createTemporary(stream, store);
                     } finally {
                         stream.close();
                     }

Modified: jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/RepositoryCopierTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/RepositoryCopierTest.java?rev=800875&r1=800874&r2=800875&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/RepositoryCopierTest.java
(original)
+++ jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/RepositoryCopierTest.java
Tue Aug  4 17:07:18 2009
@@ -19,11 +19,9 @@
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
-import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Random;
 
-import javax.jcr.Binary;
 import javax.jcr.Credentials;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
@@ -31,9 +29,6 @@
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.Value;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.NodeTypeTemplate;
 
 import junit.framework.TestCase;
 
@@ -85,54 +80,26 @@
                     session.getWorkspace().getNamespaceRegistry();
                 registry.registerNamespace("test", "http://www.example.org/");
 
-                NodeTypeManager manager =
-                    session.getWorkspace().getNodeTypeManager();
-                NodeTypeTemplate template = manager.createNodeTypeTemplate();
-                template.setName("test:unstructured");
-                template.setDeclaredSuperTypeNames(
-                        new String[] { "nt:unstructured" });
-                manager.registerNodeType(template, false);
-
                 Node root = session.getRootNode();
 
                 Node referenceable =
-                    root.addNode("referenceable", "test:unstructured");
-                referenceable.addMixin(NodeType.MIX_REFERENCEABLE);
+                    root.addNode("referenceable", "nt:unstructured");
+                referenceable.addMixin("mix:referenceable");
                 session.save();
-                identifier = referenceable.getIdentifier();
+                identifier = referenceable.getUUID();
 
-                Node properties = root.addNode("properties", "test:unstructured");
+                Node properties = root.addNode("properties", "nt:unstructured");
                 properties.setProperty("boolean", true);
-                Binary binary = session.getValueFactory().createBinary(
+                Value binary = session.getValueFactory().createValue(
                         new ByteArrayInputStream(BINARY));
-                try {
-                    properties.setProperty("binary", binary);
-                } finally {
-                    binary.dispose();
-                }
+                properties.setProperty("binary", binary);
                 properties.setProperty("date", DATE);
-                properties.setProperty("decimal", new BigDecimal(123));
                 properties.setProperty("double", Math.PI);
                 properties.setProperty("long", 9876543210L);
                 properties.setProperty("reference", referenceable);
                 properties.setProperty("string", "test");
                 properties.setProperty("multiple", "a,b,c".split(","));
                 session.save();
-
-                binary = properties.getProperty("binary").getBinary();
-                try {
-                    InputStream stream = binary.getStream();
-                    try {
-                        for (int i = 0; i < BINARY.length; i++) {
-                            assertEquals(BINARY[i], (byte) stream.read());
-                        }
-                        assertEquals(-1, stream.read());
-                    } finally {
-                        stream.close();
-                    }
-                } finally {
-                    binary.dispose();
-                }
             } finally {
                 session.logout();
             }
@@ -151,15 +118,8 @@
                         "http://www.example.org/",
                         session.getNamespaceURI("test"));
 
-                NodeTypeManager manager =
-                    session.getWorkspace().getNodeTypeManager();
-                assertTrue(manager.hasNodeType("test:unstructured"));
-                NodeType type = manager.getNodeType("test:unstructured");
-                assertFalse(type.isMixin());
-                assertTrue(type.isNodeType("nt:unstructured"));
-
-                assertTrue(session.nodeExists("/properties"));
-                Node properties = session.getNode("/properties");
+                assertTrue(session.itemExists("/properties"));
+                Node properties = (Node) session.getItem("/properties");
                 assertEquals(
                         PropertyType.BOOLEAN,
                         properties.getProperty("boolean").getType());
@@ -168,19 +128,15 @@
                 assertEquals(
                         PropertyType.BINARY,
                         properties.getProperty("binary").getType());
-                Binary binary = properties.getProperty("binary").getBinary();
+                Value binary = properties.getProperty("binary").getValue();
+                InputStream stream = binary.getStream();
                 try {
-                    InputStream stream = binary.getStream();
-                    try {
-                        for (int i = 0; i < BINARY.length; i++) {
-                            assertEquals(BINARY[i], (byte) stream.read());
-                        }
-                        assertEquals(-1, stream.read());
-                    } finally {
-                        stream.close();
+                    for (int i = 0; i < BINARY.length; i++) {
+                        assertEquals(BINARY[i], (byte) stream.read());
                     }
+                    assertEquals(-1, stream.read());
                 } finally {
-                    binary.dispose();
+                    stream.close();
                 }
                 assertEquals(
                         PropertyType.DATE,
@@ -189,16 +145,10 @@
                         DATE.getTimeInMillis(),
                         properties.getProperty("date").getDate().getTimeInMillis());
                 assertEquals(
-                        PropertyType.DECIMAL,
-                        properties.getProperty("decimal").getType());
-                assertEquals(
-                        new BigDecimal(123),
-                        properties.getProperty("decimal").getDecimal());
-                assertEquals(
                         PropertyType.DOUBLE,
                         properties.getProperty("double").getType());
-                assertEquals(
-                        Math.PI, properties.getProperty("double").getDouble());
+                assertTrue(
+                        Math.PI == properties.getProperty("double").getDouble());
                 assertEquals(
                         PropertyType.LONG,
                         properties.getProperty("long").getType());



Mime
View raw message