1 /*
2 * $Header: /cvsroot/jdbforms/dbforms/tests/test/org/dbforms/util/TestFileHolder.java,v 1.6 2004/10/11 09:04:41 hkollmann Exp $
3 * $Revision: 1.6 $
4 * $Date: 2004/10/11 09:04:41 $
5 *
6 * DbForms - a Rapid Application Development Framework
7 * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 package org.dbforms.util;
25
26 import java.io.*;
27
28
29
30 /***
31 * Description of the Class
32 *
33 * @author epugh
34 * @created May 3, 2002
35 */
36 public class TestFileHolder extends AbstractTestCase {
37 /***
38 * DOCUMENT ME!
39 *
40 * @throws Exception DOCUMENT ME!
41 */
42 public void testFileHolder() throws Exception {
43 File testFile = new File(FileHolder.class.getResource("TestFileHolderFile.txt").getPath());
44 assertTrue("Make sure test file exists:" + testFile, testFile.canRead());
45 FileHolder fh = new FileHolder(testFile.getName(), null);
46 assertEquals(fh.getFileName(), testFile.getName());
47 }
48
49
50 /***
51 * DOCUMENT ME!
52 *
53 * @throws Exception DOCUMENT ME!
54 */
55 /*
56 public void testWritingFileOut() throws Exception {
57 File testFile = new File(FileHolder.class.getResource("TestFileHolderFile.txt").getPath());
58 assertTrue("Make sure test file exists:" + testFile, testFile.canRead());
59
60 BufferedInputStream bis = new BufferedInputStream(new FileInputStream(testFile));
61 FileHolder fh = new FileHolder(testFile.getName(), null);
62 File outputFile = new File(testFile.getParentFile(),
63 "TestFileHolderFile_output.txt");
64
65 if (outputFile.exists()) {
66 outputFile.delete();
67 }
68
69 assertTrue("Make sure the output file does not exist yet.",
70 !outputFile.exists());
71 fh.writeBufferToFile(outputFile);
72 assertTrue("Make sure output file exists.", outputFile.exists());
73 }
74 */
75 }