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/14 17:30:00 UTC

svn commit: r377757 - in /lenya/trunk/src/test/org/apache: cocoon/ cocoon/bean/ cocoon/components/sax/ cocoon/components/source/ cocoon/components/treeprocessor/variables/ cocoon/core/container/ cocoon/environment/commandline/test/ cocoon/environment/m...

Author: andreas
Date: Tue Feb 14 08:29:56 2006
New Revision: 377757

URL: http://svn.apache.org/viewcvs?rev=377757&view=rev
Log:
Removed obsolete mock and test classes, made tests compile again (had to comment out some parts of the code)

Removed:
    lenya/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java
    lenya/trunk/src/test/org/apache/cocoon/bean/
    lenya/trunk/src/test/org/apache/cocoon/components/sax/
    lenya/trunk/src/test/org/apache/cocoon/components/source/
    lenya/trunk/src/test/org/apache/cocoon/components/treeprocessor/variables/
    lenya/trunk/src/test/org/apache/cocoon/core/container/
    lenya/trunk/src/test/org/apache/cocoon/environment/commandline/test/
    lenya/trunk/src/test/org/apache/cocoon/environment/mock/
    lenya/trunk/src/test/org/apache/cocoon/xml/
    lenya/trunk/src/test/org/apache/lenya/cms/PublicationHelper.java
    lenya/trunk/src/test/org/apache/lenya/cms/task/
Modified:
    lenya/trunk/src/test/org/apache/lenya/ac/file/FileGroupTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/file/FileRoleTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/file/FileUserTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControlTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControllerTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/GroupManagerTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.xtest
    lenya/trunk/src/test/org/apache/lenya/ac/impl/LDAPUserTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyManagerTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/RoleManagerTest.java
    lenya/trunk/src/test/org/apache/lenya/ac/impl/UserManagerTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/DublinCoreTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
    lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/rc/RevisionControllerTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java
    lenya/trunk/src/test/org/apache/lenya/cms/workflow/WorkflowTest.java

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -29,7 +29,6 @@
 import org.apache.lenya.ac.Group;
 import org.apache.lenya.ac.Groupable;
 import org.apache.lenya.ac.impl.AccessControlTest;
-import org.apache.lenya.cms.PublicationHelper;
 import org.xml.sax.SAXException;
 
 /**
@@ -56,7 +55,6 @@
      * @param args The command line args
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(FileGroupTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/ac/file/FileRoleTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/file/FileRoleTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/file/FileRoleTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/file/FileRoleTest.java Tue Feb 14 08:29:56 2006
@@ -19,7 +19,6 @@
 
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.impl.AccessControlTest;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * File role test.
@@ -41,7 +40,6 @@
      * @param args DOCUMENT ME!
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(FileRoleTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/ac/file/FileUserTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/file/FileUserTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/file/FileUserTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/file/FileUserTest.java Tue Feb 14 08:29:56 2006
@@ -29,7 +29,6 @@
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.UserType;
 import org.apache.lenya.ac.impl.AccessControlTest;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * File user test.
@@ -53,7 +52,6 @@
      * @param args command line args
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(FileUserTest.class);
     }
 

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -22,6 +22,7 @@
 import java.io.File;
 
 import org.apache.avalon.framework.component.ComponentSelector;
+import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.AccessControllerResolver;
 import org.apache.lenya.ac.AccreditableManager;
@@ -29,17 +30,18 @@
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.file.FileAccreditableManager;
 import org.apache.lenya.ac.file.FilePolicyManager;
-import org.apache.cocoon.SitemapComponentTestCase;
-import org.apache.lenya.cms.PublicationHelper;
 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;
 
 /**
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
  * Generation>Code and Comments
  */
