@Test public void testParse() { FTPFile parsed; parsed = parser.parseFTPEntry( "drwxr-xr-x folder 0 Oct 18 13:02 Akrilik" ); assertNotNull(parsed); assertEquals("Akrilik", parsed.getName()); assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(18, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); parsed = parser.parseFTPEntry( "drwxrwxrwx folder 0 Oct 11 14:53 Uploads" ); assertNotNull(parsed); assertEquals("Uploads", parsed.getName()); assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(11, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); parsed = parser.parseFTPEntry( "-rw-r--r-- 0 589878 589878 Oct 15 13:03 WebDAV SS.bmp" ); assertNotNull(parsed); assertEquals("WebDAV SS.bmp", parsed.getName()); assertEquals(FTPFile.FILE_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); }
@Override public FTPFile parseFTPEntry(String entry) { if(matches(entry)) { String typeStr = group(1); String filesize = group(18); String datestr = group(19) + " " + group(20); String name = group(21); String endtoken = group(22); return parseFTPEntry(typeStr, null, null, filesize, datestr, name, endtoken); } return null; }
RumpusFTPEntryParser extends CommonUnixFTPEntryParser { @Override public FTPFile parseFTPEntry(String entry) { if(matches(entry)) { String typeStr = group(1); String filesize = group(18); String datestr = group(19) + " " + group(20); String name = group(21); String endtoken = group(22); return parseFTPEntry(typeStr, null, null, filesize, datestr, name, endtoken); } return null; } }
RumpusFTPEntryParser extends CommonUnixFTPEntryParser { @Override public FTPFile parseFTPEntry(String entry) { if(matches(entry)) { String typeStr = group(1); String filesize = group(18); String datestr = group(19) + " " + group(20); String name = group(21); String endtoken = group(22); return parseFTPEntry(typeStr, null, null, filesize, datestr, name, endtoken); } return null; } RumpusFTPEntryParser(); }
RumpusFTPEntryParser extends CommonUnixFTPEntryParser { @Override public FTPFile parseFTPEntry(String entry) { if(matches(entry)) { String typeStr = group(1); String filesize = group(18); String datestr = group(19) + " " + group(20); String name = group(21); String endtoken = group(22); return parseFTPEntry(typeStr, null, null, filesize, datestr, name, endtoken); } return null; } RumpusFTPEntryParser(); @Override FTPFile parseFTPEntry(String entry); }
RumpusFTPEntryParser extends CommonUnixFTPEntryParser { @Override public FTPFile parseFTPEntry(String entry) { if(matches(entry)) { String typeStr = group(1); String filesize = group(18); String datestr = group(19) + " " + group(20); String name = group(21); String endtoken = group(22); return parseFTPEntry(typeStr, null, null, filesize, datestr, name, endtoken); } return null; } RumpusFTPEntryParser(); @Override FTPFile parseFTPEntry(String entry);  }