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/11/26 17:43:48 UTC

svn commit: r479379 - /lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java

Author: andreas
Date: Sun Nov 26 08:43:47 2006
New Revision: 479379

URL: http://svn.apache.org/viewvc?view=rev&rev=479379
Log:
Added failing test case for bug 41005

Modified:
    lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java

Modified: lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java?view=diff&rev=479379&r1=479378&r2=479379
==============================================================================
--- lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java (original)
+++ lenya/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java Sun Nov 26 08:43:47 2006
@@ -23,32 +23,61 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
+import org.apache.avalon.framework.service.ServiceException;
+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.DocumentManager;
+import org.apache.lenya.cms.repository.RepositoryException;
 
 /**
  * Revision Controller test
  */
 public class RevisionControllerTest extends AbstractAccessControlTest {
 
-    public void testRevisionController() {
+    /**
+     * @see <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=41005">Bug 41005</a>
+     * @throws AccessControlException
+     * @throws RepositoryException
+     * @throws ServiceException
+     */
+    public void testCheckIn() throws AccessControlException, RepositoryException, ServiceException {
+        login("lenya");
         
-        String[] args = { "", "", "", "" };
+        DocumentManager docMgr = null;
+        try {
+            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
+            Document source = getPublication("test").getArea("authoring").getSite().getNode("/links").getLink("en").getDocument();
+            Document target = docMgr.addVersion(source, "authoring", "de");
+            target.delete();
+        }
+        finally {
+            if (docMgr != null) {
+                getManager().release(docMgr);
+            }
+        }
         
-        //       TestRunner.run(getSuite());
+        getFactory().getSession().commit();
+    }
+
+    public void testRevisionController() {
+
+        String[] args = { "", "", "", "" };
+
+        // TestRunner.run(getSuite());
 
         if (args.length != 4) {
-            System.out.println(
-                "Usage: "
-                    + RevisionController.class.getName()
-                    + " username(user who checkout) source(filename without the rootDirectory of the document to checkout) username(user who checkin) destination(filename without the rootDirectory of document to checkin)");
+            System.out
+                    .println("Usage: "
+                            + RevisionController.class.getName()
+                            + " username(user who checkout) source(filename without the rootDirectory of the document to checkout) username(user who checkin) destination(filename without the rootDirectory of document to checkin)");
 
             return;
         }
 
         Document doc1 = null;
         Document doc2 = null;
-        
+
         String identityS = args[0];
         String source = args[1];
         String identityD = args[2];
@@ -57,12 +86,14 @@
         try {
             rc.reservedCheckOut(doc1.getRepositoryNode(), identityS);
         } catch (FileNotFoundException e) // No such source file
-            {
+        {
             System.out.println(e.toString());
-        } catch (FileReservedCheckOutException e) // Source has been checked out already
-            {
+        } catch (FileReservedCheckOutException e) // Source has been checked
+                                                    // out already
+        {
             System.out.println(e.toString());
-            //	System.out.println(error(e.source + "is already check out by " + e.checkOutUsername + " since " +						e.checkOutDate));
+            // System.out.println(error(e.source + "is already check out by " +
+            // e.checkOutUsername + " since " + e.checkOutDate));
             return;
 
         } catch (IOException e) { // Cannot create rcml file
@@ -83,25 +114,4 @@
         }
     }
 
-    /*   protected static final Class[] classes = {
-       };
-    
-       /**
-        * Creates a test suite.
-        * @return a test suite.
-        */
-    /*    public static Test getSuite() {
-            TestSuite suite = new TestSuite();
-    
-            for (int i = 0; i < classes.length; i++) {
-                suite.addTestSuite(classes[i]);
-            }
-    
-            return suite;
-        }
-    */
-    /** @see junit.framework.TestCase#setUp() */
-    protected void setUp() throws Exception {
-        // do nothing
-    }
 }



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