You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2012/06/13 16:41:29 UTC

svn commit: r1349881 - in /ofbiz/branches/jackrabbit20120501: ./ framework/base/config/ framework/jcr/src/org/ofbiz/jcr/test/ framework/jcr/testdef/

Author: sascharodekamp
Date: Wed Jun 13 14:41:29 2012
New Revision: 1349881

URL: http://svn.apache.org/viewvc?rev=1349881&view=rev
Log:
Modify the tenant tests and add jcr entry in the ofbiz-, test-container.xml, remove classpath entries which points to jars which aren't exist anymore

Added:
    ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java   (with props)
Modified:
    ofbiz/branches/jackrabbit20120501/.classpath
    ofbiz/branches/jackrabbit20120501/framework/base/config/ofbiz-containers.xml
    ofbiz/branches/jackrabbit20120501/framework/base/config/test-containers.xml
    ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java
    ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitDataTests.java
    ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitFilesTests.java
    ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitQueryTests.java
    ofbiz/branches/jackrabbit20120501/framework/jcr/testdef/jcrtests.xml

Modified: ofbiz/branches/jackrabbit20120501/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/.classpath?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/.classpath (original)
+++ ofbiz/branches/jackrabbit20120501/.classpath Wed Jun 13 14:41:29 2012
@@ -39,7 +39,6 @@
 	<classpathentry kind="lib" path="framework/base/lib/ivy-2.2.0.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/javolution-5.4.3.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/jcip-annotations-1.0.jar"/>
-	<classpathentry kind="lib" path="framework/base/lib/jcl-over-slf4j-1.6.4.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/jdbm-1.0-SNAPSHOT.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/jdom-1.1.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/jpim-0.1.jar"/>
@@ -54,7 +53,6 @@
 	<classpathentry kind="lib" path="framework/base/lib/resolver-2.9.1.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/serializer-2.9.1.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/slf4j-api-1.6.4.jar"/>
-	<classpathentry kind="lib" path="framework/base/lib/slf4j-simple-1.6.4.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/xercesImpl-2.9.1.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/ws-commons-java5-1.0.1.jar"/>
 	<classpathentry kind="lib" path="framework/base/lib/ws-commons-util-1.0.2.jar"/>

Modified: ofbiz/branches/jackrabbit20120501/framework/base/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/base/config/ofbiz-containers.xml?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/base/config/ofbiz-containers.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/base/config/ofbiz-containers.xml Wed Jun 13 14:41:29 2012
@@ -53,6 +53,14 @@ under the License.
         <property name="ssl-client-auth" value="false"/>
     </container>
 
+
+    <!-- Load embedded Jackrabbit content repository. Since this container depends
+    upon JNDI, it must be started after the naming-container container.-->
+    <container name="jcr-container" class="org.ofbiz.jcr.loader.JCRContainer">
+        <property name="configFilePath" value="framework/jcr/config/jcr-config.xml"/>
+        <property name="removeOnShutdown" value="false"/>
+    </container>
+
     <!-- JavaMail Listener Container - Triggers MCA Rules -->
     <!-- if delete-mail is set to true, will delete messages after fetching them. otherwise, will try to mark them as seen
         mail.store.protocol supports both imap and pop3, but pop3 will not be able to mark messages as seen, so you would need to delete them-->

Modified: ofbiz/branches/jackrabbit20120501/framework/base/config/test-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/base/config/test-containers.xml?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/base/config/test-containers.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/base/config/test-containers.xml Wed Jun 13 14:41:29 2012
@@ -50,6 +50,13 @@ under the License.
         <property name="ssl-client-auth" value="true"/>
     </container>
 
