Author: sascharodekamp
Date: Wed Oct 12 13:06:16 2011 New Revision: 1182348 URL: http://svn.apache.org/viewvc?rev=1182348&view=rev Log: Update the JCR test Suite Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/OfbizRepositoryMappingJackrabbitLocalizedContent.java ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JcrTests.java Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java?rev=1182348&r1=1182347&r2=1182348&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java (original) +++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java Wed Oct 12 13:06:16 2011 @@ -135,16 +135,6 @@ public class JcrArticleHelper extends Ab language = determindeTheDefaultLanguage(); } - // the content path should contain the language information - // TODO this have to be a little bit more intelligent in the future - if (!contentPath.endsWith(language)) { - if (contentPath.endsWith("/")) { - contentPath = contentPath + language; - } else { - contentPath = contentPath + "/" + language; - } - } - // construct the content article object article = new OfbizRepositoryMappingJackrabbitArticle(contentPath, language, title, content, publicationDate); Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/OfbizRepositoryMappingJackrabbitLocalizedContent.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/OfbizRepositoryMappingJackrabbitLocalizedContent.java?rev=1182348&r1=1182347&r2=1182348&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/OfbizRepositoryMappingJackrabbitLocalizedContent.java (original) +++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/OfbizRepositoryMappingJackrabbitLocalizedContent.java Wed Oct 12 13:06:16 2011 @@ -28,6 +28,7 @@ public abstract class OfbizRepositoryMap super(nodePath); this.language = language; + super.setPath(createLanguagePath(nodePath)); // define this node as a localized node super.setLocalized(true); } @@ -40,4 +41,16 @@ public abstract class OfbizRepositoryMap this.language = language; } + private String createLanguagePath(String contentPath) { + // the content path should contain the language information + // TODO this have to be a little bit more intelligent in the future + if (contentPath.endsWith("/")) { + contentPath = contentPath + language; + } else { + contentPath = contentPath + "/" + language; + } + + return contentPath; + } + } Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JcrTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JcrTests.java?rev=1182348&r1=1182347&r2=1182348&view=diff ============================================================================== --- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JcrTests.java (original) +++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JcrTests.java Wed Oct 12 13:06:16 2011 @@ -22,6 +22,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.GregorianCalendar; +import java.util.Map; + +import javolution.util.FastMap; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; @@ -32,6 +35,7 @@ import org.ofbiz.jcr.orm.jackrabbit.Ofbi import org.ofbiz.jcr.orm.jackrabbit.OfbizRepositoryMappingJackrabbitNews; import org.ofbiz.jcr.orm.jackrabbit.OfbizRepositoryMappingJackrabbitResource; import org.ofbiz.jcr.util.jackrabbit.JcrUtilJackrabbit; +import org.ofbiz.service.ServiceUtil; import org.ofbiz.service.testtools.OFBizTestCase; public class JcrTests extends OFBizTestCase { @@ -68,14 +72,14 @@ public class JcrTests extends OFBizTestC } public void testReadRepositoryNewsNode() throws Exception { - OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today"); + OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today/en"); assertNotNull(orm); assertEquals(orm.getContent(), "Hello World"); } public void testUpdateRepositoryNewsNode() throws Exception { - OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today"); + OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today/en"); assertNotNull(orm); orm.setContent("Hello Visitors"); @@ -83,14 +87,14 @@ public class JcrTests extends OFBizTestC } public void testVersionning() throws Exception { - assertEquals("1.1", repositoryAccess.getBaseVersion("/news/today")); + assertEquals("1.1", repositoryAccess.getBaseVersion("/news/today/en")); - OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today"); + OfbizRepositoryMappingJackrabbitNews orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today/en"); orm.setContent("May the force be with you!"); repositoryAccess.updateContentObject(orm); - orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today"); - assertEquals("1.2", repositoryAccess.getBaseVersion("/news/today")); + orm = (OfbizRepositoryMappingJackrabbitNews) repositoryAccess.getContentObject("/news/today/en"); + assertEquals("1.2", repositoryAccess.getBaseVersion("/news/today/en")); } public void testRemoveRepositoryNewsNode() throws Exception { @@ -125,6 +129,21 @@ public class JcrTests extends OFBizTestC repositoryAccess.removeContentObject("/fileHome"); } + 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"))); + + Map<String, Object> serviceResult = this.dispatcher.runSync("determineJackrabbitRepositorySpeed", context); + + if (ServiceUtil.isError(serviceResult)) { + assertFalse(true); + } else { + assertTrue(true); + } + + } + public void testListRepositoryNodes() throws Exception { assertNotNull(JcrUtilJackrabbit.getRepositoryNodes(userLogin, null)); } |
Free forum by Nabble | Edit this page |