@Test public void testNormalizeNone() { CopyRootPathsNormalizer normalizer = new CopyRootPathsNormalizer(); final HashMap<Path, Path> files = new HashMap<Path, Path>(); files.put(new Path("/p", EnumSet.of(Path.Type.directory)), new Path("/d", EnumSet.of(Path.Type.directory))); assertEquals(files, normalizer.normalize(files)); }
@Override public Map<Path, Path> normalize(final Map<Path, Path> files) { final Map<Path, Path> normalized = new HashMap<Path, Path>(); Iterator<Path> sourcesIter = files.keySet().iterator(); Iterator<Path> destinationsIter = files.values().iterator(); while(sourcesIter.hasNext()) { Path source = sourcesIter.next(); Path destination = destinationsIter.next(); boolean duplicate = false; for(Iterator<Path> normalizedIter = normalized.keySet().iterator(); normalizedIter.hasNext(); ) { Path n = normalizedIter.next(); if(source.isChild(n)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", source.getAbsolute())); } duplicate = true; break; } if(n.isChild(source)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", n.getAbsolute())); } normalizedIter.remove(); } } if(!duplicate) { normalized.put(source, destination); } } return normalized; }
CopyRootPathsNormalizer implements RootPathsNormalizer<Map<Path, Path>> { @Override public Map<Path, Path> normalize(final Map<Path, Path> files) { final Map<Path, Path> normalized = new HashMap<Path, Path>(); Iterator<Path> sourcesIter = files.keySet().iterator(); Iterator<Path> destinationsIter = files.values().iterator(); while(sourcesIter.hasNext()) { Path source = sourcesIter.next(); Path destination = destinationsIter.next(); boolean duplicate = false; for(Iterator<Path> normalizedIter = normalized.keySet().iterator(); normalizedIter.hasNext(); ) { Path n = normalizedIter.next(); if(source.isChild(n)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", source.getAbsolute())); } duplicate = true; break; } if(n.isChild(source)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", n.getAbsolute())); } normalizedIter.remove(); } } if(!duplicate) { normalized.put(source, destination); } } return normalized; } }
CopyRootPathsNormalizer implements RootPathsNormalizer<Map<Path, Path>> { @Override public Map<Path, Path> normalize(final Map<Path, Path> files) { final Map<Path, Path> normalized = new HashMap<Path, Path>(); Iterator<Path> sourcesIter = files.keySet().iterator(); Iterator<Path> destinationsIter = files.values().iterator(); while(sourcesIter.hasNext()) { Path source = sourcesIter.next(); Path destination = destinationsIter.next(); boolean duplicate = false; for(Iterator<Path> normalizedIter = normalized.keySet().iterator(); normalizedIter.hasNext(); ) { Path n = normalizedIter.next(); if(source.isChild(n)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", source.getAbsolute())); } duplicate = true; break; } if(n.isChild(source)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", n.getAbsolute())); } normalizedIter.remove(); } } if(!duplicate) { normalized.put(source, destination); } } return normalized; }  }
CopyRootPathsNormalizer implements RootPathsNormalizer<Map<Path, Path>> { @Override public Map<Path, Path> normalize(final Map<Path, Path> files) { final Map<Path, Path> normalized = new HashMap<Path, Path>(); Iterator<Path> sourcesIter = files.keySet().iterator(); Iterator<Path> destinationsIter = files.values().iterator(); while(sourcesIter.hasNext()) { Path source = sourcesIter.next(); Path destination = destinationsIter.next(); boolean duplicate = false; for(Iterator<Path> normalizedIter = normalized.keySet().iterator(); normalizedIter.hasNext(); ) { Path n = normalizedIter.next(); if(source.isChild(n)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", source.getAbsolute())); } duplicate = true; break; } if(n.isChild(source)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", n.getAbsolute())); } normalizedIter.remove(); } } if(!duplicate) { normalized.put(source, destination); } } return normalized; }  @Override Map<Path, Path> normalize(final Map<Path, Path> files); }
CopyRootPathsNormalizer implements RootPathsNormalizer<Map<Path, Path>> { @Override public Map<Path, Path> normalize(final Map<Path, Path> files) { final Map<Path, Path> normalized = new HashMap<Path, Path>(); Iterator<Path> sourcesIter = files.keySet().iterator(); Iterator<Path> destinationsIter = files.values().iterator(); while(sourcesIter.hasNext()) { Path source = sourcesIter.next(); Path destination = destinationsIter.next(); boolean duplicate = false; for(Iterator<Path> normalizedIter = normalized.keySet().iterator(); normalizedIter.hasNext(); ) { Path n = normalizedIter.next(); if(source.isChild(n)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", source.getAbsolute())); } duplicate = true; break; } if(n.isChild(source)) { if(log.isDebugEnabled()) { log.debug(String.format("Remove path %s already included by directory", n.getAbsolute())); } normalizedIter.remove(); } } if(!duplicate) { normalized.put(source, destination); } } return normalized; }  @Override Map<Path, Path> normalize(final Map<Path, Path> files);  }