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/02/16 16:42:25 UTC
svn commit: r378282 - in /lenya/trunk/src: targets/
test/org/apache/lenya/ac/impl/ test/org/apache/lenya/cms/
test/org/apache/lenya/cms/publication/
test/org/apache/lenya/cms/publication/file/
test/org/apache/lenya/cms/repository/ test/org/apache/lenya...
Author: andreas
Date: Thu Feb 16 07:42:23 2006
New Revision: 378282
URL: http://svn.apache.org/viewcvs?rev=378282&view=rev
Log:
Refactoring of test base classes. Use correct classpath for tests.
Added:
lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java
lenya/trunk/src/test/org/apache/lenya/cms/repository/
lenya/trunk/src/test/org/apache/lenya/cms/repository/RepositoryTestCase.java
Removed:
lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTestCase.java
Modified:
lenya/trunk/src/targets/test-build.xml
lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java
lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
Modified: lenya/trunk/src/targets/test-build.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/targets/test-build.xml?rev=378282&r1=378281&r2=378282&view=diff
==============================================================================
--- lenya/trunk/src/targets/test-build.xml (original)
+++ lenya/trunk/src/targets/test-build.xml Thu Feb 16 07:42:23 2006
@@ -117,7 +117,10 @@
<classpath>
<pathelement location="${build.test}" />
<pathelement path="${build.webapp}/WEB-INF/classes" />
- <pathelement path="${build.webapp}/WEB-INF/lib" />
+ <fileset dir="${build.webapp}/WEB-INF/lib">
+ <include name="*.jar"/>
+ <include name="endorsed/*.jar"/>
+ </fileset>
<pathelement path="${src.test.dir}"/>
</classpath>
<test name="org.apache.lenya.ac.impl.IdentityTest"/>
Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java?rev=378282&r1=378281&r2=378282&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java Thu Feb 16 07:42:23 2006
@@ -33,14 +33,14 @@
import org.apache.lenya.cms.ac.DocumentPolicyManagerWrapper;
import org.apache.lenya.cms.ac.PublicationAccessControllerResolver;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationTestCase;
import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryTestCase;
/**
* To change the template for this generated type comment go to Window>Preferences>Java>Code
* Generation>Code and Comments
*/
-public class AccessControlTest extends PublicationTestCase {
+public class AccessControlTest extends RepositoryTestCase {
private ServiceSelector accessControllerResolverSelector;
private AccessControllerResolver accessControllerResolver;
Added: lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java?rev=378282&view=auto
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java (added)
+++ lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java Thu Feb 16 07:42:23 2006
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import java.io.File;
+
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.cocoon.core.container.ContainerTestCase;
+import org.apache.cocoon.environment.Context;
+import org.apache.cocoon.environment.commandline.CommandLineContext;
+
+/**
+ * Base class for Lenya tests which need the context information.
+ */
+public class LenyaTestCase extends ContainerTestCase {
+
+ protected void addContext(DefaultContext context) {
+ super.addContext(context);
+ String contextRoot = System.getProperty("contextRoot");
+ getLogger().info("Adding context root entry [" + contextRoot + "]");
+ context.put("context-root", new File(contextRoot));
+
+ Context envContext = new CommandLineContext(contextRoot);
+ ContainerUtil.enableLogging(envContext, getLogger());
+ context.put("environment-context", envContext);
+ }
+
+}
Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java?rev=378282&r1=378281&r2=378282&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java Thu Feb 16 07:42:23 2006
@@ -30,8 +30,8 @@
import org.apache.lenya.cms.publication.DocumentIdentityMap;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationTestCase;
import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryTestCase;
import org.apache.lenya.cms.site.Label;
import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.tree.SiteTree;
@@ -42,7 +42,7 @@
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class FilePublicationTest extends PublicationTestCase {
+public class FilePublicationTest extends RepositoryTestCase {
/**
* Constructor.
Added: lenya/trunk/src/test/org/apache/lenya/cms/repository/RepositoryTestCase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/repository/RepositoryTestCase.java?rev=378282&view=auto
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/repository/RepositoryTestCase.java (added)
+++ lenya/trunk/src/test/org/apache/lenya/cms/repository/RepositoryTestCase.java Thu Feb 16 07:42:23 2006
@@ -0,0 +1,40 @@
+/*
+ * 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.repository;
+
+import org.apache.lenya.cms.LenyaTestCase;
+import org.apache.lenya.cms.publication.DocumentIdentityMap;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.IdentityMapImpl;
+
+/**
+ * Base class for tests which operate on the Lenya repository.
+ */
+public class RepositoryTestCase extends LenyaTestCase {
+
+ private DocumentIdentityMap identityMap;
+
+ protected DocumentIdentityMap getIdentityMap() {
+ if (this.identityMap == null) {
+ IdentityMap map = new IdentityMapImpl(getLogger());
+ this.identityMap = new DocumentIdentityMap(map, getManager(), getLogger());
+ }
+ return this.identityMap;
+ }
+
+
+}
Modified: lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java?rev=378282&r1=378281&r2=378282&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java Thu Feb 16 07:42:23 2006
@@ -23,8 +23,8 @@
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationTestCase;
import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryTestCase;
import org.apache.lenya.cms.site.Label;
import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.tree.DefaultSiteTree;
@@ -33,7 +33,7 @@
/**
* Test class for the default site tree
*/
-public class DefaultSiteTreeTest extends PublicationTestCase {
+public class DefaultSiteTreeTest extends RepositoryTestCase {
private DefaultSiteTree siteTree = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org