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/20 18:25:03 UTC
svn commit: r379172 - in /lenya/trunk/src:
java/org/apache/lenya/cms/ac/usecases/
modules/jcrsource/config/cocoon-xconf/ resources/test/ targets/
test/org/apache/lenya/ac/file/ test/org/apache/lenya/ac/impl/
test/org/apache/lenya/cms/ test/org/apache/l...
Author: andreas
Date: Mon Feb 20 09:24:59 2006
New Revision: 379172
URL: http://svn.apache.org/viewcvs?rev=379172&view=rev
Log:
Refactored test build system: generate xtest file dynamically, added LoginTest
Added:
lenya/trunk/src/resources/test/roles-template.xml
lenya/trunk/src/resources/test/template-xtest.xml
- copied unchanged from r378556, lenya/trunk/src/resources/test/template.xtest
lenya/trunk/src/resources/test/xconf-template.xml
lenya/trunk/src/test/org/apache/lenya/cms/ac/
lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/
lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/LoginTest.java
lenya/trunk/src/test/org/apache/lenya/cms/usecase/
lenya/trunk/src/test/org/apache/lenya/cms/usecase/UsecaseTestCase.java
Removed:
lenya/trunk/src/resources/test/template.xtest
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/Login.java
lenya/trunk/src/modules/jcrsource/config/cocoon-xconf/repository.xconf
lenya/trunk/src/targets/test-build.xml
lenya/trunk/src/targets/webapp-build.xml
lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java
lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java
lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java
lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java
lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.xtest
lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java
lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/datasources.xconf
lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/scheduler.xconf
Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/Login.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/Login.java?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/Login.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/Login.java Mon Feb 20 09:24:59 2006
@@ -32,6 +32,8 @@
*/
public class Login extends AccessControlUsecase {
+ protected static final String PASSWORD = "password";
+ protected static final String USERNAME = "username";
protected static final String REFERRER_QUERY_STRING = "referrerQueryString";
protected static final String PUBLICATION_ID = "publicationId";
@@ -66,8 +68,8 @@
*/
void validate() throws UsecaseException {
- String userId = getParameterAsString("username");
- String password = getParameterAsString("password");
+ String userId = getParameterAsString(USERNAME);
+ String password = getParameterAsString(PASSWORD);
if (userId.length() == 0) {
addErrorMessage("Please enter a user name.");
Modified: lenya/trunk/src/modules/jcrsource/config/cocoon-xconf/repository.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcrsource/config/cocoon-xconf/repository.xconf?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcrsource/config/cocoon-xconf/repository.xconf (original)
+++ lenya/trunk/src/modules/jcrsource/config/cocoon-xconf/repository.xconf Mon Feb 20 09:24:59 2006
@@ -19,7 +19,8 @@
<xconf xpath="/cocoon"
remove="/cocoon/component[@role = 'javax.jcr.Repository']"
- unless="/cocoon/component[@role = 'javax.jcr.Repository'][@class = 'org.apache.lenya.cms.jcr.LenyaRepository']">
+ unless="/cocoon/component[@role = 'javax.jcr.Repository'][@class = 'org.apache.lenya.cms.jcr.LenyaRepository']"
+ if-prop="patch.webapp">
<component class="org.apache.lenya.cms.jcr.LenyaRepository" logger="jcr" role="javax.jcr.Repository">
<credentials login="anonymous" password=""/>
Added: lenya/trunk/src/resources/test/roles-template.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/resources/test/roles-template.xml?rev=379172&view=auto
==============================================================================
--- lenya/trunk/src/resources/test/roles-template.xml (added)
+++ lenya/trunk/src/resources/test/roles-template.xml Mon Feb 20 09:24:59 2006
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<!--
+ 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.
+-->
+<roles/>
+
\ No newline at end of file
Added: lenya/trunk/src/resources/test/xconf-template.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/resources/test/xconf-template.xml?rev=379172&view=auto
==============================================================================
--- lenya/trunk/src/resources/test/xconf-template.xml (added)
+++ lenya/trunk/src/resources/test/xconf-template.xml Mon Feb 20 09:24:59 2006
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<!--
+ 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.
+-->
+<cocoon>
+
+ <source-factories>
+ <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
+ <component-instance class="org.apache.cocoon.components.source.impl.ContextSourceFactory" name="context"/>
+ <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
+ </source-factories>
+
+ <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
+
+</cocoon>
+
\ No newline at end of file
Modified: lenya/trunk/src/targets/test-build.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/targets/test-build.xml?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/targets/test-build.xml (original)
+++ lenya/trunk/src/targets/test-build.xml Mon Feb 20 09:24:59 2006
@@ -102,17 +102,17 @@
</copy>
<!-- Generate the xtest file -->
- <!--
- This is template code to generate the xtest file automatically.
- It doesn't work yet due to some exceptions during component initialization.
- -->
- <!--
- <xslt in="${cocoon.src.dir}/build/cocoon-2.1.9-dev/classes/org/apache/cocoon/cocoon.roles"
- out="${build.temp}/test/cocoon-roles.xsl"
- style="${src.resource.dir}/test/meta.xsl"
- force="true">
- <param name="element" expression="roles"/>
- </xslt>
+
+ <copy todir="${build.temp}/test" filtering="on" overwrite="true">
+ <fileset dir="${src.resource.dir}/test">
+ <include name="*-template.xml"/>
+ </fileset>
+ </copy>
+
+ <xpatch file="${build.temp}/test/roles-template.xml"
+ srcdir="${build.patch}/lenya-roles"
+ includes="**/*.xroles"
+ addComments="true"/>
<xslt in="${build.webapp}/WEB-INF/classes/org/apache/lenya/lenya.roles"
out="${build.temp}/test/roles.xsl"
@@ -120,13 +120,23 @@
<param name="element" expression="roles"/>
</xslt>
- <xslt in="${build.webapp}/WEB-INF/cocoon.xconf"
+ <xpatch file="${build.temp}/test/xconf-template.xml"
+ srcdir="${build.patch}/cocoon-xconf"
+ includes="prepare/*.xconf"
+ addComments="true"/>
+ <xpatch file="${build.temp}/test/xconf-template.xml"
+ srcdir="${build.patch}/cocoon-xconf"
+ includes="**/*.xconf"
+ excludes="prepare/*.xconf"
+ addComments="true"/>
+
+ <xslt in="${build.temp}/test/xconf-template.xml"
out="${build.temp}/test/components.xsl"
style="${src.resource.dir}/test/meta.xsl">
<param name="element" expression="components"/>
</xslt>
- <xslt in="${src.resource.dir}/test/template.xtest"
+ <xslt in="${src.resource.dir}/test/template-xtest.xml"
out="${build.temp}/test/cocoon-roles.xtest"
style="${build.temp}/test/cocoon-roles.xsl"/>
@@ -137,7 +147,8 @@
<xslt in="${build.temp}/test/roles.xtest"
out="${build.test}/org/apache/lenya/cms/LenyaTestCase.xtest"
style="${build.temp}/test/components.xsl"/>
- -->
+
+ <!-- -->
</target>
@@ -160,7 +171,7 @@
</fileset>
<pathelement path="${src.test.dir}"/>
</classpath>
-
+
<test name="org.apache.lenya.ac.impl.IdentityTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.ac.impl.AccessControllerTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.ac.impl.AccreditableManagerTest" todir="${junit.dir}"/>
@@ -174,15 +185,17 @@
<test name="org.apache.lenya.ac.file.FileGroupTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.ac.file.FileRoleTest" todir="${junit.dir}"/>
+ <test name="org.apache.lenya.cms.ac.usecases.LoginTest" todir="${junit.dir}"/>
+
<test name="org.apache.lenya.cms.publication.DefaultDocumentTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.cms.publication.DefaultDocumentBuilderTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.cms.publication.DublinCoreTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.cms.publication.file.FilePublicationTest" todir="${junit.dir}"/>
<!--
- <test name="org.apache.lenya.ac.ldap.LDAPUserTest" todir="${junit.dir}"/>
- <test name="org.apache.lenya.cms.rc.RCMLTest" todir="${junit.dir}"/>
- <test name="org.apache.lenya.cms.rc.RevisionControllerTest" todir="${junit.dir}"/>
+ <test name="org.apache.lenya.ac.ldap.LDAPUserTest" todir="${junit.dir}"/>
+ <test name="org.apache.lenya.cms.rc.RCMLTest" todir="${junit.dir}"/>
+ <test name="org.apache.lenya.cms.rc.RevisionControllerTest" todir="${junit.dir}"/>
-->
<test name="org.apache.lenya.cms.workflow.WorkflowTest" todir="${junit.dir}"/>
</junit>
Modified: lenya/trunk/src/targets/webapp-build.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/targets/webapp-build.xml?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/targets/webapp-build.xml (original)
+++ lenya/trunk/src/targets/webapp-build.xml Mon Feb 20 09:24:59 2006
@@ -142,6 +142,7 @@
<antcall target="deploy-modules"/>
<!-- Patch cocoon.xconf -->
+ <property name="patch.webapp" value="true"/>
<xpatch file="${build.webapp}/WEB-INF/cocoon.xconf"
srcdir="${build.patch}/cocoon-xconf"
includes="prepare/*.xconf"
Modified: lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java Mon Feb 20 09:24:59 2006
@@ -81,7 +81,7 @@
*/
protected FileGroup getGroup() throws AccessControlException {
File configurationDirectory = getAccreditablesDirectory();
- System.out.println("Configuration directory: " + configurationDirectory);
+ getLogger().info("Configuration directory: " + configurationDirectory);
FileGroup group = new FileGroup(configurationDirectory, GROUP_ID);
return group;
}
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=379172&r1=379171&r2=379172&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 Mon Feb 20 09:24:59 2006
@@ -127,7 +127,7 @@
}
this.accessControllerResolverSelector.release(this.accessControllerResolver);
}
- getManager().release(this.accessControllerResolver);
+ getManager().release(this.accessControllerResolverSelector);
}
super.tearDown();
}
Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java Mon Feb 20 09:24:59 2006
@@ -48,13 +48,11 @@
String url = "/" + pub.getId() + URL;
Policy policy = getPolicy(url);
Role[] roles = policy.getRoles(getIdentity());
- System.out.print("Roles: ");
+ getLogger().info("Roles: ");
for (int i = 0; i < roles.length; i++) {
- System.out.print(roles[i]);
+ getLogger().info(" " + roles[i]);
}
-
- System.out.println();
}
/**
@@ -114,7 +112,7 @@
}
}
- System.out.println("Accreditable: [" + credential.getAccreditable() + "]");
+ getLogger().info("Accreditable: [" + credential.getAccreditable() + "]");
assertNotNull(newCredential);
Set oldRoles = new HashSet(Arrays.asList(credential.getRoles()));
@@ -123,7 +121,7 @@
/*
* for (int j = 0; j < roles.length; j++) { assertEquals(roles[j], newRoles[j]);
- * System.out.println(" Role: [" + roles[j] + "]"); }
+ * getLogger().info(" Role: [" + roles[j] + "]"); }
*/
}
}
Modified: 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=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.java Mon Feb 20 09:24:59 2006
@@ -19,12 +19,16 @@
import java.io.File;
import java.net.URL;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.cocoon.Constants;
+import org.apache.cocoon.components.ContextHelper;
import org.apache.cocoon.core.container.ContainerTestCase;
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;
@@ -39,7 +43,7 @@
public class LenyaTestCase extends ContainerTestCase {
protected DefaultContext context;
-
+
protected void addContext(DefaultContext context) {
super.addContext(context);
@@ -72,9 +76,9 @@
// context.put(Constants.CONTEXT_CONFIG_URL, conf.toURL());
context.put(Constants.CONTEXT_DEFAULT_ENCODING, "ISO-8859-1");
}
-
+
private Request request = null;
-
+
protected Request getRequest() {
return this.request;
}
@@ -95,12 +99,28 @@
String pathInfo = getWebappUrl();
- this.request = new CommandLineRequest(env, "", "", pathInfo);
+ this.request = new CommandLineRequest(env,
+ "",
+ "",
+ pathInfo,
+ new HashMap(),
+ getRequestParameters());
context.put("object-model.request", this.request);
+
+ Map objectModel = new HashMap();
+ objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
+ Context envContext = (Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+ objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, envContext);
+ context.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
+
}
-
+
protected String getWebappUrl() {
- return "";
+ return "/test/authoring/index.html";
+ }
+
+ protected Map getRequestParameters() {
+ return new HashMap();
}
/**
@@ -141,4 +161,5 @@
getLogger().info("Context classpath: " + buildClassPath);
return buildClassPath.toString();
}
+
}
Modified: lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.xtest
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.xtest?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.xtest (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/LenyaTestCase.xtest Mon Feb 20 09:24:59 2006
@@ -104,6 +104,18 @@
shorthand="publication-template-manager"
default-class="org.apache.lenya.cms.publication.templating.PublicationTemplateManagerImpl"/>
+ <role name="org.apache.lenya.cms.usecase.UsecaseInvoker"
+ shorthand="usecase-invoker"
+ default-class="org.apache.lenya.cms.usecase.UsecaseInvokerImpl"/>
+
+ <role name="org.apache.lenya.cms.usecase.UsecaseResolver"
+ shorthand="usecase-resolver"
+ default-class="org.apache.lenya.cms.usecase.UsecaseResolverImpl"/>
+
+ <role name="org.apache.lenya.cms.usecase.UsecaseSelector"
+ shorthand="usecases"
+ default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
+
</roles>
<components>
Added: lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/LoginTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/LoginTest.java?rev=379172&view=auto
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/LoginTest.java (added)
+++ lenya/trunk/src/test/org/apache/lenya/cms/ac/usecases/LoginTest.java Mon Feb 20 09:24:59 2006
@@ -0,0 +1,63 @@
+/*
+ * 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.ac.usecases;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.environment.Session;
+import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.User;
+import org.apache.lenya.cms.usecase.UsecaseTestCase;
+
+/**
+ * Login test.
+ */
+public class LoginTest extends UsecaseTestCase {
+
+ protected static final String USER_ID = "lenya";
+ protected static final String PASSWORD = "levi";
+
+ protected Map getRequestParameters() {
+ return getParameters();
+ }
+
+ protected Map getParameters() {
+ Map params = new HashMap();
+ params.put(Login.USERNAME, USER_ID);
+ params.put(Login.PASSWORD, PASSWORD);
+ return params;
+ }
+
+ protected String getUsecaseName() {
+ return "ac.login";
+ }
+
+ protected void checkPostconditions() {
+ Session session = getRequest().getSession();
+ Identity identity = (Identity) session.getAttribute(Identity.class.getName());
+ User user = identity.getUser();
+ assertNotNull(user);
+ assertEquals(user.getId(), USER_ID);
+ }
+
+ protected void login() throws AccessControlException {
+ getAccessController().setupIdentity(getRequest());
+ }
+
+}
Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java Mon Feb 20 09:24:59 2006
@@ -17,6 +17,8 @@
package org.apache.lenya.cms.publication;
+import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.impl.AccessControlTest;
import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.metadata.dublincore.DublinCore;
import org.apache.lenya.cms.repository.RepositoryException;
@@ -27,7 +29,7 @@
*
* @version $Id$
*/
-public class DublinCoreTest extends RepositoryTestCase {
+public class DublinCoreTest extends AccessControlTest {
private static final String AREA = "authoring";
private static final String DOCUMENT_ID = "/tutorial";
@@ -38,8 +40,13 @@
* Test the fetching, modification and refetching of a dc core object.
* @throws PublicationException
* @throws RepositoryException
+ * @throws AccessControlException
*/
- final public void testModifySaveAndReload() throws PublicationException, RepositoryException {
+ final public void testModifySaveAndReload() throws PublicationException, RepositoryException,
+ AccessControlException {
+
+ login("lenya");
+
Publication publication = PublicationUtil.getPublication(getManager(), "test");
DocumentIdentityMap map = getIdentityMap();
Added: lenya/trunk/src/test/org/apache/lenya/cms/usecase/UsecaseTestCase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/usecase/UsecaseTestCase.java?rev=379172&view=auto
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/usecase/UsecaseTestCase.java (added)
+++ lenya/trunk/src/test/org/apache/lenya/cms/usecase/UsecaseTestCase.java Mon Feb 20 09:24:59 2006
@@ -0,0 +1,90 @@
+/*
+ * 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.usecase;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.impl.AccessControlTest;
+
+/**
+ * Usecase test base class.
+ */
+public abstract class UsecaseTestCase extends AccessControlTest {
+
+ /**
+ * The test.
+ * @throws ServiceException
+ * @throws UsecaseException
+ * @throws AccessControlException
+ */
+ public void testUsecase() throws ServiceException, UsecaseException, AccessControlException {
+
+ login();
+ prepareUsecase();
+
+ UsecaseInvoker invoker = null;
+ try {
+ invoker = (UsecaseInvoker) getManager().lookup(UsecaseInvoker.ROLE);
+ invoker.invoke(getRequest().getPathInfo(), getUsecaseName(), getParameters());
+
+ List errorMessages = invoker.getErrorMessages();
+ for (Iterator i = errorMessages.iterator(); i.hasNext();) {
+ UsecaseMessage message = (UsecaseMessage) i.next();
+ String m = message.getMessage();
+ String[] params = message.getParameters();
+ if (params != null) {
+ for (int j = 0; j < params.length; j++) {
+ m += " [" + params[j] + "]";
+ }
+ }
+ getLogger().error("Usecase error: " + m);
+ }
+
+ assertEquals(invoker.getResult(), UsecaseInvoker.SUCCESS);
+ assertEquals(invoker.getErrorMessages().size(), 0);
+ } finally {
+ if (invoker != null) {
+ getManager().release(invoker);
+ }
+ }
+
+ checkPostconditions();
+
+ }
+
+ protected void login() throws AccessControlException {
+ login("lenya");
+ }
+
+ protected void prepareUsecase() {
+ }
+
+ protected Map getParameters() {
+ return new HashMap();
+ }
+
+ protected abstract String getUsecaseName();
+
+ protected void checkPostconditions() {
+ }
+
+}
Modified: lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/datasources.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/datasources.xconf?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/datasources.xconf (original)
+++ lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/datasources.xconf Mon Feb 20 09:24:59 2006
@@ -20,7 +20,8 @@
<xconf xpath="/cocoon"
unless="/cocoon/datasources/jdbc[@name = 'LenyaScheduler']"
remove="/cocoon/datasources"
- insert-before="/cocoon/hsqldb-server">
+ insert-before="/cocoon/hsqldb-server"
+ if-prop="patch.webapp">
<datasources>
<jdbc logger="core.datasources.lenya.scheduler" name="LenyaScheduler">
Modified: lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/scheduler.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/scheduler.xconf?rev=379172&r1=379171&r2=379172&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/scheduler.xconf (original)
+++ lenya/trunk/src/webapp/lenya/config/cocoon-xconf/scheduler/scheduler.xconf Mon Feb 20 09:24:59 2006
@@ -22,7 +22,8 @@
<xconf xpath="/cocoon"
remove="/cocoon/component[@role = 'org.apache.cocoon.components.cron.JobScheduler']"
insert-after="/cocoon/hsqldb-server"
- unless="/cocoon/component[@role = 'org.apache.cocoon.components.cron.JobScheduler'][store/datasource = 'LenyaScheduler']">
+ unless="/cocoon/component[@role = 'org.apache.cocoon.components.cron.JobScheduler'][store/datasource = 'LenyaScheduler']"
+ if-prop="patch.webapp">
<component class="org.apache.cocoon.components.cron.CocoonQuartzJobScheduler" logger="cron" role="org.apache.cocoon.components.cron.JobScheduler">
<!--+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org