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/09 14:22:38 UTC
svn commit: r742485 - in /lenya/trunk: org.apache.lenya.core.impl/
org.apache.lenya.core.impl/src/test/
org.apache.lenya.core.impl/src/test/java/
org.apache.lenya.core.impl/src/test/java/org/
org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac...
Author: andreas
Date: Mon Feb 9 13:22:37 2009
New Revision: 742485
URL: http://svn.apache.org/viewvc?rev=742485&view=rev
Log:
Start migration of core tests.
Added:
lenya/trunk/org.apache.lenya.core.impl/src/test/
lenya/trunk/org.apache.lenya.core.impl/src/test/java/
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/
- copied from r742456, lenya/branches/BRANCH_2_0_X/src/impl/test/org/
lenya/trunk/org.apache.lenya.core.usecase/src/test/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/
lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
- copied unchanged from r742480, lenya/branches/BRANCH_2_0_X/src/impl/test/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
lenya/trunk/org.apache.lenya.core.workflow/src/test/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/
lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java
- copied unchanged from r742483, lenya/branches/BRANCH_2_0_X/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java
lenya/trunk/org.apache.lenya.module.simplesite/src/test/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/
lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java
- copied unchanged from r742478, lenya/branches/BRANCH_2_0_X/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java
Removed:
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/AbstractExcaliburTest.java
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/site/
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/usecase/
Modified:
lenya/trunk/org.apache.lenya.core.impl/pom.xml
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/LenyaTestCase.java
lenya/trunk/org.apache.lenya.parent/pom.xml
Modified: lenya/trunk/org.apache.lenya.core.impl/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/pom.xml?rev=742485&r1=742484&r2=742485&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl/pom.xml Mon Feb 9 13:22:37 2009
@@ -27,5 +27,23 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
+ <!-- Tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-sitemap-impl</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac/impl/AbstractAccessControlTest.java?rev=742485&r1=742456&r2=742485&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac/impl/AbstractAccessControlTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/ac/impl/AbstractAccessControlTest.java Mon Feb 9 13:22:37 2009
@@ -20,19 +20,20 @@
package org.apache.lenya.ac.impl;
-import java.io.File;
+import javax.servlet.http.HttpSession;
import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.AccessController;
import org.apache.lenya.ac.AccessControllerResolver;
import org.apache.lenya.ac.Accreditable;
import org.apache.lenya.ac.AccreditableManager;
import org.apache.lenya.ac.Identity;
import org.apache.lenya.ac.PolicyManager;
import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.file.FileAccreditableManager;
import org.apache.lenya.cms.LenyaTestCase;
-import org.apache.lenya.cms.ac.PublicationAccessControllerResolver;
import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentUtil;
import org.apache.lenya.cms.publication.Publication;
@@ -41,17 +42,17 @@
import org.apache.lenya.cms.repository.SessionImpl;
/**
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
*/
public class AbstractAccessControlTest extends LenyaTestCase {
+
+ private static final Log logger = LogFactory.getLog(AbstractAccessControlTest.class);
protected static final String TEST_PUB_ID = "test";
private ServiceSelector accessControllerResolverSelector;
private AccessControllerResolver accessControllerResolver;
- private DefaultAccessController accessController;
-
-
+ private AccessController accessController;
protected org.apache.lenya.cms.repository.Session login(String userId)
throws AccessControlException {
@@ -59,10 +60,10 @@
}
protected Session login(String userId, String pubId) throws AccessControlException {
- Session session = new SessionImpl(null, true, getManager(), getLogger());
+ Session session = new SessionImpl(null, true, logger);
getRequest().setAttribute(Session.class.getName(), session);
-
- DefaultAccessController ac = getAccessController(session, pubId);
+
+ AccessController ac = getAccessController(session, pubId);
AccreditableManager acMgr = ac.getAccreditableManager();
User user = acMgr.getUserManager().getUser(userId);
@@ -72,7 +73,7 @@
ac.setupIdentity(getRequest());
- org.apache.cocoon.environment.Session cocoonSession = getRequest().getSession();
+ HttpSession cocoonSession = getRequest().getSession();
Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());
if (!identity.contains(user)) {
@@ -97,12 +98,12 @@
return session;
}
- protected DefaultAccessController getAccessController() {
+ protected AccessController getAccessController() {
return getAccessController(getSession(), TEST_PUB_ID);
}
- protected DefaultAccessController getAccessController(Session session, String pubId) {
- DefaultAccessController controller;
+ protected AccessController getAccessController(Session session, String pubId) {
+ AccessController controller;
try {
this.accessControllerResolverSelector = (ServiceSelector) getManager().lookup(
AccessControllerResolver.ROLE + "Selector");
@@ -122,8 +123,7 @@
"Publication directory: [" + pub.getDirectory().getAbsolutePath() + "]");
String url = "/" + pubId + "/authoring/index.html";
- controller = (DefaultAccessController) ((PublicationAccessControllerResolver) this.accessControllerResolver)
- .resolveAccessController(url);
+ controller = this.accessControllerResolver.resolveAccessController(url);
assertNotNull(controller);
getLogger().info("Resolved access controller: [" + controller.getClass() + "]");
@@ -169,17 +169,12 @@
return getAccessController().getAccreditableManager();
}
- protected File getAccreditablesDirectory() throws AccessControlException {
- FileAccreditableManager accrMgr = (FileAccreditableManager) getAccreditableManager();
- return accrMgr.getConfigurationDirectory();
- }
-
protected DocumentFactory getFactory() {
- return DocumentUtil.createDocumentFactory(getManager(), getSession());
+ return DocumentUtil.createDocumentFactory(getSession());
}
protected DocumentFactory getFactory(Session session) {
- return DocumentUtil.createDocumentFactory(getManager(), session);
+ return DocumentUtil.createDocumentFactory(session);
}
private Session session;
@@ -206,7 +201,7 @@
protected Publication getPublication(String id) throws PublicationException {
return getFactory().getPublication(id);
}
-
+
protected Identity getIdentity() {
return getSession().getIdentity();
}
Modified: lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/LenyaTestCase.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/LenyaTestCase.java?rev=742485&r1=742456&r2=742485&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/LenyaTestCase.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/test/java/org/apache/lenya/cms/LenyaTestCase.java Mon Feb 9 13:22:37 2009
@@ -31,8 +31,6 @@
import org.apache.cocoon.environment.Context;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.commandline.CommandLineContext;
-import org.apache.cocoon.environment.commandline.CommandLineRequest;
import org.apache.cocoon.environment.mock.MockEnvironment;
import org.apache.cocoon.util.IOUtils;
import org.apache.commons.lang.SystemUtils;
@@ -46,7 +44,7 @@
public class LenyaTestCase extends ContainerTestCase {
protected DefaultContext context;
-
+/*
protected void addContext(DefaultContext context) {
super.addContext(context);
@@ -133,7 +131,7 @@
protected Map getRequestParameters() {
return new HashMap();
}
-
+*/
/**
* This builds the important ClassPath used by this class. It does so in a neutral way. It
* iterates in alphabetical order through every file in the lib directory and adds it to the
Modified: lenya/trunk/org.apache.lenya.parent/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.parent/pom.xml?rev=742485&r1=742484&r2=742485&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.parent/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.parent/pom.xml Mon Feb 9 13:22:37 2009
@@ -389,6 +389,12 @@
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
<!-- Cocoon -->
<dependency>
@@ -398,6 +404,13 @@
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-core</artifactId>
+ <version>${cocoon.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-mail-impl</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
@@ -453,6 +466,13 @@
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-sitemap-impl</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-samples-style-default</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
[…]
> The most serious problems are caused by the URI handling; I have
> temporarily added the test publication as a resource in the core-impl
> module, so that the tests can at least be run. I had to patch the user
> management and the sourcerepository a bit to make them work with
> resource:// URIs. I'll continue to make the tests work later this evening.
Obviously resource:// sources can't be modified, so only the read-only
tests succeed. We should try to come up with a publication persistence
concept (basically, where to store them) asap.
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
[…]
>> I think you moved this to lenya-core-impl-tests
>
> Actually I moved the abstract tests to the core-api module to avoid the
> dependencies from the "peripherical" modules to the core-impl module.
Sorry, that should read "to the core-impl tests". The runtime dependency
to the core-impl module is obviously still necessary because of the core
component implementations.
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Andreas Hartmann <an...@apache.org>.
Hi Felix,
Felix Roethenbacher schrieb:
> Andreas Hartmann wrote:
>> Andreas Hartmann schrieb:
>>
>> […]
>>
>>>> Have you resolved the nested dependencies of the unit tests in the
>>>> various modules yet? Currently most unit test don't compile and
>>>> the ones which do are failing.
>>>
>>> The ones in SVN should compile now, but they are still failing. I'm
>>> resolving exception after exception which occur due to missing bean
>>> wiring, which is to be expected – but I guess this will improve as
>>> soon as the basic components are correctly wired.
>>
>> The tests in SVN are now succeeding for me.
>
> Not for me:
>
> Missing:
> ----------
> 1) org.apache.lenya:lenya-core-impl:test-jar:tests:2.2.0-SNAPSHOT
> [...]
> Path to dependency:
> 1) org.apache.lenya:lenya-core-workflow:jar:2.2.0-SNAPSHOT
> 2) org.apache.lenya:lenya-core-impl:test-jar:tests:2.2.0-SNAPSHOT
sorry, this dependency was obsolete. I forgot to remove it, now it
should work.
> Maybe you have to remove the Lenya artifacts from your local Maven
> repository to see this.
Thanks for the hint – that way I also got the error.
> I think you moved this to lenya-core-impl-tests
Actually I moved the abstract tests to the core-api module to avoid the
dependencies from the "peripherical" modules to the core-impl module.
The core-impl-test module is isolated.
> but if I add
> this dependency I get a cyclic dependencies error. The problem is that
> the unit tests inherit from some abstract test classes which are
> in the core modules, hence the cyclic dependency. Probably we
> should simplify the test classes and get rid of these abstract
> test classes.
I guess it's OK to have the abstract test classes in the core-api
module, since this one is needed by virtually all other modules. WDYT?
But of course I don't mind simplifying the tests; it would be nice if
one doesn't have to extend a proprietary abstract test class.
Thanks for your help!
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Felix Roethenbacher <fr...@apache.org>.
Andreas Hartmann wrote:
> Andreas Hartmann schrieb:
>
> […]
>
>>> Have you resolved the nested dependencies of the unit tests in the
>>> various modules yet? Currently most unit test don't compile and
>>> the ones which do are failing.
>>
>> The ones in SVN should compile now, but they are still failing. I'm
>> resolving exception after exception which occur due to missing bean
>> wiring, which is to be expected – but I guess this will improve as
>> soon as the basic components are correctly wired.
>
> The tests in SVN are now succeeding for me.
Not for me:
Missing:
----------
1) org.apache.lenya:lenya-core-impl:test-jar:tests:2.2.0-SNAPSHOT
[...]
Path to dependency:
1) org.apache.lenya:lenya-core-workflow:jar:2.2.0-SNAPSHOT
2) org.apache.lenya:lenya-core-impl:test-jar:tests:2.2.0-SNAPSHOT
Maybe you have to remove the Lenya artifacts from your local Maven
repository to see this.
I think you moved this to lenya-core-impl-tests but if I add
this dependency I get a cyclic dependencies error. The problem is that
the unit tests inherit from some abstract test classes which are
in the core modules, hence the cyclic dependency. Probably we
should simplify the test classes and get rid of these abstract
test classes.
- Felix
>
> I created a directory $LENYA_HOME/pubs containing the test publication.
> To make the tests run you have to update the paths in
> pubs/test/config/access-control/access-control.xml.
>
> To avoid cyclic dependencies, I created a separate module for the core
> impl tests. This way, the core impl tests can depend on various modules
> which have runtime dependencies to the core impl (that is, to the
> service declarations).
>
> So, the basic read/write operations to the repository are working again.
> From my PoV the next steps would be:
>
> - migrate the remaining tests
> - make the webapp work again, incl. design of the directory structure etc.
>
> Of course any help is greatly appreciated!
>
> -- Andreas
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
[…]
>> Have you resolved the nested dependencies of the unit tests in the
>> various modules yet? Currently most unit test don't compile and
>> the ones which do are failing.
>
> The ones in SVN should compile now, but they are still failing. I'm
> resolving exception after exception which occur due to missing bean
> wiring, which is to be expected – but I guess this will improve as soon
> as the basic components are correctly wired.
The tests in SVN are now succeeding for me.
I created a directory $LENYA_HOME/pubs containing the test publication.
To make the tests run you have to update the paths in
pubs/test/config/access-control/access-control.xml.
To avoid cyclic dependencies, I created a separate module for the core
impl tests. This way, the core impl tests can depend on various modules
which have runtime dependencies to the core impl (that is, to the
service declarations).
So, the basic read/write operations to the repository are working again.
From my PoV the next steps would be:
- migrate the remaining tests
- make the webapp work again, incl. design of the directory structure etc.
Of course any help is greatly appreciated!
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Andreas Hartmann <an...@apache.org>.
Hi Felix,
Felix Roethenbacher schrieb:
> The reason why I deliberately left out the unit tests in
> the beginning was a dependency on a generic abstract test case.
> If migrated to Maven this code would have to be placed in a separate
> module. Dependent modules would have to declare a dependency
> on this module with scope 'test'.
for the moment, I have put the AbstractAccessControlTest and
AbstractLenyaTestCase in the core-api module, which exports them as a
test jar. But if I understand you correctly, this is not a recommended
approach. Should we add a separate module for these classes?
> Have you resolved the nested dependencies of the unit tests in the
> various modules yet? Currently most unit test don't compile and
> the ones which do are failing.
The ones in SVN should compile now, but they are still failing. I'm
resolving exception after exception which occur due to missing bean
wiring, which is to be expected – but I guess this will improve as soon
as the basic components are correctly wired.
The most serious problems are caused by the URI handling; I have
temporarily added the test publication as a resource in the core-impl
module, so that the tests can at least be run. I had to patch the user
management and the sourcerepository a bit to make them work with
resource:// URIs. I'll continue to make the tests work later this evening.
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [2.2] Unit tests (was svn commit: r742485)
Posted by Felix Roethenbacher <fr...@apache.org>.
Hi Andi
The reason why I deliberately left out the unit tests in
the beginning was a dependency on a generic abstract test case.
If migrated to Maven this code would have to be placed in a separate
module. Dependent modules would have to declare a dependency
on this module with scope 'test'.
Have you resolved the nested dependencies of the unit tests in the
various modules yet? Currently most unit test don't compile and
the ones which do are failing.
Cheers, Felix
andreas@apache.org wrote:
> Author: andreas
> Date: Mon Feb 9 13:22:37 2009
> New Revision: 742485
>
> URL: http://svn.apache.org/viewvc?rev=742485&view=rev
> Log:
> Start migration of core tests.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org