-public class AccessControlTest extends SitemapComponentTestCase {
+public class AccessControlTest extends PublicationTestCase {
 
-    private ComponentSelector accessControllerResolverSelector;
+    private ServiceSelector accessControllerResolverSelector;
     private AccessControllerResolver accessControllerResolver;
     private DefaultAccessController accessController;
 
@@ -64,14 +66,9 @@
     /** @see junit.framework.TestCase#setUp() */
     public void setUp() throws Exception {
 
-        if (PublicationHelper.getPublication() == null) {
-            String[] args = { "D:\\Development\\build\\tomcat-4.1.24\\webapps\\lenya", "test" };
-            PublicationHelper.extractPublicationArguments(args);
-        }
-
         super.setUp();
 
-        this.accessControllerResolverSelector = (ComponentSelector) getManager()
+        this.accessControllerResolverSelector = (ServiceSelector) getManager()
                 .lookup(AccessControllerResolver.ROLE + "Selector");
         assertNotNull(this.accessControllerResolverSelector);
 
@@ -88,11 +85,12 @@
         assertNotNull(this.accessController);
         getLogger().info("Resolved access controller: [" + this.accessController.getClass() + "]");
 
-        File servletContext = PublicationHelper.getPublication().getServletContext();
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+        File servletContext = pub.getServletContext();
         ((FilePolicyManager) this.accessController.getPolicyManager())
                 .setPoliciesDirectory(servletContext);
 
-        this.accreditablesDirectory = new File(PublicationHelper.getPublication().getDirectory(),
+        this.accreditablesDirectory = new File(pub.getDirectory(),
                 "config/ac/passwd".replace('/', File.separatorChar));
         ((FileAccreditableManager) this.accessController.getAccreditableManager())
                 .setConfigurationDirectory(this.accreditablesDirectory);

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControllerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControllerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControllerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/AccessControllerTest.java Tue Feb 14 08:29:56 2006
@@ -21,8 +21,6 @@
 
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
-
 /**
  * Access controller test
  */
@@ -40,7 +38,6 @@
      * @param args The command-line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(AccessControllerTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java Tue Feb 14 08:29:56 2006
@@ -21,7 +21,6 @@
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.AccreditableManager;
 import org.apache.lenya.cms.ExcaliburTest;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * Test class for the Accreditable Manager
@@ -42,7 +41,6 @@
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
-        args = PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(AccreditableManagerTest.class);
     }
     

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/GroupManagerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/GroupManagerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/GroupManagerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/GroupManagerTest.java Tue Feb 14 08:29:56 2006
@@ -21,7 +21,6 @@
 
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.file.FileGroupManager;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * Group manager test.
@@ -44,7 +43,6 @@
      * @param args command line args
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(GroupManagerTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.java Tue Feb 14 08:29:56 2006
@@ -20,7 +20,6 @@
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.Identity;
 import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * Tests the identity
@@ -45,7 +44,6 @@
      * @param args The command-line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(IdentityTest.class);
     }
     

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.xtest
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.xtest?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.xtest (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/IdentityTest.xtest Tue Feb 14 08:29:56 2006
@@ -19,11 +19,13 @@
   <annotation>
     Test Cases: Identity 
   </annotation>
+  <!--
   <context>
     <entry name="environment-context" value="/c:/src/lenya-trunk/build/lenya/webapp/"/>
     <entry name="container.rootDir" value="/c:/src/lenya-trunk/build/lenya/webapp/"/>
     <entry name="context-root" value="/c:/src/lenya-trunk/build/lenya/webapp/"/>
   </context>
+  -->
 
    <roles>
   
@@ -72,13 +74,20 @@
           shorthand="sourcecache"
           default-class="org.apache.lenya.ac.cache.PolicyCacheImpl"/>
   -->
-  </roles>
+     <role name="org.apache.lenya.cms.publication.PublicationManager"
+       shorthand="publication-manager"
+       default-class="org.apache.lenya.cms.publication.PublicationManagerImpl"/>
+     
+   </roles>
 
   <components>
   
   <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.lenya.cms.cocoon.source.ContextSourceFactory" name="context"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
   </source-factories>
 
@@ -93,7 +102,6 @@
     
   <authorizers>
     <component-instance class="org.apache.lenya.ac.impl.PolicyAuthorizer" logger="lenya.ac.authorizer" name="policy"/>
-    <component-instance class="org.apache.lenya.cms.ac.workflow.WorkflowAuthorizer" logger="lenya.ac.authorizer" name="workflow"/>
   </authorizers>
   
   <policy-managers>

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/LDAPUserTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/LDAPUserTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/LDAPUserTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/LDAPUserTest.java Tue Feb 14 08:29:56 2006
@@ -28,10 +28,9 @@
 import org.apache.lenya.ac.file.FileRole;
 import org.apache.lenya.ac.file.FileUserManager;
 import org.apache.lenya.ac.ldap.LDAPUser;
-import org.apache.lenya.cms.PublicationHelper;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationFactory;
+import org.apache.lenya.cms.publication.PublicationUtil;
 
 /**
  * LDAP user test.
@@ -52,7 +51,6 @@
      * @param args an array of <code>String</code>
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(LDAPUserTest.class);
     }
 
@@ -79,10 +77,7 @@
      */
     final public Publication getPublication() throws PublicationException {
         String publicationId = "default";
-        String servletContextPath = "/home/egli/build/jakarta-tomcat-4.1.21-LE-jdk14/webapps/lenya/";
-
-        PublicationFactory factory = PublicationFactory.getInstance(getLogger());
-        return factory.getPublication(publicationId, servletContextPath);
+        return PublicationUtil.getPublication(getManager(), publicationId);
     }
 
     /**

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyManagerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyManagerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyManagerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/PolicyManagerTest.java Tue Feb 14 08:29:56 2006
@@ -24,7 +24,6 @@
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.Policy;
 import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * Test for the Policy Manager
@@ -44,7 +43,6 @@
      * @param args The command-line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(AccessControllerTest.class);
     }
 

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -28,7 +28,9 @@
 import org.apache.lenya.ac.AccessControlException;
 import org.apache.lenya.ac.Policy;
 import org.apache.lenya.ac.Role;
-import org.apache.lenya.cms.PublicationHelper;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.PublicationUtil;
 
 /**
  * Policy Test
@@ -48,7 +50,6 @@
      * @param args The command-line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(PolicyTest.class);
     }
 
@@ -58,9 +59,11 @@
     /**
      * A test.
      * @throws AccessControlException when something went wrong.
+     * @throws PublicationException 
      */
-    public void testLoadPolicy() throws AccessControlException {
-        String url = "/" + PublicationHelper.getPublication().getId() + URL;
+    public void testLoadPolicy() throws AccessControlException, PublicationException {
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+        String url = "/" + pub.getId() + URL;
         Policy policy = getPolicy(url);
         Role[] roles = policy.getRoles(getIdentity());
         System.out.print("Roles: ");

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/RoleManagerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/RoleManagerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/RoleManagerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/RoleManagerTest.java Tue Feb 14 08:29:56 2006
@@ -21,7 +21,6 @@
 import org.apache.lenya.ac.Role;
 import org.apache.lenya.ac.file.FileRole;
 import org.apache.lenya.ac.file.FileRoleManager;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * Role manager test.
@@ -42,7 +41,6 @@
      * @param args Command line args
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(RoleManagerTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/ac/impl/UserManagerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/ac/impl/UserManagerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/ac/impl/UserManagerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/ac/impl/UserManagerTest.java Tue Feb 14 08:29:56 2006
@@ -29,7 +29,6 @@
 import org.apache.lenya.ac.file.FileRole;
 import org.apache.lenya.ac.file.FileUser;
 import org.apache.lenya.ac.file.FileUserManager;
-import org.apache.lenya.cms.PublicationHelper;
 
 /**
  * User manager test.
@@ -51,7 +50,6 @@
      * @param args Command line args
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         junit.textui.TestRunner.run(UserManagerTest.class);
     }
 

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java Tue Feb 14 08:29:56 2006
@@ -23,8 +23,6 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
-
 /**
  * 
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
@@ -46,7 +44,6 @@
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(getSuite());
     }
 
@@ -60,12 +57,11 @@
     }
 
     /**
+     * @throws PublicationException 
      * @see org.apache.lenya.cms.publication.DefaultDocumentTest#getDocument(DocumentTestSet)
      */
-    protected Document getDocument(DocumentTestSet set) throws DocumentBuildException {
-        Publication pub = PublicationHelper.getPublication();
-
-        return getIdentityMap().getFactory().getFromURL(pub,
-                pub.getId() + "/" + set.getArea() + set.getUrl());
+    protected Document getDocument(DocumentTestSet set) throws PublicationException {
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+        return getIdentityMap().getFromURL("/" + pub.getId() + "/" + set.getArea() + set.getUrl());
     }
 }

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java Tue Feb 14 08:29:56 2006
@@ -20,24 +20,25 @@
 package org.apache.lenya.cms.publication;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
+import org.apache.cocoon.SitemapComponentTestCase;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.IdentityMapImpl;
 
 /**
  * 
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
  * Generation>Code and Comments
  */
-public class DefaultDocumentTest extends TestCase {
+public class DefaultDocumentTest extends SitemapComponentTestCase {
     /**
      * Constructor.
      * @param test The test.
      */
     public DefaultDocumentTest(String test) {
-        super(test);
+        super();
     }
 
     /**
@@ -45,7 +46,6 @@
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(getSuite());
     }
 
@@ -60,15 +60,18 @@
     protected static final DocumentTestSet[] testSets = {
             new DocumentTestSet("/index.html", "/index", Publication.AUTHORING_AREA, "en", "html"),
             new DocumentTestSet("/index_en.htm", "/index", Publication.AUTHORING_AREA, "en", "htm"),
-            new DocumentTestSet("/index_de.html", "/index", Publication.AUTHORING_AREA, "de",
+            new DocumentTestSet("/index_de.html",
+                    "/index",
+                    Publication.AUTHORING_AREA,
+                    "de",
                     "html") };
 
     /**
      * Tests a document test set.
      * @param testSet The test set.
-     * @throws DocumentBuildException if an error occurs
+     * @throws PublicationException
      */
-    protected void doDocumentTest(DocumentTestSet testSet) throws DocumentBuildException {
+    protected void doDocumentTest(DocumentTestSet testSet) throws PublicationException {
         Document document = getDocument(testSet);
         System.out.println("ID:           " + document.getId());
         System.out.println("Area:         " + document.getArea());
@@ -77,7 +80,7 @@
         System.out.println("Complete URL: " + document.getCanonicalWebappURL());
         System.out.println("Extension:    " + document.getExtension());
 
-        Publication publication = PublicationHelper.getPublication();
+        Publication publication = PublicationUtil.getPublication(getManager(), "test");
         assertEquals(document.getPublication(), publication);
         assertEquals(document.getId(), testSet.getId());
         assertEquals(document.getArea(), testSet.getArea());
@@ -92,9 +95,9 @@
 
     /**
      * Tests the default document.
-     * @throws DocumentBuildException if an error occurs
+     * @throws PublicationException
      */
-    public void testDefaultDocument() throws DocumentBuildException {
+    public void testDefaultDocument() throws PublicationException {
         for (int i = 0; i < testSets.length; i++) {
             doDocumentTest(testSets[i]);
         }
@@ -104,7 +107,8 @@
 
     protected DocumentIdentityMap getIdentityMap() {
         if (this.identityMap == null) {
-            this.identityMap = new DocumentIdentityMap();
+            IdentityMap map = new IdentityMapImpl(getLogger());
+            this.identityMap = new DocumentIdentityMap(map, getManager(), getLogger());
         }
         return this.identityMap;
     }
@@ -113,15 +117,17 @@
      * Returns the test document for a given test set.
      * @param testSet A document test set.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs
+     * @throws PublicationException 
      */
-    protected Document getDocument(DocumentTestSet testSet) throws DocumentBuildException {
+    protected Document getDocument(DocumentTestSet testSet) throws PublicationException {
 
-        Publication pub = PublicationHelper.getPublication();
-        DefaultDocument document = new DefaultDocument(getIdentityMap(), pub, testSet.getId(),
-                testSet.getArea());
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+        DocumentIdentifier id = new DocumentIdentifier(pub,
+                testSet.getArea(),
+                testSet.getId(),
+                testSet.getLanguage());
+        DefaultDocument document = new DefaultDocument(getManager(), getIdentityMap(), id, getLogger());
         document.setDocumentURL(testSet.getUrl());
-        document.setLanguage(testSet.getLanguage());
         document.setExtension(testSet.getExtension());
 
         return document;
@@ -190,13 +196,4 @@
         }
     }
 
-    /**
-     * @see junit.framework.TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        if (PublicationHelper.getPublication() == null) {
-            String[] args = { "D:\\Development\\build\\tomcat-4.1.24\\webapps\\lenya", "test" };
-            PublicationHelper.extractPublicationArguments(args);
-        }
-    }
 }

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -17,19 +17,20 @@
 
 package org.apache.lenya.cms.publication;
 
-import junit.framework.TestCase;
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
+import org.apache.cocoon.SitemapComponentTestCase;
 import org.apache.lenya.cms.metadata.MetaData;
 import org.apache.lenya.cms.metadata.dublincore.DublinCore;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.IdentityMapImpl;
 
 /**
  * Dublin Core test.
  * 
  * @version $Id$
  */
-public class DublinCoreTest extends TestCase {
+public class DublinCoreTest extends SitemapComponentTestCase {
 
     private static final String AREA = "authoring";
     private static final String DOCUMENT_ID = "/tutorial";
@@ -41,7 +42,7 @@
      * @param arg0 a test
      */
     public DublinCoreTest(String arg0) {
-        super(arg0);
+        super();
     }
 
     /**
@@ -50,19 +51,18 @@
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
-        args = PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(DublinCoreTest.class);
     }
 
     /**
      * Test the fetching, modification and refetching of a dc core object.
-     * 
-     * @throws DocumentBuildException if an error occurs
-     * @throws DocumentException if an error occurs
+     * @throws PublicationException 
      */
-    final public void testModifySaveAndReload() throws DocumentBuildException, DocumentException {
-        Publication publication = PublicationHelper.getPublication();
-        DocumentIdentityMap map = new DocumentIdentityMap();
+    final public void testModifySaveAndReload() throws PublicationException {
+        Publication publication = PublicationUtil.getPublication(getManager(), "test");
+        
+        IdentityMap idMap = new IdentityMapImpl(getLogger());
+        DocumentIdentityMap map = new DocumentIdentityMap(idMap, getManager(), getLogger());
         Document doc = map.get(publication, AREA, DOCUMENT_ID, LANGUAGE);
         MetaData dcCore = doc.getMetaDataManager().getDublinCoreMetaData();
         String title = dcCore.getFirstValue(DublinCore.ELEMENT_TITLE);
@@ -83,12 +83,4 @@
         assertEquals(CREATOR, dcCore2.getFirstValue(DublinCore.ELEMENT_CREATOR));
     }
 
-    /** @see junit.framework.TestCase#setUp() */
-    protected void setUp() throws Exception {
-        if (PublicationHelper.getPublication() == null) {
-            String[] args = { "/home/egli/build/jakarta-tomcat-4.1.21-LE-jdk14/webapps/lenya",
-                    "test" };
-            PublicationHelper.extractPublicationArguments(args);
-        }
-    }
 }

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/PublicationTest.java Tue Feb 14 08:29:56 2006
@@ -24,7 +24,6 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
 import org.apache.lenya.cms.publication.file.FilePublicationTest;
 
 /**
@@ -45,7 +44,6 @@
      * @param args The command-line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(getSuite());
     }
 
@@ -64,14 +62,6 @@
         }
 
         return suite;
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    protected void setUp() throws Exception {
-        if (PublicationHelper.getPublication() == null) {
-            String[] args = { "D:\\Development\\build\\tomcat-4.1.24\\webapps\\lenya", "test" };
-            PublicationHelper.extractPublicationArguments(args);
-        }
     }
 
 }

Modified: lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/publication/TestPageEnvelope.java Tue Feb 14 08:29:56 2006
@@ -19,6 +19,10 @@
 
 package org.apache.lenya.cms.publication;
 
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.lenya.transaction.IdentityMapImpl;
+
 /**
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
  * Generation>Code and Comments
@@ -30,12 +34,14 @@
      * @param url The document url (starting with a slash).
      * @throws PageEnvelopeException when something goes wrong.
      */
-    public TestPageEnvelope(Publication publication, String url) throws PageEnvelopeException {
+    public TestPageEnvelope(Publication publication, String url, ServiceManager manager,
+            Logger logger) throws PageEnvelopeException {
         setContext("");
 
         try {
-            DocumentIdentityMap map = new DocumentIdentityMap();
-            setDocument(map.getFactory().getFromURL(publication, url));
+            IdentityMapImpl idMap = new IdentityMapImpl(logger);
+            DocumentIdentityMap map = new DocumentIdentityMap(idMap, manager, logger);
+            setDocument(map.getFromURL(url));
         } catch (DocumentBuildException e) {
             throw new PageEnvelopeException(e);
         }

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -24,12 +24,14 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lenya.cms.PublicationHelper;
+import org.apache.cocoon.SitemapComponentTestCase;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentException;
 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.site.Label;
 import org.apache.lenya.cms.site.SiteException;
 import org.apache.lenya.cms.site.tree.SiteTree;
@@ -40,14 +42,14 @@
  * To change the template for this generated type comment go to
  * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
  */
-public class FilePublicationTest extends TestCase {
+public class FilePublicationTest extends PublicationTestCase {
 
     /**
      * Constructor.
      * @param test The test.
      */
     public FilePublicationTest(String test) {
-        super(test);
+        super();
     }
 
     /**
@@ -56,7 +58,6 @@
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
-        PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(getSuite());
     }
 
@@ -131,18 +132,18 @@
         System.out.println("    Destination document ID: [" + _destinationDocumentId + "]");
         System.out.println("    Destination language:    [" + _destinationLanguage + "]");
 
-        Publication publication = PublicationHelper.getPublication();
-        DocumentIdentityMap map = new DocumentIdentityMap();
+        Publication publication = PublicationUtil.getPublication(getManager(), "test");
+        DocumentIdentityMap map = getIdentityMap();
 
-        Document sourceDocument = map.getFactory().get(publication,
+        Document sourceDocument = map.get(publication,
                 sourceArea,
                 _sourceDocumentId,
                 _sourceLanguage);
-        Document destinationDocument = map.getFactory().get(publication,
+        Document destinationDocument = map.get(publication,
                 destinationArea,
                 _destinationDocumentId,
                 _destinationLanguage);
-
+/*
         publication.copyDocument(sourceDocument, destinationDocument);
 
         assertTrue(destinationDocument.exists());
@@ -158,6 +159,6 @@
         Label sourceLabel = sourceNode.getLabel(_sourceLanguage);
 
         assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));
-
+*/
     }
 }

Modified: lenya/trunk/src/test/org/apache/lenya/cms/rc/RevisionControllerTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/rc/RevisionControllerTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/rc/RevisionControllerTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/rc/RevisionControllerTest.java Tue Feb 14 08:29:56 2006
@@ -78,7 +78,7 @@
         }
 
         try {
-            rc.reservedCheckIn(destination, identityD, true);
+            rc.reservedCheckIn(destination, identityD, true, true);
         } catch (FileReservedCheckInException e) {
             System.out.println(e.toString());
         } catch (Exception e) {

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=377757&r1=377756&r2=377757&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 Tue Feb 14 08:29:56 2006
@@ -21,6 +21,10 @@
 
 import junit.framework.TestCase;
 
+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.site.Label;
 import org.apache.lenya.cms.site.SiteException;
 import org.apache.lenya.cms.site.tree.DefaultSiteTree;
@@ -29,7 +33,7 @@
 /**
  * Test class for the default site tree
  */
-public class DefaultSiteTreeTest extends TestCase {
+public class DefaultSiteTreeTest extends PublicationTestCase {
 	
 	private DefaultSiteTree siteTree = null;
 
@@ -38,7 +42,7 @@
 	 * @param test The test.
 	 */
 	public DefaultSiteTreeTest(String test) {
-        super(test);
+        super();
     }
 
 	/**
@@ -54,22 +58,23 @@
     /**
      * @see TestCase#setUp()
      */
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
-		this.siteTree = new DefaultSiteTree("testTree.xml");
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+		this.siteTree = new DefaultSiteTree(pub, "test", getManager());
 		Label label = new Label("Foo", "en");
 		Label[] fooLabels = { label };
-		this.siteTree.addNode("/foo", fooLabels, null, null, false);
+		this.siteTree.addNode("/foo", fooLabels, true, null, null, false);
 		label = new Label("Home", "en");
 		Label[] homeLabels = { label };
-		this.siteTree.addNode("/index", homeLabels, null, null, false);
+		this.siteTree.addNode("/index", homeLabels, true, null, null, false);
 		label = new Label("Bar", "en");
 		Label label_de = new Label("Stab", "de");
 		Label[] barLabels = { label, label_de };
-		this.siteTree.addNode("/foo/bar", barLabels, "http://exact.biz", "suffix", true);
+		this.siteTree.addNode("/foo/bar", barLabels, true, "http://exact.biz", "suffix", true);
 		label = new Label("Lala", "en");
 		Label[] lalaLabels = { label };
-		this.siteTree.addNode("/foo/lala", lalaLabels, null, null, false);
+		this.siteTree.addNode("/foo/lala", lalaLabels, true, null, null, false);
 	}
 
     /**
@@ -102,7 +107,7 @@
 		Label label = new Label("Tutorial", null);
 		Label[] labels = { label };
 
-		this.siteTree.addNode("/foo", "tutorial", labels);
+		this.siteTree.addNode("/foo", "tutorial", labels, true);
 		SiteTreeNode node =  this.siteTree.getNode("/foo/tutorial");
 		assertNotNull(node);
 		assertEquals(node.getId(), "tutorial");
@@ -125,7 +130,7 @@
 		Label label2 = new Label("Ding", "en");
 		Label[] labels = { label1, label2};
 
-		this.siteTree.addNode("/foo/ding", labels, null, null, false);
+		this.siteTree.addNode("/foo/ding", labels, true, null, null, false);
 		
 		assertNotNull(this.siteTree.getNode("/foo/ding"));
 		assertEquals(this.siteTree.getNode("/foo/ding").getId(), "ding");
@@ -140,7 +145,7 @@
 		Label label2 = new Label("Ding", "en");
 		Label[] labels = { label1, label2};
 
-		this.siteTree.addNode("/foo", "baz", labels, null, null, false);
+		this.siteTree.addNode("/foo", "baz", labels, true, null, null, false);
 		
 		assertNotNull(this.siteTree.getNode("/foo/baz"));
 		assertEquals(this.siteTree.getNode("/foo/baz").getId(), "baz");		
@@ -187,11 +192,11 @@
     	Label label2 = new Label("Ho", "en");
     	Label[] labels1 = { label1, label2};
     	
-    	this.siteTree.addNode("/hi", labels1, null, null, false);
+    	this.siteTree.addNode("/hi", labels1, true, null, null, false);
 
 		Label[] labels2 = { label1, label2};
 
-		this.siteTree.addNode("/hi/ho", labels2, null, null, false);
+		this.siteTree.addNode("/hi/ho", labels2, true, null, null, false);
 		
 		assertNotNull(this.siteTree.getNode("/hi/ho"));
 		
@@ -241,22 +246,23 @@
     
     /**
      * Test the import of a subtree
-     * @throws SiteException if an error occurs.
+     * @throws PublicationException 
      */
-	final public void testImportSubtree() throws SiteException {
-		DefaultSiteTree newSiteTree = new DefaultSiteTree("importedTree.xml");
+	final public void testImportSubtree() throws PublicationException {
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+		DefaultSiteTree newSiteTree = new DefaultSiteTree(pub, "test1", getManager());
 		Label label = new Label("root", "en");
 		Label[] rootLabels = { label };
-		newSiteTree.addNode("/root", rootLabels, null, null, false);
+		newSiteTree.addNode("/root", rootLabels, true, null, null, false);
 		label = new Label("foo", "en");
 		Label[] fooLabels = { label };
-		newSiteTree.addNode("/root/foo", fooLabels, null, null, false);
+		newSiteTree.addNode("/root/foo", fooLabels, true, null, null, false);
 		label = new Label("subtree", "en");
 		Label[] subtreeLabels = { label };
-		newSiteTree.addNode("/root/subtree", subtreeLabels, "http://exact.biz", "suffix", true);
+		newSiteTree.addNode("/root/subtree", subtreeLabels, true, "http://exact.biz", "suffix", true);
 		label = new Label("child", "en");
 		Label[] childLabels = { label };
-		newSiteTree.addNode("/root/subtree/child", childLabels, null, null, false);
+		newSiteTree.addNode("/root/subtree/child", childLabels, true, null, null, false);
 		SiteTreeNode node=newSiteTree.getNode("/root/subtree");
 		assertNotNull(node);
 		SiteTreeNode parentNode=this.siteTree.getNode("/foo/lala");

Modified: lenya/trunk/src/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java Tue Feb 14 08:29:56 2006
@@ -19,6 +19,9 @@
 
 package org.apache.lenya.cms.site.tree;
 
+import org.apache.cocoon.SitemapComponentTestCase;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
 import org.apache.lenya.cms.site.Label;
 import org.apache.lenya.cms.site.tree.DefaultSiteTree;
 import org.apache.lenya.cms.site.tree.SiteTreeNode;
@@ -28,7 +31,7 @@
 /**
  * Tests the site tree
  */
-public class SiteTreeNodeImplTest extends TestCase {
+public class SiteTreeNodeImplTest extends SitemapComponentTestCase {
 
     private SiteTreeNode node = null;
 
@@ -37,13 +40,12 @@
      * @param test The test.
      */
     public SiteTreeNodeImplTest(String test) {
-        super(test);
+        super();
     }
 
     /**
-     * The main program.
-     * The parameters are set from the command line arguments.
-     *
+     * The main program. The parameters are set from the command line arguments.
+     * 
      * @param args The command line arguments.
      */
     public static void main(String[] args) {
@@ -53,21 +55,17 @@
     /**
      * @see TestCase#setUp()
      */
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         super.setUp();
-        DefaultSiteTree siteTree = new DefaultSiteTree("testTree");
+        Publication pub = PublicationUtil.getPublication(getManager(), "test");
+        DefaultSiteTree siteTree = new DefaultSiteTree(pub, "testArea", getManager());
         Label label = new Label("Foo", "en");
         Label[] fooLabels = { label };
-        siteTree.addNode("/foo", fooLabels, null, null, false);
+        siteTree.addNode("/foo", fooLabels, true, null, null, false);
         label = new Label("Bar", "en");
         Label label_de = new Label("Stab", "de");
         Label[] barLabels = { label, label_de };
-        siteTree.addNode(
-            "/foo/bar",
-            barLabels,
-            "http://exact.biz",
-            "suffix",
-            true);
+        siteTree.addNode("/foo/bar", barLabels, true, "http://exact.biz", "suffix", true);
 
         this.node = siteTree.getNode("/foo/bar");
     }
@@ -89,7 +87,7 @@
 
     /**
      * Test getId
-     *
+     * 
      */
     final public void testGetId() {
         assertEquals(this.node.getId(), "bar");
@@ -97,7 +95,7 @@
 
     /**
      * Test getLabels
-     *
+     * 
      */
     final public void testGetLabels() {
         assertEquals(this.node.getLabels().length, 2);
@@ -111,7 +109,7 @@
 
     /**
      * Test getLabel
-     *
+     * 
      */
     final public void testGetLabel() {
         Label label = this.node.getLabel("en");
@@ -120,8 +118,8 @@
     }
 
     /**
-     * Test addLabel 
-     *
+     * Test addLabel
+     * 
      */
     final public void testAddLabel() {
         Label label = new Label("Barolo", "it");
@@ -135,7 +133,7 @@
 
     /**
      * Test removeLabel
-     *
+     * 
      */
     final public void testRemoveLabel() {
         Label label = new Label("Bar", "en");
@@ -146,7 +144,7 @@
 
     /**
      * Test getHref
-     *
+     * 
      */
     final public void testGetHref() {
         assertEquals(this.node.getHref(), "http://exact.biz");
@@ -155,7 +153,7 @@
     /**
      * Test getSuffix
      * 
-     *
+     * 
      */
     final public void testGetSuffix() {
         assertEquals(this.node.getSuffix(), "suffix");
@@ -163,7 +161,7 @@
 
     /**
      * Test hasLink
-     *
+     * 
      */
     final public void testHasLink() {
         assertTrue(this.node.hasLink());

Modified: lenya/trunk/src/test/org/apache/lenya/cms/workflow/WorkflowTest.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/workflow/WorkflowTest.java?rev=377757&r1=377756&r2=377757&view=diff
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/workflow/WorkflowTest.java (original)
+++ lenya/trunk/src/test/org/apache/lenya/cms/workflow/WorkflowTest.java Tue Feb 14 08:29:56 2006
@@ -30,12 +30,13 @@
 import org.apache.lenya.ac.Role;
 import org.apache.lenya.ac.User;
 import org.apache.lenya.ac.impl.AccessControlTest;
-import org.apache.lenya.cms.PublicationHelper;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentIdentityMap;
 import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.workflow.Situation;
-import org.apache.lenya.workflow.WorkflowInstance;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.workflow.WorkflowManager;
+import org.apache.lenya.workflow.Workflowable;
 
 /**
  * To change the template for this generated type comment go to Window>Preferences>Java>Code
@@ -56,7 +57,6 @@
      * @param args The command line arguments
      */
     public static void main(String[] args) {
-        args = PublicationHelper.extractPublicationArguments(args);
         TestRunner.run(getSuite());
     }
 
@@ -76,36 +76,37 @@
      * @throws Exception when something went wrong.
      */
     public void testWorkflow() throws Exception {
-        Publication publication = PublicationHelper.getPublication();
+        Publication publication = PublicationUtil.getPublication(getManager(), "test");
         String url = "/" + publication.getId() + URL;
-        DocumentIdentityMap map = new DocumentIdentityMap(publication);
-        Document document = map.getFactory().getFromURL(url);
+        DocumentIdentityMap map = getIdentityMap();
+        Document document = map.getFromURL(url);
+        Session session = new Session(map.getIdentityMap(), getIdentity(), getLogger());
 
         File configDir = new File(publication.getDirectory(), "config" + File.separator + "ac"
                 + File.separator + "passwd");
         assertTrue(configDir.exists());
 
         Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), url);
-        
-        WorkflowResolver resolver = null;
-        try {
-            resolver = (WorkflowResolver) getManager().lookup(WorkflowResolver.ROLE);
 
+        WorkflowManager resolver = null;
+        try {
+            resolver = (WorkflowManager) getManager().lookup(WorkflowManager.ROLE);
 
             String[] emptyRoles = {};
-            Situation situation = new CMSSituation(emptyRoles, "test", "127.0.0.1");
 
-            WorkflowInstance instance = resolver.getWorkflowInstance(document);
-            instance.getHistory().initialize(situation);
+            Workflowable instance = new DocumentWorkflowable(getManager(),
+                    session,
+                    document,
+                    getLogger());
 
             for (int situationIndex = 0; situationIndex < situations.length; situationIndex++) {
                 assertNotNull(instance);
 
-                System.out.println("Current state: " + instance.getCurrentState());
+                System.out.println("Current state: " + instance.getLatestVersion().getState());
 
                 Identity identity = new Identity();
-                User user = getAccreditableManager().getUserManager().getUser(
-                        situations[situationIndex].getUser());
+                User user = getAccreditableManager().getUserManager()
+                        .getUser(situations[situationIndex].getUser());
                 identity.addIdentifiable(user);
 
                 Role[] roles = policy.getRoles(identity);
@@ -116,44 +117,22 @@
                 }
 
                 System.out.println();
-                
+
                 String[] roleIds = new String[roles.length];
                 for (int i = 0; i < roles.length; i++) {
                     roleIds[i] = roles[i].getId();
                 }
 
-                situation = new CMSSituation(roleIds, identity.getUser().getId(), "");
-
-                String[] events = instance.getExecutableEvents(situation);
 
-                String event = null;
-                System.out.print("Events:");
-
-                for (int eventIndex = 0; eventIndex < events.length; eventIndex++) {
-                    System.out.print(" " + events[eventIndex]);
-
-                    if (events[eventIndex].equals(situations[situationIndex].getEvent())) {
-                        event = events[eventIndex];
-                    }
-                }
-
-                assertNotNull(event);
-                System.out.println();
-
-                System.out.println("Executing event: " + event);
-                instance.invoke(situation, event);
-
-                assertTrue(instance.getValue(variableName) == situations[situationIndex].getValue());
+                assertTrue(instance.getLatestVersion().getValue(variableName) == situations[situationIndex].getValue());
 
                 System.out.println("Variable: " + variableName + " = "
-                        + instance.getValue(variableName));
+                        + instance.getLatestVersion().getValue(variableName));
                 System.out.println("------------------------------------------------------");
             }
+        } finally {
+            // this.manager.release(resolver);
         }
-        finally {
-//            this.manager.release(resolver);
-        }
-
 
         System.out.println("Test completed.");
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org