KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > file > TestProjectHistory


1 /*
2  * File : $Source: /usr/local/cvs/opencms/test/org/opencms/file/TestProjectHistory.java,v $
3  * Date : $Date: 2005/06/23 11:11:43 $
4  * Version: $Revision: 1.6 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.file;
33
34 import org.opencms.test.OpenCmsTestCase;
35 import org.opencms.test.OpenCmsTestProperties;
36
37 import java.util.List JavaDoc;
38
39 import junit.extensions.TestSetup;
40 import junit.framework.Test;
41 import junit.framework.TestSuite;
42
43 /**
44  * Unit test for the project history function of the CmsObject.<p>
45  *
46  * @author Thomas Weckert
47  * @version $Revision: 1.6 $
48  * @since 6.0 alpha 2
49  */

50 public class TestProjectHistory extends OpenCmsTestCase {
51
52     /**
53      * Default JUnit constructor.<p>
54      *
55      * @param arg0 JUnit parameters
56      */

57     public TestProjectHistory(String JavaDoc arg0) {
58
59         super(arg0);
60     }
61
62     /**
63      * Test suite for this test class.<p>
64      *
65      * @return the test suite
66      */

67     public static Test suite() {
68
69         OpenCmsTestProperties.initialize(org.opencms.test.AllTests.TEST_PROPERTIES_PATH);
70
71         TestSuite suite = new TestSuite();
72         suite.setName(TestProjectHistory.class.getName());
73
74         suite.addTest(new TestProjectHistory("testProjectHistory"));
75
76         TestSetup wrapper = new TestSetup(suite) {
77
78             protected void setUp() {
79
80                 setupOpenCms("simpletest", "/sites/default/");
81             }
82
83             protected void tearDown() {
84
85                 removeOpenCms();
86             }
87         };
88
89         return wrapper;
90     }
91
92     /**
93      * Tests the project history function of the CmsObject.<p>
94      *
95      * @throws Throwable if something goes wrong
96      */

97     public void testProjectHistory() throws Throwable JavaDoc {
98
99         CmsObject cms = getCmsObject();
100
101         echo("Testing the project history function");
102         projectHistory(cms);
103     }
104
105     /**
106      * Tests the project history function of the CmsObject.<p>
107      *
108      * @param cms the CmsObject
109      * @throws Throwable if something goes wrong
110      */

111     public static void projectHistory(CmsObject cms) throws Throwable JavaDoc {
112
113         List JavaDoc projectHistory = null;
114         CmsBackupProject backupProject = null;
115
116         projectHistory = cms.getAllBackupProjects();
117
118         // the project history should contain just the setup project here
119
assertEquals(projectHistory.size(), 1);
120         backupProject = (CmsBackupProject)projectHistory.get(0);
121         assertEquals(backupProject.getId(), 2);
122         assertEquals(backupProject.getName(), "_setupProject");
123     }
124
125 }
Popular Tags