1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.net.ftp.parser;
18
19 import junit.framework.TestSuite;
20
21 import org.apache.commons.net.ftp.FTPFile;
22 import org.apache.commons.net.ftp.FTPFileEntryParser;
23
24 /**
25 * Created on Apr 6, 2005<br/>
26 * @author <a href="mailto:wnoto@openfinance.com">William Noto</a>
27 * @version $Id: NTFTPEntryParserTest.java,v 1.16 2005/01/02 03:17:50 scohen Exp $
28 */
29 public class MVSFTPEntryParserTest extends FTPParseTestFramework
30 {
31 private static final String [] goodsamples =
32 {
33 "Migrated file1.I",
34 "Migrated file2.I",
35 "PSMLC1 3390 2005/04/04 1 1 VB 27994 27998 PS file3.I",
36 "PSMLB9 3390 2005/04/04 1 1 VB 27994 27998 PS file4.I.BU",
37 "PSMLB6 3390 2005/04/05 1 1 VB 27994 27998 PS file3.I.BU",
38 "PSMLC6 3390 2005/04/05 1 1 VB 27994 27998 PS file6.I",
39 "Migrated file6.O",
40 "PSMLB7 3390 2005/04/04 1 1 VB 27994 27998 PS file7.O",
41 "PSMLC6 3390 2005/04/05 1 1 VB 27994 27998 PS file7.O.BU",
42 "FPFS42 3390 2004/06/23 1 1 FB 128 6144 PS INCOMING.RPTBM023.D061704",
43 "FPFS41 3390 2004/06/23 1 1 FB 128 6144 PS INCOMING.RPTBM056.D061704",
44 "FPFS25 3390 2004/06/23 1 1 FB 128 6144 PS INCOMING.WTM204.D061704",
45 };
46
47 private static final String [] badsamples =
48 {
49 "MigratedP201.$FTXPBI1.$CF2ITB.$AAB0402.I",
50 "PSMLC133902005/04/041VB2799427998PSfile1.I",
51 "file2.O",
52 };
53
54 /**
55 * @see junit.framework.TestCase#TestCase(String)
56 */
57 public MVSFTPEntryParserTest (String name)
58 {
59 super(name);
60 }
61
62
63
64
65 protected String[] getBadListing() {
66 return badsamples;
67 }
68
69
70
71 protected String[] getGoodListing() {
72 return goodsamples;
73 }
74
75
76 /**
77 * @see org.apache.commons.net.ftp.parser.FTPParseTestFramework#getParser()
78 */
79 protected FTPFileEntryParser getParser()
80 {
81 return new CompositeFileEntryParser(new FTPFileEntryParser[]
82 {
83 new MVSFTPEntryParser(),
84 });
85 }
86
87 /**
88 * Method suite.
89 *
90 * @return TestSuite
91 */
92 public static TestSuite suite()
93 {
94 return(new TestSuite(MVSFTPEntryParserTest.class));
95 }
96
97 public void testParseFieldsOnDirectory() throws Exception
98 {
99
100
101 }
102
103
104
105
106 public void testParseFieldsOnFile() throws Exception {
107 FTPFile file = getParser().parseFTPEntry("Migrated file1.I");
108 assertNotNull("Could not parse entry.", file);
109 assertTrue("Should have been a file.", file.isFile());
110 assertEquals("file1.I", file.getName());
111
112 FTPFile file2 = getParser().parseFTPEntry("PSMLC1 3390 2005/04/04 1 1 VB 27994 27998 PS file2.I");
113 assertNotNull("Could not parse entry.", file2);
114 assertTrue("Should have been a file.", file2.isFile());
115 assertEquals("file2.I", file2.getName());
116 }
117 }