You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/27 23:36:04 UTC
svn commit: r426258 - in /lenya/trunk/src/modules/lucene/java/test: ./ org/
org/apache/ org/apache/lenya/ org/apache/lenya/cms/
org/apache/lenya/cms/lucene/
org/apache/lenya/cms/lucene/IndexUpdaterTest.java
Author: andreas
Date: Thu Jul 27 14:36:04 2006
New Revision: 426258
URL: http://svn.apache.org/viewvc?rev=426258&view=rev
Log:
Added index updater test (doesn't yet do anything because of the cocoon:// protocol problem)
Added:
lenya/trunk/src/modules/lucene/java/test/
lenya/trunk/src/modules/lucene/java/test/org/
lenya/trunk/src/modules/lucene/java/test/org/apache/
lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/
lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/
lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/
lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/IndexUpdaterTest.java
Added: lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/IndexUpdaterTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/IndexUpdaterTest.java?rev=426258&view=auto
==============================================================================
--- lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/IndexUpdaterTest.java (added)
+++ lenya/trunk/src/modules/lucene/java/test/org/apache/lenya/cms/lucene/IndexUpdaterTest.java Thu Jul 27 14:36:04 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * 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.
+ *
+ */
+package org.apache.lenya.cms.lucene;
+
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.xml.DocumentHelper;
+
+public class IndexUpdaterTest extends AbstractAccessControlTest {
+
+ public void testIndexUpdater() throws Exception {
+ login("lenya");
+ Session session = RepositoryUtil.getSession(getManager(), getRequest());
+ DocumentFactory factory = DocumentUtil.createDocumentIdentityMap(getManager(), session);
+
+ Publication publication = PublicationUtil.getPublication(getManager(), "test");
+ Document sourceDoc = factory.get(publication, Publication.AUTHORING_AREA, "/tutorial", "en");
+ Document destDoc = factory.get(publication, Publication.AUTHORING_AREA, "/concepts", "en");
+
+ destDoc.getRepositoryNode().lock();
+
+ SourceResolver resolver = null;
+ try {
+ resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
+ SourceUtil.copy(resolver, sourceDoc.getSourceURI(), destDoc.getSourceURI());
+ } finally {
+ if (resolver != null) {
+ getManager().release(resolver);
+ }
+ }
+ checkSearchResults(publication, Publication.AUTHORING_AREA);
+
+ }
+
+ protected void checkSearchResults(Publication pub, String area) throws Exception {
+// String searchUri = "cocoon://modules/lucene/search.xml?queryString=tutorial";
+// String searchUri = "cocoon://modules/lucene/search/" + pub.getId() + "/" + area + ".xml";
+// org.w3c.dom.Document searchResult = SourceUtil.readDOM(searchUri, getManager());
+
+// DocumentHelper.writeDocument(searchResult, System.out);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org