use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PipfileLockDetectableTest 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.PYPI, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(3);
graphAssert.hasRootDependency("asgiref", "3.5.0");
graphAssert.hasRootDependency("crispy-bootstrap5", "0.6");
graphAssert.hasRootDependency("flake8", "4.0.1");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class PipInspectorTreeParserTest method validTest.
@Test
public void validTest() {
List<String> pipInspectorOutput = Arrays.asList("projectName==projectVersionName", " with-dashes==1.0.0", " Uppercase==2.0.0", " child==3.0.0", " test==4.0.0");
Optional<NameVersionCodeLocation> validParse = parser.parse(pipInspectorOutput, "");
Assertions.assertTrue(validParse.isPresent());
Assertions.assertEquals("projectName", validParse.get().getProjectName());
Assertions.assertEquals("projectVersionName", validParse.get().getProjectVersion());
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.PYPI, validParse.get().getCodeLocation().getDependencyGraph());
graphAssert.hasRootDependency("with-dashes", "1.0.0");
graphAssert.hasRootDependency("Uppercase", "2.0.0");
graphAssert.hasRootDependency("test", "4.0.0");
graphAssert.hasParentChildRelationship("Uppercase", "2.0.0", "child", "3.0.0");
graphAssert.hasRootSize(3);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class CargoLockPackageTransformerTest method testParsesNamesAndVersionsSimple.
@Test
public void testParsesNamesAndVersionsSimple() throws DetectableException, MissingExternalIdException, CycleDetectedException {
List<CargoLockPackage> input = new ArrayList<>();
input.add(createPackage("test1", "1.0.0"));
input.add(createPackage("test2", "2.0.0"));
CargoLockPackageTransformer cargoLockPackageTransformer = new CargoLockPackageTransformer();
DependencyGraph graph = cargoLockPackageTransformer.transformToGraph(input);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.CRATES, graph);
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("test1", "1.0.0");
graphAssert.hasRootDependency("test2", "2.0.0");
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class CargoLockPackageTransformerTest method testCorrectNumberOfRootDependencies.
@Test
public void testCorrectNumberOfRootDependencies() throws DetectableException, MissingExternalIdException {
List<CargoLockPackage> input = new ArrayList<>();
input.add(createPackage("test1", "1.0.0", new NameOptionalVersion("dep1"), new NameOptionalVersion("dep2")));
input.add(createPackage("dep1", "0.5.0"));
input.add(createPackage("dep2", "0.6.0"));
CargoLockPackageTransformer cargoLockPackageTransformer = new CargoLockPackageTransformer();
DependencyGraph graph = cargoLockPackageTransformer.transformToGraph(input);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.CRATES, graph);
graphAssert.hasRootDependency("test1", "1.0.0");
graphAssert.hasRootDependency("dep1", "0.5.0");
graphAssert.hasRootDependency("dep2", "0.6.0");
graphAssert.hasRootSize(3);
}
use of com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert in project synopsys-detect by blackducksoftware.
the class CarthageDeclarationTransformerTest method happyCase.
@Test
void happyCase() {
CarthageDeclarationTransformer transformer = new CarthageDeclarationTransformer();
List<CarthageDeclaration> carthageDeclarations = Arrays.asList(new CarthageDeclaration("github", "some-name/resource", "some-version"), new CarthageDeclaration("github", "different-name/resource", "other-version"));
DependencyGraph graph = transformer.transform(carthageDeclarations);
NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.GITHUB, graph);
graphAssert.hasRootDependency("some-name/resource", "some-version");
graphAssert.hasRootDependency("different-name/resource", "other-version");
graphAssert.hasRootSize(2);
}
Aggregations