1 /*
2 Bloof - visualize the evolution of your software project
3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de>
4 http://bloof.sf.net/
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 $RCSfile: CvsPluginTest.java,v $
19 Created on $Date: 2003/06/12 11:15:59 $
20 */
21 package net.sf.bloof.test.cvsplugin;
22
23 import net.sf.bloof.scm.cvsplugin.CvsAccess;
24 import net.sf.bloof.scm.cvsplugin.CvsConnectionMethod;
25 import net.sf.bloof.scm.cvsplugin.CvsPlugin;
26 import net.sf.bloof.scm.cvsplugin.InvalidRepositoryLocationException;
27 import net.sf.bloof.scm.cvsplugin.LoginDetails;
28 import net.sf.bloof.scm.cvsplugin.RepositoryLocation;
29 import net.sf.bloof.scm.ScmAccessException;
30 import net.sf.bloof.scm.ScmRevision;
31 import net.sf.bloof.scm.ScmRevisionIterator;
32 import net.sf.bloof.test.MainTestSuite;
33
34 import junit.framework.Assert;
35 import junit.framework.TestCase;
36
37 /***
38 * Tests for the CVS Plugin
39 * @author Lukasz Pekacki
40 * @version $Id: CvsPluginTest.java,v 1.5 2003/06/12 11:15:59 pekacki Exp $
41 */
42 public class CvsPluginTest extends TestCase {
43
44 private CvsAccess mAccess;
45
46 /***
47 * Method testGetRevisions
48 * Runs a test on the CvsPlugin to check if
49 * revisions are extracted correctly
50 */
51 public void testPserver() {
52 if (MainTestSuite.isOnline()) {
53
54 String localPlogin = "anonymous";
55 String localPpassword = "";
56 String localPhost = "cvs.sourceforge.net";
57 String localPrepositoryRoot = "/cvsroot/bloof";
58 String localPmoduleName = "bloof/src/test";
59 String localPaccessName = "test";
60
61 CvsPlugin cvsPlugin = new CvsPlugin();
62 RepositoryLocation location = null;
63 try {
64 location =
65 new RepositoryLocation(
66 CvsConnectionMethod.PSERVER,
67 localPlogin,
68 localPhost,
69 localPrepositoryRoot);
70 } catch (InvalidRepositoryLocationException e) {
71 fail("Invalid location" + e.toString());
72 }
73 mAccess =
74 new CvsAccess(
75 location,
76 new LoginDetails(localPlogin, localPpassword),
77 localPmoduleName,
78 localPaccessName);
79 ScmRevisionIterator revIter = null;
80 try {
81 revIter = cvsPlugin.getRevisions(mAccess);
82 } catch (ScmAccessException e) {
83 fail("Could not access cvs server." + e.toString());
84
85 }
86 Assert.assertTrue(revIter.hasNext());
87 while (revIter.hasNext()) {
88 ScmRevision rev = revIter.getNext();
89 assertNotNull(rev);
90 Assert.assertNotNull(rev.getAuthor());
91 Assert.assertNotNull(rev.getFileName());
92 Assert.assertNotNull(rev.getRevisionName());
93 Assert.assertNotNull(rev.getDate());
94 Assert.assertNotNull(rev.getPath());
95 Assert.assertTrue(rev.getAdded() >= 0);
96 Assert.assertTrue(rev.getRemoved() >= 0);
97 }
98 }
99 }
100
101 /***
102 * Method testGetRevisions
103 * Runs a test on the CvsPlugin to check if
104 * revisions are extracted correctly
105 */
106 public void testGetRevisionsFromLocalFile() {
107 CvsPlugin cvsPlugin = new CvsPlugin();
108 mAccess = CvsPlugin.getSamples()[0];
109 ScmRevisionIterator revIter = null;
110 try {
111 revIter = cvsPlugin.getRevisions(mAccess);
112 } catch (ScmAccessException e) {
113 fail("Could not access cvs server." + e.toString());
114
115 }
116 Assert.assertTrue(revIter.hasNext());
117 while (revIter.hasNext()) {
118 ScmRevision rev = revIter.getNext();
119 Assert.assertNotNull(rev.getAuthor());
120 Assert.assertNotNull(rev.getFileName());
121 Assert.assertNotNull(rev.getRevisionName());
122 Assert.assertNotNull(rev.getDate());
123 Assert.assertNotNull(rev.getPath());
124 Assert.assertTrue(rev.getAdded() >= 0);
125 Assert.assertTrue(rev.getRemoved() >= 0);
126 }
127 }
128
129 }
This page was automatically generated by Maven