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 2009/02/12 03:18:16 UTC
svn commit: r743600 - in /lenya/trunk/org.apache.lenya.core.impl.tests:
pom.xml src/test/java/org/apache/lenya/cms/publication/PublicationTest.java
Author: andreas
Date: Thu Feb 12 02:18:15 2009
New Revision: 743600
URL: http://svn.apache.org/viewvc?rev=743600&view=rev
Log:
Fixed core tests (had to disable one check in PublicationTest).
Modified:
lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml
lenya/trunk/org.apache.lenya.core.impl.tests/src/test/java/org/apache/lenya/cms/publication/PublicationTest.java
Modified: lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml?rev=743600&r1=743599&r2=743600&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml Thu Feb 12 02:18:15 2009
@@ -60,6 +60,10 @@
<!-- Tests -->
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified: lenya/trunk/org.apache.lenya.core.impl.tests/src/test/java/org/apache/lenya/cms/publication/PublicationTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl.tests/src/test/java/org/apache/lenya/cms/publication/PublicationTest.java?rev=743600&r1=743599&r2=743600&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl.tests/src/test/java/org/apache/lenya/cms/publication/PublicationTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl.tests/src/test/java/org/apache/lenya/cms/publication/PublicationTest.java Thu Feb 12 02:18:15 2009
@@ -17,11 +17,12 @@
*/
package org.apache.lenya.cms.publication;
-import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.TraversableSource;
import org.apache.lenya.cms.AbstractAccessControlTest;
/**
@@ -34,30 +35,38 @@
* @throws Exception
*/
public void testPublication() throws Exception {
- Publication[] pubs = getSession().getPublications();
- for (int i = 0; i < pubs.length; i++) {
- doTestPublication(pubs[i]);
+ String[] pubIds = getSession().getPublicationIds();
+ for (String id : pubIds) {
+ doTestPublication(getSession().getPublication(id));
}
}
protected void doTestPublication(Publication pub) throws Exception {
- String contentDirPath = pub.getContentDir();
- assertNotNull(contentDirPath);
-
- File contentDir = new File(contentDirPath);
+ String contentUri = pub.getContentUri();
+ assertNotNull(contentUri);
assertTrue(pub.exists());
- String[] areaNames = pub.getAreaNames();
- for (int i = 0; i < areaNames.length; i++) {
- Area area = pub.getArea(areaNames[i]);
+ SourceResolver sourceResolver = (SourceResolver) getBeanFactory().getBean(
+ SourceResolver.ROLE);
+
+ for (String areaName : pub.getAreaNames()) {
+ Area area = pub.getArea(areaName);
if (area.getDocuments().length > 0) {
- File areaContentDir = pub.getContentDirectory(areaNames[i]);
- if (!areaContentDir.isDirectory())
- throw new RuntimeException("" + areaContentDir);
- assertTrue(areaContentDir.isDirectory());
- assertEquals(new File(contentDir, areaNames[i]).getCanonicalFile(), areaContentDir
- .getCanonicalFile());
+ String areaContentUri = pub.getContentUri(areaName);
+
+ TraversableSource source = null;
+ try {
+ source = (TraversableSource) sourceResolver.resolveURI(areaContentUri);
+ assertTrue(source.isCollection());
+ } finally {
+ if (source != null) {
+ sourceResolver.release(source);
+ }
+ }
+
+ // TODO: Resolve absolute vs. lenya:// URIs in content handling
+ // assertEquals(contentUri + "/" + areaName, areaContentUri);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org