You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ra...@apache.org on 2011/02/20 15:45:40 UTC

svn commit: r1072604 - /lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java

Author: rainer
Date: Sun Feb 20 14:45:39 2011
New Revision: 1072604

URL: http://svn.apache.org/viewvc?rev=1072604&view=rev
Log:
Merged test for bug 50493.

Modified:
    lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java

Modified: lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java?rev=1072604&r1=1072603&r2=1072604&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java (original)
+++ lenya/branches/BRANCH_2_1_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java Sun Feb 20 14:45:39 2011
@@ -18,6 +18,7 @@
 package org.apache.lenya.cms.export;
 
 import java.io.File;
+import java.io.InputStreamReader;
 
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.lenya.ac.impl.AbstractAccessControlTest;
@@ -29,6 +30,8 @@ import org.apache.lenya.cms.publication.
 import org.apache.lenya.cms.publication.PublicationException;
 import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.cms.site.SiteStructure;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.xpath.XPathAPI;
 
 /**
  * Import example content into test publication.
@@ -39,12 +42,12 @@ public class ImportTest extends Abstract
      * @throws Exception if an error occurs.
      */
     public void testImport() throws Exception {
-        
+
         Session session = login("lenya");
-        
+
         Publication pub = getPublication(session, "test");
         Area area = pub.getArea("authoring");
-        
+
         if (area.getDocuments().length == 0) {
             Publication defaultPub = getPublication(session, "default");
             Area defaultArea = defaultPub.getArea("authoring");
@@ -52,17 +55,23 @@ public class ImportTest extends Abstract
             String path = pubPath.replace(File.separatorChar, '/') + "/example-content";
             Importer importer = new Importer(getManager(), getLogger());
             importer.importContent(defaultPub, area, path);
-            
+
             assertTrue(area.getSite().contains("/tutorial"));
-                        
+
             session.commit();
         }
-        
+
         Session aliceSession = login("alice");
         Publication alicePub = getPublication(aliceSession, "test");
-        assertTrue(alicePub.getArea("authoring").getSite().contains("/tutorial"));
-        
+        final SiteStructure authSite = alicePub.getArea("authoring").getSite();
+        assertTrue(authSite.contains("/tutorial"));
+        final Document index = authSite.getNode("/index").getLink("en").getDocument();
+        final org.w3c.dom.Document indexDoc = DocumentHelper.readDocument(index.getRepositoryNode()
+                .getInputStream());
+
+        // https://issues.apache.org/bugzilla/show_bug.cgi?id=50493
+        assertNotNull("No rewritten links found.",
+                XPathAPI.selectSingleNode(indexDoc, "//*[starts-with(@href, 'lenya-document:')]"));
     }
 
-    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org