1 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 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 57 public MVSFTPEntryParserTest (String name) 58 { 59 super(name); 60 } 61 62 65 protected String [] getBadListing() { 66 return badsamples; 67 } 68 71 protected String [] getGoodListing() { 72 return goodsamples; 73 } 74 75 76 79 protected FTPFileEntryParser getParser() 80 { 81 return new CompositeFileEntryParser(new FTPFileEntryParser[] 82 { 83 new MVSFTPEntryParser(), 84 }); 85 } 86 87 92 public static TestSuite suite() 93 { 94 return(new TestSuite(MVSFTPEntryParserTest.class)); 95 } 96 97 public void testParseFieldsOnDirectory() throws Exception 98 { 99 } 102 103 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 } 118 | Popular Tags |