incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r964876 - in /sling/trunk: bundles/jcr/davex/ bundles/jcr/jackrabbit-server/ bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/ bundles/jcr/webdav/ launchpad/builder/src/main/bundles/ launchpad/test-ser...
Date Fri, 16 Jul 2010 17:47:59 GMT
Author: justin
Date: Fri Jul 16 17:47:58 2010
New Revision: 964876

URL: http://svn.apache.org/viewvc?rev=964876&view=rev
Log:
SLING-1531 - upgrading to jackrabbit 2.1

Modified:
    sling/trunk/bundles/jcr/davex/pom.xml
    sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/TestContentLoaderImpl.java
    sling/trunk/bundles/jcr/webdav/pom.xml
    sling/trunk/launchpad/builder/src/main/bundles/list.xml
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/StartupTestContentLoader.java

Modified: sling/trunk/bundles/jcr/davex/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/davex/pom.xml?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/davex/pom.xml (original)
+++ sling/trunk/bundles/jcr/davex/pom.xml Fri Jul 16 17:47:58 2010
@@ -98,7 +98,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-server</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
             <scope>compile</scope>
         </dependency>
 

Modified: sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/pom.xml?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/pom.xml (original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/pom.xml Fri Jul 16 17:47:58 2010
@@ -96,7 +96,7 @@
                         <Export-Package>
                             org.apache.sling.jcr.jackrabbit.server;version=2.0.7,
                             org.apache.sling.jcr.jackrabbit.server.security.*;version=2.0.4-incubator,
-                            org.apache.jackrabbit.core.security.principal;version=2.0.0
+                            org.apache.jackrabbit.core.security.principal;version=2.1.0
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.jcr.jackrabbit.server.impl.*,
@@ -215,7 +215,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-core</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/TestContentLoaderImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/TestContentLoaderImpl.java?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/TestContentLoaderImpl.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/TestContentLoaderImpl.java
Fri Jul 16 17:47:58 2010
@@ -16,27 +16,11 @@
  */
 package org.apache.sling.jcr.jackrabbit.server.impl;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-
-import javax.jcr.Node;
-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 javax.jcr.nodetype.NodeType;
-import javax.jcr.retention.RetentionPolicy;
-
-import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
-import org.apache.jackrabbit.api.JackrabbitWorkspace;
-import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.retention.RetentionPolicyImpl;
+
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.jackrabbit.server.TestContentLoader;
 
@@ -46,7 +30,7 @@ import org.apache.sling.jcr.jackrabbit.s
  * JackrabbitRepositoryStub class. Once that class is refactored, we can remove
  * almost all of this code.
  *
- * @scr.component immediate="true" metatype="no"
+ * @scr.component metatype="no"
  * @scr.service
  *
  * @scr.property name="service.description" value="Test Content Loader"
@@ -64,193 +48,10 @@ public class TestContentLoaderImpl imple
 
         Session session = repository.loginAdministrative(null);
         try {
-            loadTestContent(session);
+            new org.apache.jackrabbit.core.TestContentLoader().loadTestContent(session);
         } finally {
             session.logout();
         }
     }
 
