KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > rc > RevisionControllerTest


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: RevisionControllerTest.java 42625 2004-03-04 15:45:03Z egli $ */
19
20 package org.apache.lenya.cms.rc;
21
22 import java.io.FileNotFoundException JavaDoc;
23 import java.io.IOException JavaDoc;
24
25 import junit.framework.TestCase;
26
27 public class RevisionControllerTest extends TestCase {
28     /**
29      * Constructor.
30      * @param test The test to execute.
31      */

32     public RevisionControllerTest(String JavaDoc test) {
33         super(test);
34     }
35
36     /**
37      * The main method.
38      * @param args The command-line arguments.
39      */

40     public static void main(String JavaDoc[] args) {
41         // TestRunner.run(getSuite());
42

43         if (args.length != 4) {
44             System.out.println(
45                 "Usage: "
46                     + new RevisionController().getClass().getName()
47                     + " 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)");
48
49             return;
50         }
51
52         String JavaDoc identityS = args[0];
53         String JavaDoc source = args[1];
54         String JavaDoc identityD = args[2];
55         String JavaDoc destination = args[3];
56         RevisionController rc = new RevisionController();
57         try {
58             rc.reservedCheckOut(source, identityS);
59         } catch (FileNotFoundException JavaDoc e) // No such source file
60
{
61             System.out.println(e.toString());
62         } catch (FileReservedCheckOutException e) // Source has been checked out already
63
{
64             System.out.println(e.toString());
65             // System.out.println(error(e.source + "is already check out by " + e.checkOutUsername + " since " + e.checkOutDate));
66
return;
67
68         } catch (IOException JavaDoc e) { // Cannot create rcml file
69
System.out.println(e.toString());
70             return;
71
72         } catch (Exception JavaDoc e) {
73             System.out.println(e.toString());
74             return;
75         }
76
77         try {
78             rc.reservedCheckIn(destination, identityD, true);
79         } catch (FileReservedCheckInException e) {
80             System.out.println(e.toString());
81         } catch (Exception JavaDoc e) {
82             System.out.println(e.toString());
83         }
84     }
85
86     /* protected static final Class[] classes = {
87        };
88     
89        /**
90         * Creates a test suite.
91         * @return a test suite.
92         */

93     /* public static Test getSuite() {
94             TestSuite suite = new TestSuite();
95     
96             for (int i = 0; i < classes.length; i++) {
97                 suite.addTestSuite(classes[i]);
98             }
99     
100             return suite;
101         }
102     */

103     /** @see junit.framework.TestCase#setUp() */
104     protected void setUp() throws Exception JavaDoc {}
105 }
106
Popular Tags