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/12/06 22:18:12 UTC
svn commit: r483234 - in /lenya/docu/src/documentation/content/xdocs: ./
docs/ docs/1_4/tutorials/ docs/1_4/tutorials/newpublication/
docs/1_4/tutorials/setupide/
Author: andreas
Date: Wed Dec 6 13:18:11 2006
New Revision: 483234
URL: http://svn.apache.org/viewvc?view=rev&rev=483234
Log:
Moved test docs for 1.4, added tutorial to setup Eclipse
Added:
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/index.xml
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/index.xml
lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/tests.xml
Removed:
lenya/docu/src/documentation/content/xdocs/docs/tests.xml
Modified:
lenya/docu/src/documentation/content/xdocs/site.xml
Added: lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/index.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/index.xml?view=auto&rev=483234
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/index.xml (added)
+++ lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/newpublication/index.xml Wed Dec 6 13:18:11 2006
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Id: index.xml 55543 2004-10-26 00:14:59Z gregor $ -->
+
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Apache Lenya 1.4 Documentation</title>
+
+
+
+ </header>
+ <body>
+ <warning>
+ Apache Lenya 1.4 is still under heavy development and should not be used for production yet.
+ </warning>
+ <p>
+ This is the documentation for the 1.4.x releases. The documentation is not as fleshed out as 1.2 yet, so
+ we suggest you also check there for more information while we build up this documentation.
+ </p>
+ <note label="Help wanted!"> Since 1.4 is new and provide many
+ enhancements and new features, please help to document them with us.
+ Send documentation patches and use the wiki. TIA :)</note>
+<p>
+More documentation (work in progress) can be found at the <a href="site:wiki/lenya/">Apache Lenya Wiki</a>.
+</p>
+ </body>
+</document>
Added: lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/index.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/index.xml?view=auto&rev=483234
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/index.xml (added)
+++ lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/setupide/index.xml Wed Dec 6 13:18:11 2006
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!-- $Id: index.xml 55543 2004-10-26 00:14:59Z gregor $ -->
+
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Setting up Your Development Environment</title>
+ </header>
+ <body>
+ <p>
+ To ensure a good productivity when building Lenya applications, it is essential
+ that you have a well-configured development environment.
+ </p>
+ <p>
+ The following steps guide you through the process of setting up the Eclipse IDE for Lenya.
+ The paths apply to a Unix-like operating system, for Windows you have to change
+ the paths accordingly and replace all shell script names with the names of the corresponding
+ batch files.
+ </p>
+ <ul>
+ <li>
+ <p>
+ Check out the Lenya trunk and the Cocoon branch 2.1 from the Subversion
+ repository (see <a href="site:install14">Installation Instructions</a>).
+ I suggest to use the following directory layout:
+ </p>
+<source xml:space="preserve"><![CDATA[src/
+ apache/
+ lenya/
+ trunk/ -> LENYA_HOME
+ cocoon/
+ branches/
+ BRANCH_2_1_X/ -> COCOON_HOME
+]]></source>
+ <p>
+ You don't need to set these environment variables, I only use them in
+ this tutorial.
+ </p>
+ <p>
+ Note that we don't use the Cocoon version which ships with Lenya, but
+ a separate working copy of Cocoon. This is necessary because Eclipse
+ doesn't support nested projects.
+ </p>
+ <p>
+ The <code>apache</code> directory will come in handy when you start serious
+ development, because you're likely to peek into the source code of other
+ ASF projects like Excalibur or Xalan.
+ </p>
+ </li>
+ <li>
+ Edit <code>$LENYA_HOME/local.build.properties</code> and set the property
+ <code>cocoon.src.dir</code> to the path of your <code>$COCOON_HOME</code>
+ directory. When you use the suggested directory structure, this would be
+ <code>../../cocoon/branches/BRANCH_2_1_X</code>.
+ </li>
+ <li>
+ Go to the <code>$COCOON_HOME</code> directory and execute
+ <source>./build.sh eclipse-project</source>
+ This creates the Cocoon project files for Eclipse.
+ </li>
+ <li>
+ Go to the <code>$LENYA_HOME</code> directory and execute
+ <source>./build.sh eclipse-project</source>
+ This creates the Lenya project files for Eclipse.
+ </li>
+ <li>
+ You can now import both projects in Eclipse.
+ </li>
+ <li>
+ If your Lenya project complains that various packages are not
+ found, it is probably necessary to edit the <em>Java Build Path</em> properties
+ of your Cocoon project and select all libraries on the <em>Order and Export</em> tab.
+ </li>
+ <li>
+ In the <em>Preferences</em> pane, you have to configure the Java compiler to
+ use the 1.4 compliance level.
+ </li>
+ <li>
+ A decent XML and XSLT editor is recommended, you can for instance install the
+ web tools platform from the Eclipse project.
+ </li>
+ <li>
+ Have fun!
+ </li>
+ </ul>
+ </body>
+</document>
Added: lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/tests.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/tests.xml?view=auto&rev=483234
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/tests.xml (added)
+++ lenya/docu/src/documentation/content/xdocs/docs/1_4/tutorials/tests.xml Wed Dec 6 13:18:11 2006
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ -->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
+ "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>Writing Tests</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Running Tests</title>
+ <ul>
+ <li><p>To run all tests:</p>
+ <code>./build.sh test</code>
+ <br/><br/>
+ </li>
+ <li><p>To run all module tests:</p>
+ <code>./build.sh modules.test</code>
+ <br/><br/>
+ </li>
+ <li><p>To run the tests of a single module:</p>
+ <code>./build.sh module.test -Dmodule=org.myproject.lenya.modules.MyModule</code>
+ <br/><br/>
+ </li>
+ <li>
+ <p>To run a test in the Eclipse debugger:</p>
+ <ul>
+ <li>You have to run the tests once on the command line to generate the
+ <code>LenyaTestCase.xtest</code> configuration file.</li>
+ <li>To debug a single test, right-click on the test class in the package explorer and select <em>Debug as -> JUnit test</em>.</li>
+ </ul>
+ <note>Make sure you added all classes and libs from the build dir (
+ <code>build/lenya/webapp/WEB-INF/lib/</code>) to the junit classpath in
+ the eclipse debugger, otherwise you propably get a file not found exception.
+ Further if you are looking into a way to debug htmlunit test then see the article on
+ the <a
+ href="http://www.baccoubonneville.com/blogs/index.php/eclipse/2005/12/04/htmlunit-tests-with-eclipse-and-ant">
+ Eclipse Blog - HtmlUnit tests with Eclipse and Ant</a> </note>
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <title>Adding Tests to Modules</title>
+ <p>
+ Adding unit tests to a module is very simple - you just have to put
+ a Java file in the <code>{yourmodule}/java/test</code>. The most
+ convenient way to get started is to extend <code>AbstractAccessControlTest</code>.
+ This class provides the infrastructure to create a session and invoke
+ operations on documents.
+ </p>
+ <p>
+ Here's an example:
+ </p>
+
+ <source xml:space="preserve"><![CDATA[mymodule/java/test/MyModuleTest.java]]></source>
+
+ <p>The source code:</p>
+
+ <source xml:space="preserve"><![CDATA[package org.myproject.lenya;
+
+import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.lenya.cms.repository.Session;
+
+public class MetaDataTest extends AbstractAccessControlTest {
+
+ /**
+ * Tests my module.
+ */
+ public void testMyModule() throws Exception {
+ Session session = RepositoryUtil.getSession(getManager(), getRequest());
+ DocumentFactory factory = DocumentUtil.createDocumentIdentityMap(getManager(), session);
+
+ Publication publication = PublicationUtil.getPublication(getManager(), "test");
+ Document doc = factory.get(publication, Publication.AUTHORING_AREA, "/index", "en");
+
+ assertNotNull(doc);
+ ...
+ }
+}]]></source>
+
+ </section>
+
+ <section>
+ <title>Testing Usecases</title>
+ <p>To implement a unit test for a usecase, you can extend the class
+ <code>AbstractUsecaseTest</code> and override the following methods:
+ </p>
+ <ul>
+ <li><code>String getUsecaseName()</code> - return the name of the usecase to test</li>
+ <li><code>void prepareUsecase()</code> - setup the initial envorionment</li>
+ <li><code>Map getParameters()</code> - return a map containing the usecase parameters</li>
+ <li><code>void checkPostconditions()</code> - check the post conditions after the usecase was executed</li>
+ </ul>
+ <p>
+ Here's an example:
+ </p>
+ <source xml:space="preserve"><![CDATA[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.AbstractUsecaseTest;
+
+/**
+ * Login test.
+ */
+public class LoginTest extends AbstractUsecaseTest {
+
+ 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());
+ }
+
+}]]></source>
+ </section>
+
+ </body>
+</document>
\ No newline at end of file
Modified: lenya/docu/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/lenya/docu/src/documentation/content/xdocs/site.xml?view=diff&rev=483234&r1=483233&r2=483234
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/site.xml (original)
+++ lenya/docu/src/documentation/content/xdocs/site.xml Wed Dec 6 13:18:11 2006
@@ -98,7 +98,6 @@
<docu href="docs/" label="Documentation" tab="docu">
<index href="index.html" label="Index"/>
<coding href="coding-guidelines.html" label="Coding Guidelines"/>
- <tests href="tests.html" label="Writing Tests"/>
<unit-test href="unittests.html" label="Unit Tests"/>
<website-update href="website-update.html" label="Website Update"/>
<rm href="release.html" label="Release Management"/>
@@ -122,8 +121,13 @@
<installation14 href="installation/" label="Installation">
<download14 href="index.html" label="Download"/>
<subversion14 href="subversion.html" label="Subversion Access"/>
- <instal14l href="source_version.html" label="Install Instructions"/>
+ <install14 href="source_version.html" label="Install Instructions"/>
</installation14>
+
+ <tutorials href="tutorials/" label="Tutorials">
+ <setupide href="setupide/index.html" label="Setting up Eclipse"/>
+ <tests href="tests.html" label="Writing Tests"/>
+ </tutorials>
<concepts href="concepts/" label="Concepts">
<publication href="publication.html" label="Publication" />
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org