File modTrgDir = new File(targetPatchDir, targetElementId); final ContentType contentType = mod.getItem().getContentType(); if(ContentType.MISC.equals(contentType)) { modSrcDir = new File(modSrcDir, Constants.MISC); modTrgDir = new File(modTrgDir, Constants.MISC); } else { final String slot; if (contentType.equals(ContentType.MODULE)) { modSrcDir = new File(modSrcDir, Constants.MODULES); modTrgDir = new File(modTrgDir, Constants.MODULES); slot = ((ModuleItem)mod.getItem()).getSlot(); } else if (contentType.equals(ContentType.BUNDLE)) { modSrcDir = new File(modSrcDir, Constants.BUNDLES); modTrgDir = new File(modTrgDir, Constants.BUNDLES);
File modTrgDir = new File(targetPatchDir, targetElementId); final ContentType contentType = mod.getItem().getContentType(); if(ContentType.MISC.equals(contentType)) { modSrcDir = new File(modSrcDir, Constants.MISC); modTrgDir = new File(modTrgDir, Constants.MISC); } else { final String slot; if (contentType.equals(ContentType.MODULE)) { modSrcDir = new File(modSrcDir, Constants.MODULES); modTrgDir = new File(modTrgDir, Constants.MODULES); slot = ((ModuleItem)mod.getItem()).getSlot(); } else if (contentType.equals(ContentType.BUNDLE)) { modSrcDir = new File(modSrcDir, Constants.BUNDLES); modTrgDir = new File(modTrgDir, Constants.BUNDLES);
modType = ModificationType.ADD; } else { // remove cancels add if(cp1Mod.getItem().getContentType().equals(ContentType.MODULE)) { if (cp2Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Item; if(cp2Type.equals(ModificationType.REMOVE)) { elementBuilder.addModule(module.getName(), module.getSlot(), module.getContentHash()); } else if (cp2Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Item; elementBuilder.addFile(misc.getName(), Arrays.asList(misc.getPath()), misc.getContentHash(), if (cp1Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Mod.getItem(); elementBuilder.removeModule(module.getName(), module.getSlot(), cp1Mod.getTargetHash()); } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.removeFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), if (cp1Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Mod.getItem(); elementBuilder.modifyModule(module.getName(), module.getSlot(), cp1Mod.getTargetHash(), module.getContentHash()); } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.modifyFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(),
modType = ModificationType.ADD; } else { // remove cancels add if(cp1Mod.getItem().getContentType().equals(ContentType.MODULE)) { if (cp2Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Item; if(cp2Type.equals(ModificationType.REMOVE)) { elementBuilder.addModule(module.getName(), module.getSlot(), module.getContentHash()); } else if (cp2Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Item; elementBuilder.addFile(misc.getName(), Arrays.asList(misc.getPath()), misc.getContentHash(), if (cp1Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Mod.getItem(); elementBuilder.removeModule(module.getName(), module.getSlot(), cp1Mod.getTargetHash()); } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.removeFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), if (cp1Item.getContentType().equals(ContentType.MODULE)) { final ModuleItem module = (ModuleItem) cp2Mod.getItem(); elementBuilder.modifyModule(module.getName(), module.getSlot(), cp1Mod.getTargetHash(), module.getContentHash()); } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.modifyFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(),
final ContentItem item = mod.getItem(); assertEquals(0, mod.getTargetHash().length); if(ContentType.MODULE.equals(item.getContentType())) { Assert.assertArrayEquals(moduleHash("cp2"), item.getContentHash()); } else if(ContentType.MISC.equals(item.getContentType())) { Assert.assertArrayEquals(miscHash("cp2"), item.getContentHash()); } else {
final ContentItem item = mod.getItem(); assertEquals(0, item.getContentHash().length); if(ContentType.MODULE.equals(item.getContentType())) { Assert.assertArrayEquals(moduleHash("base"), mod.getTargetHash()); } else if(ContentType.MISC.equals(item.getContentType())) { Assert.assertArrayEquals(miscHash("base"), mod.getTargetHash()); } else {
assertEquals(ModificationType.MODIFY, mod.getType()); final ContentItem item = mod.getItem(); if(ContentType.MODULE.equals(item.getContentType())) { Assert.assertArrayEquals(moduleHash("base"), mod.getTargetHash()); Assert.assertArrayEquals(moduleHash("cp2"), item.getContentHash()); } else if(ContentType.MISC.equals(item.getContentType())) { Assert.assertArrayEquals(miscHash("base"), mod.getTargetHash()); Assert.assertArrayEquals(miscHash("cp2"), item.getContentHash());
assertEquals(ModificationType.MODIFY, mod.getType()); final ContentItem item = mod.getItem(); if(ContentType.MODULE.equals(item.getContentType())) { Assert.assertArrayEquals(moduleHash("base"), mod.getTargetHash()); Assert.assertArrayEquals(moduleHash("cp2"), item.getContentHash()); } else if(ContentType.MISC.equals(item.getContentType())) { Assert.assertArrayEquals(miscHash("base"), mod.getTargetHash()); Assert.assertArrayEquals(miscHash("cp2"), item.getContentHash());