+    <!-- Load embedded Jackrabbit content repository. Since this container depends
+    upon JNDI, it must be started after the naming-container container.-->
+    <container name="jcr-container" class="org.ofbiz.jcr.loader.JCRContainer">
+        <property name="configFilePath" value="framework/jcr/config/jcr-test-config.xml"/>
+        <property name="removeRepositoryOnShutdown" value="true"/>
+    </container>
+
     <!-- load catalina (tomcat) and all web applications -->
     <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer">
         <!-- static configuration for tomcat -->

Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitBaseTests.java Wed Jun 13 14:41:29 2012
@@ -104,7 +104,7 @@ public class JackrabbitBaseTests extends
     public void testSpeedTestService() throws Exception {
         Map<String, Object> context = FastMap.newInstance();
         context.put("maxNodes", new Integer(10));
-        context.put("userLogin", dispatcher.getDelegator().findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system")));
+        context.put("userLogin", dispatcher.getDelegator().findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true));
 
         Map<String, Object> serviceResult = this.dispatcher.runSync("determineJackrabbitRepositorySpeed", context);
 

Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitDataTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitDataTests.java?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitDataTests.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitDataTests.java Wed Jun 13 14:41:29 2012
@@ -51,7 +51,7 @@ public class JackrabbitDataTests extends
 
     @Override
     protected void setUp() throws Exception {
-        userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+        userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true);
 
     }
 

Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitFilesTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitFilesTests.java?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitFilesTests.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitFilesTests.java Wed Jun 13 14:41:29 2012
@@ -32,7 +32,7 @@ public class JackrabbitFilesTests extend
 
     @Override
     protected void setUp() throws Exception {
-        userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+        userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true);
 
     }
 

Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitQueryTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitQueryTests.java?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitQueryTests.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitQueryTests.java Wed Jun 13 14:41:29 2012
@@ -32,7 +32,7 @@ public class JackrabbitQueryTests extend
 
     @Override
     protected void setUp() throws Exception {
-        userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+        userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"),	true);
 
     }
 

Added: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java?rev=1349881&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java (added)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java Wed Jun 13 14:41:29 2012
@@ -0,0 +1,68 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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.
+ */
+package org.ofbiz.jcr.test;
+
+import java.util.GregorianCalendar;
+
+import javax.jcr.PathNotFoundException;
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.DelegatorFactory;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.jcr.api.JcrDataHelper;
+import org.ofbiz.jcr.api.jackrabbit.JackrabbitArticleHelper;
+import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle;
+import org.ofbiz.service.testtools.OFBizTestCase;
+
+public class JackrabbitTenantTests extends OFBizTestCase {
+
+	private GenericValue userLogin = null;
+
+	public JackrabbitTenantTests(String name) {
+		super(name);
+	}
+
+	@Override
+	public void setUp() throws Exception {
+		userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true);
+	}
+
+	public void testTenant() throws Exception {
+
+		JcrDataHelper helper = new JackrabbitArticleHelper(userLogin, delegator);
+		helper.storeContentInRepository("news/article", "en", "News Of Today", "Hello World", new GregorianCalendar());
+
+		JackrabbitArticle content = helper.readContentFromRepository("news/article");
+		assertEquals("Hello World", content.getContent());
+		helper.closeContentSession();
+
+		String delegatorName = delegator.getDelegatorBaseName() + "#DEMO1";
+		Delegator tenantDelegator = DelegatorFactory.getDelegator(delegatorName);
+
+		JcrDataHelper tenantHelper = new JackrabbitArticleHelper(userLogin, tenantDelegator);
+		try {
+			tenantHelper.readContentFromRepository("news/article");
+			fail("PathNotFoundException expected");
+		} catch (PathNotFoundException e) {
+			assertTrue("Caught a PathNotFoundExcpetion as expected.", true);
+		}
+		tenantHelper.closeContentSession();
+	}
+}

Propchange: ofbiz/branches/jackrabbit20120501/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTenantTests.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/branches/jackrabbit20120501/framework/jcr/testdef/jcrtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/jcr/testdef/jcrtests.xml?rev=1349881&r1=1349880&r2=1349881&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/jcr/testdef/jcrtests.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/jcr/testdef/jcrtests.xml Wed Jun 13 14:41:29 2012
@@ -29,8 +29,17 @@
     -->
 
 
-    <test-case case-name="jackrabbit-tests">
-        <junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitTests"/>
-    </test-case>
+		<!--
+	<test-group case-name="jackrabbit-tests">
+		<junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitBaseTests"/>
+		<junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitDataTests"/>
+		<junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitFilesTests"/>
+		<junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitQueryTests"/>
+	</test-group>
+		-->
+
+	<test-case case-name="jackrabbit-tenant-tests">
+		<junit-test-suite class-name="org.ofbiz.jcr.test.JackrabbitTenantTests"/>
+	</test-case>
 
 </test-suite>
\ No newline at end of file