Source:
public void testLog4jNameFound() throws Exception { String inputPath = "../../test-files/jee-example-app-1.0.0.ear"; final Path outputPath = getDefaultPath(); FileUtils.deleteDirectory(outputPath.toFile()); Files.createDirectories(outputPath); try (GraphContext context = factory.create(outputPath)) { final WindupConfiguration processorConfig = new WindupConfiguration(); processorConfig.setOptionValue(SourceModeOption.NAME, true); Predicate<RuleProvider> ruleFilter = new AndPredicate(new RuleProviderWithDependenciesPredicate(MigrationRulesPhase.class), new NotPredicate(new EnumeratedRuleProviderPredicate(DecompileClassesRuleProvider.class, BeforeDecompileClassesRuleProvider.class))); processorConfig.setRuleProviderFilter(ruleFilter); processorConfig.setGraphContext(context); processorConfig.addInputPath(Paths.get(inputPath)); processorConfig.setOutputDirectory(outputPath); processorConfig.setOptionValue(ScanPackagesOption.NAME, Collections.singletonList("")); processor.execute(processorConfig); ArchiveService archiveService = new ArchiveService(context); boolean manifestFound = false; boolean jarNameFound = false; boolean jarVersionFound = false; for (ArchiveModel archiveModel : archiveService.findAllByProperty(ArchiveModel.ARCHIVE_NAME, "log4j-1.2.6.jar")) { if (archiveModel instanceof DuplicateArchiveModel) archiveModel = ((DuplicateArchiveModel)archiveModel).getOriginalArchive(); JarManifestService jarManifestService = new JarManifestService(context); for (JarManifestModel manifest : jarManifestService.getManifestsByArchive(archiveModel)) { manifestFound = true; if ("log4j".equals(manifest.getName())) jarNameFound = true; if ("1.2.6".equals(manifest.getVersion())) jarVersionFound = true; } Assert.assertNotNull(archiveModel.getProjectModel()); Assert.assertEquals("log4j", archiveModel.getProjectModel().getName()); Assert.assertEquals("1.2.6", archiveModel.getProjectModel().getVersion()); } Assert.assertTrue(manifestFound); Assert.assertTrue(jarNameFound); Assert.assertTrue(jarVersionFound); } }

Target:
public void testLog4jNameFound() throws Exception { String inputPath = "../../test-files/jee-example-app-1.0.0.ear"; final Path outputPath = getDefaultPath(); FileUtils.deleteDirectory(outputPath.toFile()); Files.createDirectories(outputPath); try (GraphContext context = factory.create(outputPath)) { final WindupConfiguration processorConfig = new WindupConfiguration(); processorConfig.setOptionValue(SourceModeOption.NAME, true); Predicate<RuleProvider> ruleFilter = new AndPredicate(new RuleProviderWithDependenciesPredicate(MigrationRulesPhase.class), new NotPredicate(new EnumeratedRuleProviderPredicate(DecompileClassesRuleProvider.class, BeforeDecompileClassesRuleProvider.class))); processorConfig.setRuleProviderFilter(ruleFilter); processorConfig.setGraphContext(context); processorConfig.addInputPath(Paths.get(inputPath)); processorConfig.setOutputDirectory(outputPath); processorConfig.setOptionValue(ScanPackagesOption.NAME, Collections.singletonList("")); processor.execute(processorConfig); ArchiveService archiveService = new ArchiveService(context); boolean manifestFound = false; boolean jarNameFound = false; boolean jarVersionFound = false; for (ArchiveModel archiveModel : archiveService.findAllByProperty(ArchiveModel.ARCHIVE_NAME, "log4j-1.2.6.jar")) { if (archiveModel instanceof DuplicateArchiveModel) archiveModel = ((DuplicateArchiveModel)archiveModel).getCanonicalArchive(); JarManifestService jarManifestService = new JarManifestService(context); for (JarManifestModel manifest : jarManifestService.getManifestsByArchive(archiveModel)) { manifestFound = true; if ("log4j".equals(manifest.getName())) jarNameFound = true; if ("1.2.6".equals(manifest.getVersion())) jarVersionFound = true; } Assert.assertNotNull(archiveModel.getProjectModel()); Assert.assertEquals("log4j", archiveModel.getProjectModel().getName()); Assert.assertEquals("1.2.6", archiveModel.getProjectModel().getVersion()); } Assert.assertTrue(manifestFound); Assert.assertTrue(jarNameFound); Assert.assertTrue(jarVersionFound); } }