private void popPreserveOption(List<String> args) { for (Iterator<String> iter = args.iterator(); iter.hasNext(); ) { String cur = iter.next(); if (cur.equals("--")) { // stop parsing arguments when you see -- break; } else if (cur.startsWith("-p")) { iter.remove(); if (cur.length() == 2) { setPreserve(true); } else { String attributes = cur.substring(2); for (int index = 0; index < attributes.length(); index++) { preserve(FileAttribute.getAttribute(attributes.charAt(index))); } } return; } } } }
private void popPreserveOption(List<String> args) { for (Iterator<String> iter = args.iterator(); iter.hasNext(); ) { String cur = iter.next(); if (cur.equals("--")) { // stop parsing arguments when you see -- break; } else if (cur.startsWith("-p")) { iter.remove(); if (cur.length() == 2) { setPreserve(true); } else { String attributes = cur.substring(2); for (int index = 0; index < attributes.length(); index++) { preserve(FileAttribute.getAttribute(attributes.charAt(index))); } } return; } } } }
private void popPreserveOption(List<String> args) { for (Iterator<String> iter = args.iterator(); iter.hasNext(); ) { String cur = iter.next(); if (cur.equals("--")) { // stop parsing arguments when you see -- break; } else if (cur.startsWith("-p")) { iter.remove(); if (cur.length() == 2) { setPreserve(true); } else { String attributes = cur.substring(2); for (int index = 0; index < attributes.length(); index++) { preserve(FileAttribute.getAttribute(attributes.charAt(index))); } } return; } } } }
private void popPreserveOption(List<String> args) { for (Iterator<String> iter = args.iterator(); iter.hasNext(); ) { String cur = iter.next(); if (cur.equals("--")) { // stop parsing arguments when you see -- break; } else if (cur.startsWith("-p")) { iter.remove(); if (cur.length() == 2) { setPreserve(true); } else { String attributes = cur.substring(2); for (int index = 0; index < attributes.length(); index++) { preserve(FileAttribute.getAttribute(attributes.charAt(index))); } } return; } } } }
private void popPreserveOption(List<String> args) { for (Iterator<String> iter = args.iterator(); iter.hasNext(); ) { String cur = iter.next(); if (cur.equals("--")) { // stop parsing arguments when you see -- break; } else if (cur.startsWith("-p")) { iter.remove(); if (cur.length() == 2) { setPreserve(true); } else { String attributes = cur.substring(2); for (int index = 0; index < attributes.length(); index++) { preserve(FileAttribute.getAttribute(attributes.charAt(index))); } } return; } } } }
@Test(timeout = 10000) public void testDirectoryCpWithoutP() throws Exception { run(new Cp(), "d1", "d4"); assertTrue(fs.getFileStatus(new Path("d1")).getModificationTime() != fs.getFileStatus(new Path("d4")).getModificationTime()); assertTrue(!fs.getFileStatus(new Path("d1")).getPermission() .equals(fs.getFileStatus(new Path("d4")).getPermission())); } }
@Test(timeout = 10000) public void testDirectoryCpWithoutP() throws Exception { run(new Cp(), "d1", "d4"); assertTrue(fs.getFileStatus(new Path("d1")).getModificationTime() != fs.getFileStatus(new Path("d4")).getModificationTime()); assertTrue(!fs.getFileStatus(new Path("d1")).getPermission() .equals(fs.getFileStatus(new Path("d4")).getPermission())); } }
@Test(timeout = 10000) public void testCpWithoutP() throws Exception { run(new Cp(), FROM.toString(), TO.toString()); assertAttributesChanged(); }
@Test(timeout = 10000) public void testCpWithoutP() throws Exception { run(new Cp(), FROM.toString(), TO.toString()); assertAttributesChanged(); }
@Test(timeout = 10000) public void testCpWithP() throws Exception { run(new Cp(), "-p", FROM.toString(), TO.toString()); assertAttributesPreserved(); }
@Test(timeout = 10000) public void testCpWithP() throws Exception { run(new Cp(), "-p", FROM.toString(), TO.toString()); assertAttributesPreserved(); }
@Test(timeout = 10000) public void testDirectoryCpWithP() throws Exception { run(new Cp(), "-p", "d1", "d3"); assertEquals(fs.getFileStatus(new Path("d1")).getModificationTime(), fs.getFileStatus(new Path("d3")).getModificationTime()); assertEquals(fs.getFileStatus(new Path("d1")).getPermission(), fs.getFileStatus(new Path("d3")).getPermission()); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { popPreserveOption(args); CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "f"); cf.parse(args); setOverwrite(cf.getOpt("f")); // should have a -r option setRecursive(true); getRemoteDestination(args); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { popPreserveOption(args); CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "f"); cf.parse(args); setOverwrite(cf.getOpt("f")); // should have a -r option setRecursive(true); getRemoteDestination(args); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { popPreserveOption(args); CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "f"); cf.parse(args); setOverwrite(cf.getOpt("f")); // should have a -r option setRecursive(true); getRemoteDestination(args); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { popPreserveOption(args); CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "f", "d"); cf.parse(args); setDirectWrite(cf.getOpt("d")); setOverwrite(cf.getOpt("f")); // should have a -r option setRecursive(true); getRemoteDestination(args); }
@Test(timeout = 10000) public void testDirectoryCpWithP() throws Exception { run(new Cp(), "-p", "d1", "d3"); assertEquals(fs.getFileStatus(new Path("d1")).getModificationTime(), fs.getFileStatus(new Path("d3")).getModificationTime()); assertEquals(fs.getFileStatus(new Path("d1")).getPermission(), fs.getFileStatus(new Path("d3")).getPermission()); }
@Override protected void processOptions(LinkedList<String> args) throws IOException { popPreserveOption(args); CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "f", "d"); cf.parse(args); setDirectWrite(cf.getOpt("d")); setOverwrite(cf.getOpt("f")); // should have a -r option setRecursive(true); getRemoteDestination(args); }