You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2009/02/10 10:33:52 UTC

svn commit: r742912 - in /lenya/trunk: org.apache.lenya.core.usecase/ org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/ org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/

Author: andreas
Date: Tue Feb 10 09:33:45 2009
New Revision: 742912

URL: http://svn.apache.org/viewvc?rev=742912&view=rev
Log:
Fixed some test compilation errors.

Modified:
    lenya/trunk/org.apache.lenya.core.usecase/pom.xml
    lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
    lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java

Modified: lenya/trunk/org.apache.lenya.core.usecase/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/pom.xml?rev=742912&r1=742911&r2=742912&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/pom.xml Tue Feb 10 09:33:45 2009
@@ -66,5 +66,38 @@
       <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-cache</artifactId>
     </dependency>
+    
+    <!-- Tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-impl</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <!-- FIXME: This dependency is transitive and should be obtained automatically
+      see http://jira.codehaus.org/browse/MNG-1378 -->
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-sitemap-impl</artifactId>
+      <scope>test</scope>
+      <type>test-jar</type>
+    </dependency>
+    
   </dependencies>
 </project>

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java?rev=742912&r1=742911&r2=742912&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java Tue Feb 10 09:33:45 2009
@@ -23,7 +23,7 @@
 import java.util.Map;
 
 import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker;
 
 /**

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java?rev=742912&r1=742911&r2=742912&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java Tue Feb 10 09:33:45 2009
@@ -20,15 +20,11 @@
 
 package org.apache.lenya.cms.workflow;
 
-import org.apache.lenya.ac.AccessControlException;
 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.Publication;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.WorkflowException;
 import org.apache.lenya.workflow.Workflowable;
 
 /**
@@ -49,18 +45,13 @@
      * @throws Exception when something went wrong.
      */
     public void testWorkflow() throws Exception {
-        Publication publication = getPublication("test");
+        Publication publication = getSession().getPublication("test");
         String url = "/" + publication.getId() + URL;
-        DocumentFactory map = getFactory();
-        Document document = map.getFromURL(url);
+        Document document = getSession().getUriHandler().getDocument(url);
 
-        document.getRepositoryNode().lock();
+        document.lock();
 
-        Session session = getSession(submitSituation);
-        Workflowable workflowable = WorkflowUtil.getWorkflowable(getManager(),
-                session,
-                getLogger(),
-                document);
+        Workflowable workflowable = WorkflowUtil.getWorkflowable(document);
         if (workflowable.getVersions().length > 0) {
             Version version = workflowable.getLatestVersion();
             if (version.getValue(variableName) == true) {
@@ -75,14 +66,12 @@
             invoke(document, situation);
         }
 
-        document.getRepositoryNode().unlock();
+        document.unlock();
 
         getLogger().info("Test completed.");
     }
 
-    protected void invoke(Document document, TestSituation situation)
-            throws AccessControlException, RepositoryException, WorkflowException {
-        Session session = getSession(situation);
+    protected void invoke(Document document, TestSituation situation) throws Exception {
         Workflowable instance = new DocumentWorkflowable(document);
         assertNotNull(instance);
 
@@ -90,7 +79,7 @@
 
         getLogger().info("Event: " + event);
 
-        WorkflowUtil.invoke(getManager(), session, getLogger(), document, event);
+        WorkflowUtil.invoke(document, event);
 
         boolean value = instance.getLatestVersion().getValue(variableName);
 
@@ -100,8 +89,7 @@
         assertEquals(value, situation.getValue());
     }
 
-    protected Session getSession(TestSituation situation) throws AccessControlException,
-            RepositoryException {
+    protected Session getSession(TestSituation situation) throws Exception {
         Session session = login(situation.getUser());
         getLogger().info("User: [" + session.getIdentity().getUser() + "]");
         return session;
@@ -110,10 +98,8 @@
     private static final TestSituation submitSituation = new TestSituation("lenya", "submit", false);
     private static final TestSituation rejectSituation = new TestSituation("alice", "reject", false);
     private static final TestSituation deactivateSituation = new TestSituation("alice",
-            "deactivate",
-            false);
-    private static final TestSituation publishSituation = new TestSituation("alice",
-            "publish",
+            "deactivate", false);
+    private static final TestSituation publishSituation = new TestSituation("alice", "publish",
             true);
 
     private static final TestSituation[] situations = { submitSituation, rejectSituation,



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