use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class NugetProjectInspectorTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
List<CodeLocation> codeLocations = extraction.getCodeLocations();
Assertions.assertEquals(2, codeLocations.size());
Assertions.assertEquals(new File("C:\\Users\\jordanp\\source\\repos\\ConsoleApp3\\ConsoleApp1\\ConsoleApp1.csproj"), codeLocations.get(0).getSourcePath().orElse(null));
Assertions.assertEquals(new File("C:\\Users\\jordanp\\source\\repos\\ConsoleApp3\\ConsoleApp3\\ConsoleApp3.csproj"), codeLocations.get(1).getSourcePath().orElse(null));
NameVersionGraphAssert consoleApp1 = new NameVersionGraphAssert(Forge.NUGET, codeLocations.get(0).getDependencyGraph());
consoleApp1.hasDependency("DocumentFormat.OpenXml", "2.13.0");
NameVersionGraphAssert consoleApp3 = new NameVersionGraphAssert(Forge.NUGET, codeLocations.get(1).getDependencyGraph());
consoleApp3.hasDependency("Newtonsoft.Json.Bson", "1.0.2");
consoleApp3.hasDependency("Serilog", "2.10.0");
consoleApp3.hasParentChildRelationship("Newtonsoft.Json.Bson", "1.0.2", "Newtonsoft.Json", "12.0.1");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PackagistDetectableTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
Assertions.assertNotEquals(0, extraction.getCodeLocations().size(), "A code location should have been generated.");
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PACKAGIST, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("clue/graph", "v0.9.0");
graphAssert.hasRootDependency("graphp/graphviz", "v0.2.1");
graphAssert.hasParentChildRelationship("graphp/algorithms", "v0.8.1", "clue/graph", "v0.9.0");
graphAssert.hasParentChildRelationship("graphp/graphviz", "v0.2.1", "graphp/algorithms", "v0.8.1");
graphAssert.hasParentChildRelationship("graphp/graphviz", "v0.2.1", "clue/graph", "v0.9.0");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class RebarDetectableTest method assertExtraction.
@Override
public void assertExtraction(@NotNull Extraction extraction) {
Assertions.assertNotEquals(0, extraction.getCodeLocations().size(), "A code location should have been generated.");
Assertions.assertEquals("project", extraction.getProjectName(), "A rebar tree includes project info. Project name expected.");
Assertions.assertEquals("1.0.0", extraction.getProjectVersion(), "A rebar tree includes project info. Project version name expected.");
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.HEX, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("git_inner_parent_dependency", "0.0.2");
graphAssert.hasRootDependency("git_outer_parent_dependency", "0.0.7");
graphAssert.hasParentChildRelationship("git_inner_parent_dependency", "0.0.2", "hex_inner_child_dependency", "0.3.0");
graphAssert.hasParentChildRelationship("git_outer_parent_dependency", "0.0.7", "git_outer_child_dependency", "0.8.0");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GemlockNodeParserTest method testParsingEqualsGemfileLock.
@Test
public void testParsingEqualsGemfileLock() throws MissingExternalIdException {
List<String> gemfileLockContents = Arrays.asList("GEM", " remote: https://artifactory.ilabs.io/artifactory/api/gems/gem-public/", " specs:", " SyslogLogger (2.0)", " activesupport (4.1.15)", " json (~> 1.7, >= 1.7.7)", " json (1.8.6)", "", "PLATFORMS", " ruby", "", "DEPENDENCIES", " SyslogLogger (~> 2.0)", " activesupport (~> 4.1.15)");
GemlockParser gemlockNodeParser = new GemlockParser(new ExternalIdFactory());
DependencyGraph dependencyGraph = gemlockNodeParser.parseProjectDependencies(gemfileLockContents);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.RUBYGEMS, dependencyGraph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("activesupport", "4.1.15");
graphAssert.hasRootDependency("SyslogLogger", "2.0");
graphAssert.hasParentChildRelationship("activesupport", "4.1.15", "json", "1.8.6");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class RubygemsNodePackagerTest method findsAllVersions.
@Test
void findsAllVersions() throws MissingExternalIdException {
// Finds all versions of the package not just the first matching architecture.
List<String> actualText = Arrays.asList("GEM", " remote: https://rubygems.org/", " specs:", " nokogiri (1.8.2)", " mini_portile2 (~> 2.3.0)", " nokogiri (1.8.2-java)", " nokogiri (1.8.2-x86-mingw32)", " nokoparent (3.1.0)", " nokogiri (~> 1.8)", "", "PLATFORMS", " java", " ruby", " x86-mingw32", "", "DEPENDENCIES", " nokoparent (>= 1)", " nokogiri (>= 1.8.1)");
GemlockParser rubygemsNodePackager = new GemlockParser(new ExternalIdFactory());
DependencyGraph graph = rubygemsNodePackager.parseProjectDependencies(actualText);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.RUBYGEMS, graph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("nokoparent", "3.1.0");
graphAssert.hasRootDependency("nokogiri", "1.8.2");
graphAssert.hasNoDependency("nokogiri", "");
graphAssert.hasDependency("nokogiri", "1.8.2");
graphAssert.hasDependency("nokogiri", "1.8.2-java");
graphAssert.hasDependency("nokogiri", "1.8.2-x86-mingw32");
graphAssert.hasParentChildRelationship("nokoparent", "3.1.0", "nokogiri", "1.8.2");
graphAssert.hasParentChildRelationship("nokogiri", "1.8.2", "mini_portile2", "");
}
Aggregations