1 // re/mind - Remote Reminder Software
2 // Copyright (C) 2002 Moritz Petersen
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
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
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // $Id: FTPStorageTest.java,v 1.2 2002/09/29 19:33:23 powerpete Exp $
19 package de.jface.remind.io;
20
21 import de.jface.remind.Config;
22 import de.jface.remind.core.Note;
23 import de.jface.remind.core.NoteText;
24 import de.jface.remind.core.UniqueNumber;
25
26 import java.io.File;
27 import java.io.FileInputStream;
28 import java.io.FileOutputStream;
29
30 import java.util.Collection;
31 import java.util.LinkedList;
32
33 import junit.framework.TestCase;
34
35 /***
36 * The test case <code>FTPStorageTest</code>
37 * tests the [your text here].
38 *
39 * @author Moritz Petersen
40 * @version $Revision: 1.2 $
41 */
42 public class FTPStorageTest extends TestCase
43 {
44 /***
45 * This constructor creates a new
46 * FTPStorageTest test case.
47 */
48 public FTPStorageTest(String name)
49 {
50 super(name);
51 }
52
53 /***
54 * This method tests [your text here].
55 */
56 public void testFTPAccess()
57 throws Throwable
58 {
59 Note note1 = new Note();
60
61 note1.setText(new NoteText("foo bar"));
62
63 Collection c1 = new LinkedList();
64
65 c1.add(note1);
66
67 FTPStorage storage1 = new FTPStorage();
68
69 storage1.writeNotes(c1, Config.FTP_DATA_FILE_NAME + ".test");
70
71
72 // Reset the UniqueNumber to be able to get the
73 // same NoteMetaData.
74 UniqueNumber.reset();
75
76 FTPStorage storage2 = new FTPStorage();
77 Collection c2 = storage2.readNotes(Config.FTP_DATA_FILE_NAME + ".test");
78
79 assertEquals(c1, c2);
80
81 Note note2 = (Note) c2.iterator().next();
82
83 assertEquals(note1.getText(), note2.getText());
84 }
85 }
This page was automatically generated by Maven