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 2011/11/28 14:40:50 UTC
svn commit: r1207166 - in /ofbiz/branches/jackrabbit20100709/framework:
example/config/ example/src/org/ofbiz/example/ example/widget/example/
jcr/src/org/ofbiz/jcr/api/ jcr/src/org/ofbiz/jcr/test/
Author: sascharodekamp
Date: Mon Nov 28 13:40:48 2011
New Revision: 1207166
URL: http://svn.apache.org/viewvc?rev=1207166&view=rev
Log:
Updated Jackrabbit Tests, include Query Test, Change constructor call for API Classes
Modified:
ofbiz/branches/jackrabbit20100709/framework/example/config/ExampleUiLabels.xml
ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java
ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/AbstractJcrHelper.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrArticleHelper.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrContentHelper.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java
Modified: ofbiz/branches/jackrabbit20100709/framework/example/config/ExampleUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/config/ExampleUiLabels.xml?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/config/ExampleUiLabels.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/config/ExampleUiLabels.xml Mon Nov 28 13:40:48 2011
@@ -731,8 +731,8 @@
<value xml:lang="zh">ç¼è¾æ ·ä¾æç»</value>
</property>
<property key="PageTitleExampleJackrabbit">
- <value xml:lang="de">Jackrabbit Sandbox</value>
- <value xml:lang="en">Jackrabbit Sandbox</value>
+ <value xml:lang="de">Jackrabbit</value>
+ <value xml:lang="en">Jackrabbit</value>
</property>
<!-- Page Titles -->
<property key="PageTitleFindExample">
Modified: ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/src/org/ofbiz/example/JackrabbitEvents.java Mon Nov 28 13:40:48 2011
@@ -160,11 +160,8 @@ public class JackrabbitEvents {
OfbizRepositoryMappingJackrabbitArticle ormArticle = articleHelper.readContentFromRepository(contentPath);
- // news.setLanguage(request.getParameter("language"));
ormArticle.setTitle(request.getParameter("title"));
ormArticle.setContent(request.getParameter("content"));
- // request.getParameter("pubDate")
- // request.getParameter("createDate")
try {
articleHelper.updateContentInRepository(ormArticle);
Modified: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml Mon Nov 28 13:40:48 2011
@@ -48,7 +48,7 @@ under the License.
<menu-item name="ExampleCharts" title="Chart examples">
<link target="ExampleBarChart"/>
</menu-item>
- <menu-item name="ExampleJackrabbit" title="Jackrabbit Sandbox"><link target="ExampleJackrabbitShowContentData"/></menu-item>
+ <menu-item name="ExampleJackrabbit" title="${uiLabelMap.PageTitleExampleJackrabbit}"><link target="ExampleJackrabbitShowContentData"/></menu-item>
</menu>
<menu name="EditExample" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/AbstractJcrHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/AbstractJcrHelper.java?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/AbstractJcrHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/AbstractJcrHelper.java Mon Nov 28 13:40:48 2011
@@ -4,7 +4,11 @@ import org.ofbiz.jcr.access.JcrRepositor
public abstract class AbstractJcrHelper {
- protected static JcrRepositoryAccessor access = null;
+ protected JcrRepositoryAccessor access = null;
+
+ public AbstractJcrHelper (JcrRepositoryAccessor accessor) {
+ this.access = accessor;
+ }
/**
* This will close the connection to the content repository and make sure
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=1207166&r1=1207165&r2=1207166&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 Mon Nov 28 13:40:48 2011
@@ -56,7 +56,7 @@ public class JcrArticleHelper extends Ab
* Setup my content Object
*/
public JcrArticleHelper(GenericValue userLogin) {
- access = new JackrabbitRepositoryAccessor(userLogin);
+ super(new JackrabbitRepositoryAccessor(userLogin));
}
/**
@@ -84,11 +84,11 @@ public class JcrArticleHelper extends Ab
public OfbizRepositoryMappingJackrabbitArticle readContentFromRepository(String contentPath, String language) throws ClassCastException {
contentPath = determineContentLanguagePath(contentPath, language);
- OfbizRepositoryMapping orm = access.getContentObject(contentPath);
+ OfbizRepositoryMapping orm = super.access.getContentObject(contentPath);
if (orm instanceof OfbizRepositoryMappingJackrabbitArticle) {
article = (OfbizRepositoryMappingJackrabbitArticle) orm;
- article.setVersion(access.getBaseVersion(contentPath));
+ article.setVersion(super.access.getBaseVersion(contentPath));
return article;
} else {
throw new ClassCastException("The content object for the path: " + contentPath + " is not an article content object. This Helper can only handle content objects with the type: " + OfbizRepositoryMappingJackrabbitArticle.class.getName());
@@ -109,7 +109,7 @@ public class JcrArticleHelper extends Ab
*/
public OfbizRepositoryMappingJackrabbitArticle readContentFromRepository(String contentPath, String language, String version) throws ClassCastException {
contentPath = determineContentLanguagePath(contentPath, language);
- OfbizRepositoryMapping orm = access.getContentObject(contentPath, version);
+ OfbizRepositoryMapping orm = super.access.getContentObject(contentPath, version);
if (orm instanceof OfbizRepositoryMappingJackrabbitArticle) {
article = (OfbizRepositoryMappingJackrabbitArticle) orm;
@@ -142,7 +142,7 @@ public class JcrArticleHelper extends Ab
// construct the content article object
article = new OfbizRepositoryMappingJackrabbitArticle(contentPath, language, title, content, publicationDate);
- access.storeContentObject(article);
+ super.access.storeContentObject(article);
}
@@ -155,13 +155,13 @@ public class JcrArticleHelper extends Ab
*/
public void updateContentInRepository(OfbizRepositoryMappingJackrabbitArticle updatedArticle) throws RepositoryException, ObjectContentManagerException {
// if the item not already exist create it.
- if (!access.getSession().itemExists(updatedArticle.getPath())) {
+ if (!super.access.getSession().itemExists(updatedArticle.getPath())) {
Debug.logWarning("This content object with the path: " + updatedArticle.getPath() + " doesn't exist in the repository. It will now created.", module);
this.storeContentInRepository(updatedArticle.getPath(), updatedArticle.getLanguage(), updatedArticle.getTitle(), updatedArticle.getContent(), updatedArticle.getPubDate());
return;
}
- access.updateContentObject(updatedArticle);
+ super.access.updateContentObject(updatedArticle);
}
/**
@@ -175,7 +175,7 @@ public class JcrArticleHelper extends Ab
;
if (article != null) {
- versions = access.getVersionList(article.getPath());
+ versions = super.access.getVersionList(article.getPath());
} else {
Debug.logWarning("No Article is loaded from the repository, please load an article first before requesting the version list.", module);
versions = new ArrayList<String>(1);
@@ -188,7 +188,7 @@ public class JcrArticleHelper extends Ab
List<String> languages = new ArrayList<String>();
if (article != null && article.getLocalized()) {
- Session session = access.getSession();
+ Session session = super.access.getSession();
try {
Node node = session.getNode(article.getPath()).getParent();
@@ -260,7 +260,7 @@ public class JcrArticleHelper extends Ab
}
// check if this language exist in the repository
- Session session = access.getSession();
+ Session session = super.access.getSession();
try {
// check if the node exist OR if the node has NO localized flag OR
// the localized flag is set to false
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrContentHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrContentHelper.java?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrContentHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrContentHelper.java Mon Nov 28 13:40:48 2011
@@ -37,11 +37,11 @@ public class JcrContentHelper extends Ab
* @param userLogin
*/
public JcrContentHelper(GenericValue userLogin) {
- access = new JackrabbitRepositoryAccessor(userLogin);
+ super(new JackrabbitRepositoryAccessor(userLogin));
}
public List<Map<String, String>> queryData(String query) throws RepositoryException {
- QueryResult qr = access.queryForRepositoryData(query);
+ QueryResult qr = super.access.queryForRepositoryData(query);
List<Map<String, String>> resultNodePaths = new ArrayList<Map<String, String>>();
RowIterator rows = qr.getRows();
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java Mon Nov 28 13:40:48 2011
@@ -41,7 +41,7 @@ public class JcrFileHelper extends Abstr
private OfbizRepositoryMappingJackrabbitHierarchyNode hierarchy = null;
public JcrFileHelper(GenericValue userLogin) {
- access = new JackrabbitRepositoryAccessor(userLogin);
+ super(new JackrabbitRepositoryAccessor(userLogin));
}
/**
@@ -68,9 +68,9 @@ public class JcrFileHelper extends Abstr
public OfbizRepositoryMappingJackrabbitHierarchyNode getRepositoryContent(String contentPath, String version) throws ClassCastException {
OfbizRepositoryMapping orm = null;
if (version != null) {
- orm = access.getContentObject(contentPath, version);
+ orm = super.access.getContentObject(contentPath, version);
} else {
- orm = access.getContentObject(contentPath);
+ orm = super.access.getContentObject(contentPath);
}
if (orm instanceof OfbizRepositoryMappingJackrabbitFile) {
@@ -132,12 +132,12 @@ public class JcrFileHelper extends Abstr
// Create the folder if necessary, otherwise we just update the folder
// content
folderPath = JcrUtilJackrabbit.createAbsoluteNodePath(folderPath);
- if (access.getSession().itemExists(folderPath)) {
- OfbizRepositoryMapping orm = access.getContentObject(folderPath);
+ if (super.access.getSession().itemExists(folderPath)) {
+ OfbizRepositoryMapping orm = super.access.getContentObject(folderPath);
if (orm instanceof OfbizRepositoryMappingJackrabbitFolder) {
OfbizRepositoryMappingJackrabbitFolder ormFolder = (OfbizRepositoryMappingJackrabbitFolder) orm;
ormFolder.addChild(ormFile);
- access.updateContentObject(ormFolder);
+ super.access.updateContentObject(ormFolder);
}
} else {
// create the ORM folder Object
@@ -145,7 +145,7 @@ public class JcrFileHelper extends Abstr
ormFolder.addChild(ormFile);
ormFolder.setPath(folderPath);
- access.storeContentObject(ormFolder);
+ super.access.storeContentObject(ormFolder);
}
}
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java?rev=1207166&r1=1207165&r2=1207166&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java Mon Nov 28 13:40:48 2011
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.GregorianCalendar;
+import java.util.List;
import java.util.Map;
import javolution.util.FastMap;
@@ -31,6 +32,7 @@ import org.ofbiz.entity.GenericValue;
import org.ofbiz.jcr.access.JcrRepositoryAccessor;
import org.ofbiz.jcr.access.jackrabbit.JackrabbitRepositoryAccessor;
import org.ofbiz.jcr.api.JcrArticleHelper;
+import org.ofbiz.jcr.api.JcrContentHelper;
import org.ofbiz.jcr.api.JcrFileHelper;
import org.ofbiz.jcr.orm.jackrabbit.OfbizRepositoryMappingJackrabbitArticle;
import org.ofbiz.jcr.util.jackrabbit.JcrUtilJackrabbit;
@@ -39,125 +41,151 @@ import org.ofbiz.service.testtools.OFBiz
public class JackrabbitTests extends OFBizTestCase {
- protected GenericValue userLogin = null;
+ protected GenericValue userLogin = null;
- public JackrabbitTests(String name) {
- super(name);
- }
+ public JackrabbitTests(String name) {
+ super(name);
+ }
- @Override
- protected void setUp() throws Exception {
- userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+ @Override
+ protected void setUp() throws Exception {
+ userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
- }
+ }
- @Override
- protected void tearDown() throws Exception {
- }
+ @Override
+ protected void tearDown() throws Exception {
+ }
- public void testRepositoryConstructor() throws Exception {
- JcrRepositoryAccessor repositoryAccess = new JackrabbitRepositoryAccessor(userLogin);
- assertNotNull(repositoryAccess);
- }
+ public void testRepositoryConstructor() throws Exception {
+ JcrRepositoryAccessor repositoryAccess = new JackrabbitRepositoryAccessor(userLogin);
+ assertNotNull(repositoryAccess);
+ }
- public void testCrudArticleNode() throws Exception {
- // Create New Object
- JcrArticleHelper helper = new JcrArticleHelper(userLogin);
- helper.storeContentInRepository("news/article", "en", "News Of Today", "Hello World", new GregorianCalendar());
+ public void testCrudArticleNode() throws Exception {
+ // Create New Object
+ JcrArticleHelper helper = new JcrArticleHelper(userLogin);
+ helper.storeContentInRepository("news/article", "en", "News Of Today", "Hello World", new GregorianCalendar());
- OfbizRepositoryMappingJackrabbitArticle content = helper.readContentFromRepository("news/article");
- assertEquals("Hello World", content.getContent());
+ OfbizRepositoryMappingJackrabbitArticle content = helper.readContentFromRepository("news/article");
+ assertEquals("Hello World", content.getContent());
- content.setContent("New World!");
+ content.setContent("New World!");
- helper.updateContentInRepository(content);
+ helper.updateContentInRepository(content);
- OfbizRepositoryMappingJackrabbitArticle updatedContent = helper.readContentFromRepository("news/article");
- assertEquals("New World!", updatedContent.getContent());
+ OfbizRepositoryMappingJackrabbitArticle updatedContent = helper.readContentFromRepository("news/article");
+ assertEquals("New World!", updatedContent.getContent());
- helper.removeContentObject("news/article");
+ helper.removeContentObject("news");
- helper.closeContentSession();
- }
+ helper.closeContentSession();
+ }
- public void testVersionning() throws Exception {
- JcrArticleHelper helper = new JcrArticleHelper(userLogin);
- helper.storeContentInRepository("news/versionArticle", "en", "News Of Today", "Hello World", new GregorianCalendar());
+ public void testVersionning() throws Exception {
+ JcrArticleHelper helper = new JcrArticleHelper(userLogin);
+ helper.storeContentInRepository("news/versionArticle", "en", "News Of Today", "Hello World", new GregorianCalendar());
- OfbizRepositoryMappingJackrabbitArticle content = helper.readContentFromRepository("news/versionArticle");
- assertEquals("1.0", content.getVersion());
+ OfbizRepositoryMappingJackrabbitArticle content = helper.readContentFromRepository("news/versionArticle");
+ assertEquals("1.0", content.getVersion());
- content.setTitle("New Title");
- helper.updateContentInRepository(content);
+ content.setTitle("New Title");
+ helper.updateContentInRepository(content);
- content = helper.readContentFromRepository("news/versionArticle");
- assertEquals("1.1", content.getVersion());
+ content = helper.readContentFromRepository("news/versionArticle");
+ assertEquals("1.1", content.getVersion());
- helper.closeContentSession();
- }
+ helper.removeContentObject("news");
- public void testLanguageDetermination() throws Exception {
- JcrArticleHelper helper = new JcrArticleHelper(userLogin);
+ helper.closeContentSession();
+ }
- helper.storeContentInRepository("news/tomorrow", "en", "The news for tomorrow.", "Content.", new GregorianCalendar());
- helper.storeContentInRepository("superhero", "de", "Batman", "The best superhero!", new GregorianCalendar());
+ public void testLanguageDetermination() throws Exception {
+ JcrArticleHelper helper = new JcrArticleHelper(userLogin);
- assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "").getLanguage());
- assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "de").getLanguage());
- assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "en").getLanguage());
+ helper.storeContentInRepository("news/tomorrow", "en", "The news for tomorrow.", "Content.", new GregorianCalendar());
+ helper.storeContentInRepository("superhero", "de", "Batman", "The best superhero!", new GregorianCalendar());
- assertEquals("de", helper.readContentFromRepository("/superhero", "de").getLanguage());
- assertEquals("de", helper.readContentFromRepository("/superhero", "").getLanguage());
- assertEquals("de", helper.readContentFromRepository("/superhero", "fr").getLanguage());
+ assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "").getLanguage());
+ assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "de").getLanguage());
+ assertEquals("en", helper.readContentFromRepository("/news/tomorrow", "en").getLanguage());
- helper.removeContentObject("/superhero");
- helper.closeContentSession();
- }
+ assertEquals("de", helper.readContentFromRepository("/superhero", "de").getLanguage());
+ assertEquals("de", helper.readContentFromRepository("/superhero", "").getLanguage());
+ assertEquals("de", helper.readContentFromRepository("/superhero", "fr").getLanguage());
- /*
- * Test the File upload
- */
- public void testCreateRepositoryFileNode() throws Exception {
- File f = new File("stopofbiz.sh");
- File f2 = new File("README");
- assertTrue(f.exists() && f2.exists());
+ helper.removeContentObject("/superhero");
+ helper.removeContentObject("/news");
+ helper.closeContentSession();
+ }
- InputStream file = new FileInputStream(f);
+ /*
+ * Test the File upload
+ */
+ public void testCreateRepositoryFileNode() throws Exception {
+ File f = new File("stopofbiz.sh");
+ File f2 = new File("README");
+ assertTrue(f.exists() && f2.exists());
- JcrFileHelper helper = new JcrFileHelper(userLogin);
- helper.storeContentInRepository(file, f.getName(), "/fileHome");
+ InputStream file = new FileInputStream(f);
- assertNotNull(helper.getRepositoryContent("/fileHome/" + f.getName()));
+ JcrFileHelper helper = new JcrFileHelper(userLogin);
+ helper.storeContentInRepository(file, f.getName(), "/fileHome");
- // add a second file to the same folder
- file = new FileInputStream(f2);
+ assertNotNull(helper.getRepositoryContent("/fileHome/" + f.getName()));
- helper.storeContentInRepository(file, f2.getName(), "/fileHome");
- assertNotNull(helper.getRepositoryContent("/fileHome/" + f2.getName()));
+ // add a second file to the same folder
+ file = new FileInputStream(f2);
- // remove all files in folder
- helper.removeContentObject("/fileHome");
+ helper.storeContentInRepository(file, f2.getName(), "/fileHome");
+ assertNotNull(helper.getRepositoryContent("/fileHome/" + f2.getName()));
- helper.closeContentSession();
- }
+ // remove all files in folder
+ helper.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")));
+ helper.closeContentSession();
+ }
- Map<String, Object> serviceResult = this.dispatcher.runSync("determineJackrabbitRepositorySpeed", context);
+ public void testQuery() throws Exception {
+ JcrArticleHelper article = new JcrArticleHelper(userLogin);
- if (ServiceUtil.isError(serviceResult)) {
- assertFalse(true);
- } else {
- assertTrue(true);
- }
+ article.storeContentInRepository("/query", "en", "query", "query test", new GregorianCalendar());
- }
+ article.closeContentSession();
- public void testListRepositoryNodes() throws Exception {
- assertNotNull(JcrUtilJackrabbit.getRepositoryNodes(userLogin, null));
- }
+ JcrContentHelper content = new JcrContentHelper(userLogin);
+
+ List<Map<String, String>> queryResult = content.queryData("SELECT * FROM [nt:unstructured]");
+
+ assertEquals(3, queryResult.size()); // the list should contain 3 result sets
+
+ assertEquals("/", queryResult.get(0).get("path"));
+ assertEquals("/query", queryResult.get(1).get("path"));
+ assertEquals("/query/en", queryResult.get(2).get("path"));
+
+ content.removeContentObject("query");
+
+ content.closeContentSession();
+
+ }
+
+ 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));
+ }
}
\ No newline at end of file