use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PoetryLockParserTest method testParseDependencies.
@Test
public void testParseDependencies() {
String input = String.join(System.lineSeparator(), Arrays.asList("[[package]]", "name = \"pytest-cov\"", "python-versions = \">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*\"", "version = \"2.8.1\"", "", "[package.dependencies]", "coverage = \">=4.4\"", "pytest = \">=3.6\"", "", "[[package]]", "name = \"coverage\"", "version = \"4.4\"", "", "[[package]]", "name = \"pytest\"", "version = \"3.7\""));
PoetryLockParser poetryLockParser = new PoetryLockParser();
DependencyGraph graph = poetryLockParser.parseLockFile(input);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, graph);
graphAssert.hasRootSize(1);
graphAssert.hasRootDependency("pytest-cov", "2.8.1");
graphAssert.hasParentChildRelationship("pytest-cov", "2.8.1", "coverage", "4.4");
graphAssert.hasParentChildRelationship("pytest-cov", "2.8.1", "pytest", "3.7");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testExcludeDevDependencies.
@Test
public void testExcludeDevDependencies() throws IntegrationException {
PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.DEV);
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
graphAssert.hasRootSize(3);
graphAssert.hasNoDependency("devDep", "2.0.0");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PnpmYamlTransformerTest method testExcludeDependencies.
@Test
public void testExcludeDependencies() throws IntegrationException {
PnpmLockYaml pnpmLockYaml = createPnpmLockYaml();
PnpmYamlTransformer transformer = createTransformer(PnpmDependencyType.APP);
DependencyGraph dependencyGraph = transformer.generateCodeLocation(pnpmLockYamlFile, pnpmLockYaml, projectNameVersion, linkedPackageResolver).getDependencyGraph();
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.NPMJS, dependencyGraph);
graphAssert.hasRootSize(2);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GemlockDetectableTest 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.RUBYGEMS, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("cocoapods", "1.2.1");
graphAssert.hasRootDependency("cocoapods-keys", "2.0.0");
graphAssert.hasDependency("RubyInline", "3.12.4");
graphAssert.hasParentChildRelationship("RubyInline", "3.12.4", "ZenTest", "4.11.1");
graphAssert.hasParentChildRelationship("activesupport", "4.2.8", "thread_safe", "0.3.6");
graphAssert.hasParentChildRelationship("cocoapods", "1.2.1", "activesupport", "4.2.8");
graphAssert.hasParentChildRelationship("cocoapods-keys", "2.0.0", "osx_keychain", "1.0.1");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class GemlockNodeParserTest method testMissingVersionsGemfileLock.
@Test
public void testMissingVersionsGemfileLock() throws MissingExternalIdException {
List<String> gemfileLockContents = Arrays.asList("GEM", " remote: https://artifactory.rds.lexmark.com/artifactory/api/gems/rubygems/", " remote: https://artifactory.rds.lexmark.com/artifactory/api/gems/enterprise-gem-IDP/", " specs:", " activesupport (4.2.7.1)", " thread_safe (~> 0.3, >= 0.3.4)", " tzinfo (~> 1.1)", " bullet (5.5.0)", " activesupport (>= 3.0.0)", " uniform_notifier (~> 1.10.0)", " devise (4.2.1)", " thread_safe (0.3.6-java)", " tzinfo (1.2.3)", " thread_safe (~> 0.1)", " uniform_notifier (1.10.0)", "", "PLATFORMS", " java", "", "DEPENDENCIES", " bullet (~> 5.5.0)", " devise (~> 4.2.1)");
GemlockParser gemlockNodeParser = new GemlockParser(new ExternalIdFactory());
DependencyGraph dependencyGraph = gemlockNodeParser.parseProjectDependencies(gemfileLockContents);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.RUBYGEMS, dependencyGraph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("bullet", "5.5.0");
graphAssert.hasRootDependency("devise", "4.2.1");
graphAssert.hasParentChildRelationship("bullet", "5.5.0", "activesupport", "4.2.7.1");
graphAssert.hasParentChildRelationship("activesupport", "4.2.7.1", "tzinfo", "1.2.3");
graphAssert.hasParentChildRelationship("tzinfo", "1.2.3", "thread_safe", "0.3.6-java");
graphAssert.hasParentChildRelationship("bullet", "5.5.0", "uniform_notifier", "1.10.0");
}
Aggregations