-    private void loadTestContent(Session session) throws RepositoryException, IOException
{
-        JackrabbitWorkspace workspace = (JackrabbitWorkspace) session.getWorkspace();
-        Collection<String> workspaces = Arrays.asList(workspace.getAccessibleWorkspaceNames());
-        if (!workspaces.contains("test")) {
-            workspace.createWorkspace("test");
-        }
-
-        JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager) workspace.getNodeTypeManager();
-        if (!manager.hasNodeType("test:versionable")) {
-            InputStream xml = getResource("/org/apache/jackrabbit/core/test-nodetypes.xml");
-            try {
-                manager.registerNodeTypes(xml, JackrabbitNodeTypeManager.TEXT_XML);
-            } finally {
-                xml.close();
-            }
-        }
-
-        Node data = getOrAddNode(session.getRootNode(), "testdata");
-        addPropertyTestData(getOrAddNode(data, "property"));
-        addQueryTestData(getOrAddNode(data, "query"));
-        addNodeTestData(getOrAddNode(data, "node"));
-        addLifecycleTestData(getOrAddNode(data, "lifecycle"));
-        addExportTestData(getOrAddNode(data, "docViewTest"));
-
-        Node conf = getOrAddNode(session.getRootNode(), "testconf");
-        addRetentionTestData(getOrAddNode(conf, "retentionTest"));
-
-        session.save();
-    }
-
-    private InputStream getResource(String name) {
-        return TestContentLoaderImpl.class.getResourceAsStream(name);
-    }
-
-    private Node getOrAddNode(Node node, String name) throws RepositoryException {
-        try {
-            return node.getNode(name);
-        } catch (PathNotFoundException e) {
-            return node.addNode(name);
-        }
-    }
-
-    /**
-     * Creates a boolean, double, long, calendar and a path property at the
-     * given node.
-     */
-    private void addPropertyTestData(Node node) throws RepositoryException {
-        node.setProperty("boolean", true);
-        node.setProperty("double", Math.PI);
-        node.setProperty("long", 90834953485278298l);
-        Calendar c = Calendar.getInstance();
-        c.set(2005, 6, 18, 17, 30);
-        node.setProperty("calendar", c);
-        ValueFactory factory = node.getSession().getValueFactory();
-        node.setProperty("path", factory.createValue("/", PropertyType.PATH));
-        node.setProperty("multi", new String[] { "one", "two", "three" });
-    }
-
-    /**
-     * Creates a node with a RetentionPolicy
-     */
-    private void addRetentionTestData(Node node) throws RepositoryException {
-        RetentionPolicy rp = RetentionPolicyImpl.createRetentionPolicy("testRetentionPolicy",
node.getSession());
-        node.getSession().getRetentionManager().setRetentionPolicy(node.getPath(), rp);
-    }
-
-    /**
-     * Creates four nodes under the given node. Each node has a String property
-     * named "prop1" with some content set.
-     */
-    private void addQueryTestData(Node node) throws RepositoryException {
-        while (node.hasNode("node1")) {
-            node.getNode("node1").remove();
-        }
-        getOrAddNode(node, "node1").setProperty("prop1", "You can have it good, cheap, or
fast. Any two.");
-        getOrAddNode(node, "node1").setProperty("prop1", "foo bar");
-        getOrAddNode(node, "node1").setProperty("prop1", "Hello world!");
-        getOrAddNode(node, "node2").setProperty("prop1", "Apache Jackrabbit");
-    }
-
-    /**
-     * 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());
-
-        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) });
-    }
-
-    /**
-     * Creates a lifecycle policy node and another node with a lifecycle
-     * referencing that policy.
-     */
-    private void addLifecycleTestData(Node node) throws RepositoryException {
-        Node policy = getOrAddNode(node, "policy");
-        policy.addMixin(NodeType.MIX_REFERENCEABLE);
-        Node transitions = getOrAddNode(policy, "transitions");
-        Node transition = getOrAddNode(transitions, "identity");
-        transition.setProperty("from", "identity");
-        transition.setProperty("to", "identity");
-
-        Node lifecycle = getOrAddNode(node, "node");
-        ((NodeImpl) lifecycle).assignLifecyclePolicy(policy, "identity");
-    }
-
-    private void addExportTestData(Node node) throws RepositoryException, IOException {
-        getOrAddNode(node, "invalidXmlName").setProperty("propName", "some text");
-
-        // three nodes which should be serialized as xml text in docView export
-        // separated with spaces
-        getOrAddNode(node, "jcr:xmltext").setProperty("jcr:xmlcharacters", "A text without
any special character.");
-        getOrAddNode(node, "some-element");
-        getOrAddNode(node, "jcr:xmltext").setProperty("jcr:xmlcharacters",
-                " The entity reference characters: <, ', ,&, >,  \" should" + "
be escaped in xml export. ");
-        getOrAddNode(node, "some-element");
-        getOrAddNode(node, "jcr:xmltext").setProperty("jcr:xmlcharacters", "A text without
any special character.");
-
-        Node big = getOrAddNode(node, "bigNode");
-        big.setProperty("propName0", "SGVsbG8gd8O2cmxkLg==;SGVsbG8gd8O2cmxkLg==".split(";"),
PropertyType.BINARY);
-        big.setProperty("propName1", "text 1");
-        big.setProperty("propName2", "multival text 1;multival text 2;multival text 3".split(";"));
-        big.setProperty("propName3", "text 1");
-
-        addExportValues(node, "propName");
-        addExportValues(node, "Prop<>prop");
-    }
-
-    /**
-     * create nodes with following properties binary & single binary & multival
-     * notbinary & single notbinary & multival
-     */
-    private void addExportValues(Node node, String name) throws RepositoryException, IOException
{
-        String prefix = "valid";
-        if (name.indexOf('<') != -1) {
-            prefix = "invalid";
-        }
-        node = getOrAddNode(node, prefix + "Names");
-
-        String[] texts = new String[] { "multival text 1", "multival text 2", "multival text
3" };
-        getOrAddNode(node, prefix + "MultiNoBin").setProperty(name, texts);
-
-        Node resource = getOrAddNode(node, prefix + "MultiBin");
-        resource.setProperty("jcr:encoding", encoding);
-        resource.setProperty("jcr:mimeType", "text/plain");
-        String[] values = new String[] { "SGVsbG8gd8O2cmxkLg==", "SGVsbG8gd8O2cmxkLg==" };
-        resource.setProperty(name, values, PropertyType.BINARY);
-        resource.setProperty("jcr:lastModified", Calendar.getInstance());
-
-        getOrAddNode(node, prefix + "NoBin").setProperty(name, "text 1");
-
-        resource = getOrAddNode(node, "invalidBin");
-        resource.setProperty("jcr:encoding", encoding);
-        resource.setProperty("jcr:mimeType", "text/plain");
-        byte[] bytes = "Hello w\u00F6rld.".getBytes(encoding);
-        resource.setProperty(name, new ByteArrayInputStream(bytes));
-        resource.setProperty("jcr:lastModified", Calendar.getInstance());
-    }
-
 }

Modified: sling/trunk/bundles/jcr/webdav/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/webdav/pom.xml?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/webdav/pom.xml (original)
+++ sling/trunk/bundles/jcr/webdav/pom.xml Fri Jul 16 17:47:58 2010
@@ -117,7 +117,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-server</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
             <scope>compile</scope>
         </dependency>
 

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Fri Jul 16 17:47:58 2010
@@ -257,7 +257,7 @@
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-api</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.derby</groupId>
@@ -287,22 +287,22 @@
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-spi</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-spi-commons</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-rmi</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>

Modified: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/StartupTestContentLoader.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/StartupTestContentLoader.java?rev=964876&r1=964875&r2=964876&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/StartupTestContentLoader.java
(original)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/StartupTestContentLoader.java
Fri Jul 16 17:47:58 2010
@@ -26,7 +26,7 @@ import org.osgi.service.component.Compon
 /**
  * Component which loads the JCR test content on startup.
  *
- * @scr.component immediate="false" metatype="no"
+ * @scr.component enabled="false" metatype="no"
  *
  * @scr.property name="service.description" value="Test Content Loader"
  * @scr.property name="service.vendor" value="The Apache Software Foundation"



Mime
View raw message