jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1336688 - in /jackrabbit/oak/trunk/oak-it/jcr: pom.xml src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
Date Thu, 10 May 2012 13:47:40 GMT
Author: reschke
Date: Thu May 10 13:47:40 2012
New Revision: 1336688

URL: http://svn.apache.org/viewvc?rev=1336688&view=rev
Log:
OAK-6: add more test content and update test exclusion list

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
    jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1336688&r1=1336687&r2=1336688&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Thu May 10 13:47:40 2012
@@ -44,7 +44,12 @@
             <property>
               <name>known.issues</name>
               <value>
+org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetPrimaryItem
+org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID
+org.apache.jackrabbit.test.api.BinaryPropertyTest#testSameStream
+org.apache.jackrabbit.test.api.BinaryPropertyTest#testRandomAccess
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUIDFailure
+org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID
 org.apache.jackrabbit.test.api.PathTest#testGetItem
 org.apache.jackrabbit.test.api.PathTest#testCreatePathValue
 org.apache.jackrabbit.test.api.PathTest#testCreateMultiplePathValue
@@ -77,6 +82,7 @@ org.apache.jackrabbit.test.api.SessionRe
 org.apache.jackrabbit.test.api.HasPermissionTest
 org.apache.jackrabbit.test.api.WorkspaceTest
 org.apache.jackrabbit.test.api.ShareableNodeTest
+org.apache.jackrabbit.test.api.nodetype.PropertyDefTest#testIsMandatory
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyDateTest#testConversions
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyMultipleTest#testReturnFalseBecauseIsProtected
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyMultipleTest#testReturnFalseBecauseIsNotMultiple

Modified: jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java?rev=1336688&r1=1336687&r2=1336688&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
Thu May 10 13:47:40 2012
@@ -23,6 +23,8 @@ import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
+
+import java.io.IOException;
 import java.security.Principal;
 import java.util.Properties;
 
@@ -35,8 +37,9 @@ public class OakRepositoryStub extends R
      * 
      * @param settings repository settings
      * @throws javax.jcr.RepositoryException If an error occurs.
+     * @throws IOException 
      */
-    public OakRepositoryStub(Properties settings) throws RepositoryException {
+    public OakRepositoryStub(Properties settings) throws RepositoryException, IOException
{
         super(settings);
         repository = new RepositoryImpl();
         Session session = repository.login(superuser);

Modified: jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java?rev=1336688&r1=1336687&r2=1336688&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
(original)
+++ jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/TestContentLoader.java
Thu May 10 13:47:40 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.util.Calendar;
 
 import javax.jcr.Node;
@@ -23,14 +25,23 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.Value;
 import javax.jcr.ValueFactory;
 
+import org.apache.jackrabbit.commons.JcrUtils;
+
 public class TestContentLoader {
 
-    public void loadTestContent(Session session) throws RepositoryException {
+    /**
+     * The encoding of the test resources.
+     */
+    private static final String ENCODING = "UTF-8";
+
+    public void loadTestContent(Session session) throws RepositoryException, IOException
{
 
         Node data = getOrAddNode(session.getRootNode(), "testdata");
         addPropertyTestData(getOrAddNode(data, "property"));
+        addNodeTestData(getOrAddNode(data, "node"));
 
         session.save();
     }
@@ -58,4 +69,49 @@ public class TestContentLoader {
         node.setProperty("path", factory.createValue("/", PropertyType.PATH));
         node.setProperty("multi", new String[] { "one", "two", "three" });
     }
+
+    /**
+     * Creates three nodes under the given node: one of type nt:resource
+     * and the other nodes referencing it.
+     */
+    private  void addNodeTestData(Node node) throws RepositoryException, IOException {
+        if (node.hasNode("multiReference")) {
+            node.getNode("multiReference").remove();
+        }
+        if (node.hasNode("resReference")) {
+            node.getNode("resReference").remove();
+        }
+        if (node.hasNode("myResource")) {
+            node.getNode("myResource").remove();
+        }
+
+        Node resource = node.addNode("myResource", "nt:resource");
+        // nt:resource not longer referenceable since JCR 2.0
+        resource.addMixin("mix:referenceable");
+        resource.setProperty("jcr:encoding", ENCODING);
+        resource.setProperty("jcr:mimeType", "text/plain");
+        resource.setProperty(
+                "jcr:data",
+                new ByteArrayInputStream("Hello w\u00F6rld.".getBytes(ENCODING)));
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+
+
+        // TODO: re-add once we have referenceable nodes
+//        Node resReference = getOrAddNode(node, "reference");
+//        resReference.setProperty("ref", resource);
+//        // make this node itself referenceable
+//        resReference.addMixin("mix:referenceable");
+//
+//        Node multiReference = node.addNode("multiReference");
+//        ValueFactory factory = node.getSession().getValueFactory();
+//        multiReference.setProperty("ref", new Value[] {
+//                factory.createValue(resource),
+//                factory.createValue(resReference)
+//            });
+
+        // NodeDefTest requires a test node with a mandatory child node
+        JcrUtils.putFile(
+                node, "testFile", "text/plain",
+                new ByteArrayInputStream("Hello, World!".getBytes("UTF-8")));
+    }
 }



Mime
View raw message