lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject svn commit: r1052369 - /lenya/branches/BRANCH_2_0_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java
Date Thu, 23 Dec 2010 20:30:56 GMT
Author: andreas
Date: Thu Dec 23 20:30:56 2010
New Revision: 1052369

URL: http://svn.apache.org/viewvc?rev=1052369&view=rev
Log:
Adding test case for bug 50493.

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

Modified: lenya/branches/BRANCH_2_0_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java?rev=1052369&r1=1052368&r2=1052369&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java
(original)
+++ lenya/branches/BRANCH_2_0_X/src/modules/export/java/test/org/apache/lenya/cms/export/ImportTest.java
Thu Dec 23 20:30:56 2010
@@ -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


Mime
View raw message