chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r891381 - in /incubator/chemistry/trunk/chemistry: chemistry-jcr/src/main/java/org/apache/chemistry/jcr/ chemistry-tests/src/test/java/org/apache/chemistry/test/ chemistry-tests/src/test/resources/
Date Wed, 16 Dec 2009 18:59:50 GMT
Author: fguillaume
Date: Wed Dec 16 18:59:48 2009
New Revision: 891381

URL: http://svn.apache.org/viewvc?rev=891381&view=rev
Log:
CMIS-80: add mix:unstructured to test Jackrabbit repository

Added:
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
  (with props)
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd 
 (with props)
Modified:
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestJcrRepository.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java?rev=891381&r1=891380&r2=891381&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
Wed Dec 16 18:59:48 2009
@@ -278,6 +278,10 @@
         Map<String, Property> properties = new HashMap<String, Property>();
         for (PropertyDefinition pd : getType().getPropertyDefinitions()) {
             String id = pd.getId();
+            if ("*".equals(id)) {
+                // residual property
+                continue;
+            }
             properties.put(id, getProperty(id));
         }
         // TODO return other virtual properties and provide helper class

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestJcrRepository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestJcrRepository.java?rev=891381&r1=891380&r2=891381&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestJcrRepository.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/java/org/apache/chemistry/test/TestJcrRepository.java
Wed Dec 16 18:59:48 2009
@@ -13,18 +13,25 @@
  *
  * Authors:
  *     Florent Guillaume, Nuxeo
+ *     Michael Durig, Day
+ *     Serge Huber, Jahia
  */
 package org.apache.chemistry.test;
 
 import java.io.File;
+import java.io.InputStream;
 
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
+import javax.jcr.Workspace;
+import javax.jcr.nodetype.NodeTypeManager;
 
 import org.apache.chemistry.CapabilityQuery;
 import org.apache.chemistry.Repository;
+import org.apache.chemistry.jcr.JcrObjectEntry;
 import org.apache.chemistry.jcr.JcrRepository;
 import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.api.JackrabbitRepository;
 import org.apache.jackrabbit.core.TransientRepository;
 
@@ -35,6 +42,8 @@
 
     private static final String DIRECTORY = "target/test/jackrabbit";
 
+    private static final String NODETYPES_CND = "/nodetypes.cnd";
+
     protected JackrabbitRepository jackrabbitRepo;
 
     @Override
@@ -48,7 +57,15 @@
         jackrabbitRepo = new TransientRepository(config, home);
         Session session = jackrabbitRepo.login(new SimpleCredentials("userid",
                 "".toCharArray()));
-        String workspaceName = session.getWorkspace().getName();
+        Workspace workspace = session.getWorkspace();
+        String workspaceName = workspace.getName();
+        // add mix:unstructured if needed
+        JackrabbitNodeTypeManager ntm = (JackrabbitNodeTypeManager) workspace.getNodeTypeManager();
+        if (!ntm.hasNodeType(JcrObjectEntry.MIX_UNSTRUCTURED)) {
+            InputStream is = getClass().getResourceAsStream(NODETYPES_CND);
+            ntm.registerNodeTypes(is, JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+        }
+        session.logout();
 
         expectedRepositoryId = "Jackrabbit";
         expectedRepositoryName = "Jackrabbit";

Added: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties?rev=891381&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
(added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
Wed Dec 16 18:59:48 2009
@@ -0,0 +1,4 @@
+log4j.rootLogger=WARN, CONSOLE
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd?rev=891381&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd Wed
Dec 16 18:59:48 2009
@@ -0,0 +1,28 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+
+/**
+ * This mixin is used to store unstructured content. It allows any number of
+ * child nodes or properties with any names. It also allows multiple nodes having
+ * the same name as well as both multi-value and single-value properties with any
+ * names. This node type also supports client-orderable child nodes.
+ */
+[mix:unstructured]
+  mixin orderable
+  - * (UNDEFINED) multiple
+  - * (UNDEFINED)
+  + * (nt:base) = nt:unstructured multiple VERSION

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-tests/src/test/resources/nodetypes.cnd
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message