@Test public void testIncDataForRemovedFile() throws Exception { File root = TestUtils.getCanonicalRoot("resources", "removedFile"); File fakeBlobRoot = getMergedBlobFolder(root); ResourceMerger resourceMerger = new ResourceMerger(0); assertTrue(resourceMerger.loadFromBlob(fakeBlobRoot, true )); checkSourceFolders(resourceMerger); List<ResourceSet> sets = resourceMerger.getDataSets(); assertEquals(1, sets.size()); RecordingLogger logger = new RecordingLogger(); ResourceSet mainSet = sets.get(0); File resBase = new File(root, "res"); File resDrawable = new File(resBase, ResourceFolderType.DRAWABLE.getName()); File resIconRemoved = new File(resDrawable, "removed.png"); mainSet.updateWith(resBase, resIconRemoved, FileStatus.REMOVED, logger); checkLogger(logger); resourceMerger.validateDataSets(); ListMultimap<String, ResourceItem> mergedMap = resourceMerger.getDataMap(); List<ResourceItem> removedIcon = mergedMap.get("drawable/removed"); assertEquals(1, removedIcon.size()); assertTrue(removedIcon.get(0).isRemoved()); assertTrue(removedIcon.get(0).isWritten()); assertFalse(removedIcon.get(0).isTouched()); File outFolder = getFolderCopy(new File(root, "out")); MergedResourceWriter writer = getConsumer(outFolder); resourceMerger.mergeData(writer, false ); File outDrawableFolder = new File(outFolder, ResourceFolderType.DRAWABLE.getName()); assertFalse(new File(outDrawableFolder, "removed.png").isFile()); assertTrue(new File(outDrawableFolder, "icon.png").isFile()); File outBlobFolder = TestUtils.createTempDirDeletedOnExit(); resourceMerger.writeBlobTo(outBlobFolder, writer, false); ResourceMerger resourceMerger2 = new ResourceMerger(0); assertTrue(resourceMerger2.loadFromBlob(outBlobFolder, true )); mergedMap = resourceMerger2.getDataMap(); removedIcon = mergedMap.get("drawable/removed"); assertTrue(removedIcon.isEmpty()); }
@Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); }
ResourceMerger extends DataMerger<ResourceItem, ResourceFile, ResourceSet> { @Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); } }
ResourceMerger extends DataMerger<ResourceItem, ResourceFile, ResourceSet> { @Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); } ResourceMerger(int minSdk); }
ResourceMerger extends DataMerger<ResourceItem, ResourceFile, ResourceSet> { @Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); } ResourceMerger(int minSdk); @Override void addDataSet(ResourceSet resourceSet); @Override void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp); }
ResourceMerger extends DataMerger<ResourceItem, ResourceFile, ResourceSet> { @Override public void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp) throws MergingException { clearFilterCache(); super.mergeData(consumer, doCleanUp); } ResourceMerger(int minSdk); @Override void addDataSet(ResourceSet resourceSet); @Override void mergeData(@NonNull MergeConsumer<ResourceItem> consumer, boolean doCleanUp);  }