use of com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseExtractor in project synopsys-detect by blackducksoftware.
the class MavenParsePluginDependenciesTest method testIncludingPluginDependencies.
@Test
public void testIncludingPluginDependencies() throws Exception {
MavenParseExtractor pomXmlParser = new MavenParseExtractor(SAXParserFactory.newInstance().newSAXParser());
Extraction extraction = pomXmlParser.extract(getInput(), new MavenParseOptions(true, true));
DependencyGraph dependencyGraph = extraction.getCodeLocations().get(0).getDependencyGraph();
Set<String> externalIds = dependencyGraph.getRootDependencies().stream().map(dependency -> dependency.getExternalId().createExternalId()).collect(Collectors.toSet());
assertTrue(externalIds.containsAll(getPluginDependencies()));
}
Also used :
MavenParseExtractor(com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseExtractor)
MavenParseExtractor(com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseExtractor)
Arrays(java.util.Arrays)
DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph)
Files(java.nio.file.Files)
Extraction(com.synopsys.integration.detectable.extraction.Extraction)
SAXParserFactory(javax.xml.parsers.SAXParserFactory)
Set(java.util.Set)
IOException(java.io.IOException)
MavenParseOptions(com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseOptions)
Collectors(java.util.stream.Collectors)
File(java.io.File)
HashSet(java.util.HashSet)
Test(org.junit.jupiter.api.Test)
List(java.util.List)
Paths(java.nio.file.Paths)
Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue)
Path(java.nio.file.Path)
MavenParseOptions(com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseOptions)
Extraction(com.synopsys.integration.detectable.extraction.Extraction)
DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph)
Test(org.junit.jupiter.api.Test)