Search in sources :

Example 1 with MavenParseOptions

use of com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseOptions 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)

Aggregations

DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 MavenParseExtractor (com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseExtractor)1 MavenParseOptions (com.synopsys.integration.detectable.detectables.maven.parsing.MavenParseOptions)1 Extraction (com.synopsys.integration.detectable.extraction.Extraction)1 File (java.io.File)1 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Arrays (java.util.Arrays)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 SAXParserFactory (javax.xml.parsers.SAXParserFactory)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 Test (org.junit.jupiter.api.Test)1