use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class GradleReportParserFunctionalTest method testUnresolvedConfigurations.
@Test
void testUnresolvedConfigurations() {
Optional<CodeLocation> codeLocation = buildCodeLocation("/gradle/gradle_implementations_dependencyGraph.txt", false);
Assertions.assertTrue(codeLocation.isPresent());
DependencyGraph dependencyGraph = codeLocation.get().getDependencyGraph();
GraphAssert graphAssert = new GraphAssert(Forge.MAVEN, dependencyGraph);
graphAssert.hasRootSize(0);
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(codeLocation.get()));
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class GradleReportParserFunctionalTest method testImplementationsGraph.
@Test
void testImplementationsGraph() {
Optional<CodeLocation> codeLocation = buildCodeLocation("/gradle/gradle_implementations_dependencyGraph.txt", true);
Assertions.assertTrue(codeLocation.isPresent());
DependencyGraph dependencyGraph = codeLocation.get().getDependencyGraph();
GraphAssert graphAssert = new GraphAssert(Forge.MAVEN, dependencyGraph);
graphAssert.hasRootSize(7);
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(codeLocation.get()));
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class FinalStepTransformJsonProtoHaskellCabalLibrariesToHackageTest method testStep.
@Test
public void testStep() throws IntegrationException, IOException {
File jsonProtoFile = new File("src/test/resources/detectables/functional/bazel/jsonProtoForHaskellCabalLibraries.txt");
String jsonProtoHaskellCabalLibrary = FileUtils.readFileToString(jsonProtoFile, StandardCharsets.UTF_8);
FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage step = new FinalStepTransformJsonProtoHaskellCabalLibrariesToHackage(new HaskellCabalLibraryJsonProtoParser(new Gson()), new ExternalIdFactory());
List<String> input = new ArrayList<>(1);
input.add(jsonProtoHaskellCabalLibrary);
List<Dependency> dependencies = step.finish(input);
DependencyGraph dependencyGraph = new BasicDependencyGraph();
for (Dependency dependency : dependencies) {
dependencyGraph.addChildToRoot(dependency);
}
Forge hackageForge = new Forge("/", "hackage");
GraphAssert graphAssert = new GraphAssert(hackageForge, dependencyGraph);
graphAssert.hasRootSize(1);
ExternalId expectedExternalId = new ExternalIdFactory().createNameVersionExternalId(hackageForge, "colour", "2.3.5");
graphAssert.hasRootDependency(expectedExternalId);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class PackageResolvedTransformerTest method testHttpWithGit.
@Test
void testHttpWithGit() {
ResolvedPackage auth0Package = new ResolvedPackage("Auth0", "http://github.com/auth0/Auth0.swift.git", new PackageState(null, "8e8a6b0337a27a3342beb72b5407141fdd4a7860", "1.35.0"));
PackageResolved packageResolved = createPackageResolved(auth0Package);
PackageResolvedTransformer transformer = new PackageResolvedTransformer(externalIdFactory);
DependencyGraph dependencyGraph = transformer.transform(packageResolved);
GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
ExternalId auth0 = externalIdFactory.createNameVersionExternalId(Forge.GITHUB, "auth0/Auth0.swift", "1.35.0");
graphAssert.hasRootDependency(auth0);
graphAssert.hasRootSize(1);
}
use of com.synopsys.integration.detectable.util.graph.GraphAssert in project synopsys-detect by blackducksoftware.
the class PackageResolvedTransformerTest method testHttpsWithGit.
@Test
void testHttpsWithGit() {
ResolvedPackage swiftCollectionsPackage = new ResolvedPackage("swift-collections", "https://github.com/apple/swift-collections.git", new PackageState(null, "2d33a0ea89c961dcb2b3da2157963d9c0370347e", "1.0.1"));
PackageResolved packageResolved = createPackageResolved(swiftCollectionsPackage);
PackageResolvedTransformer transformer = new PackageResolvedTransformer(externalIdFactory);
DependencyGraph dependencyGraph = transformer.transform(packageResolved);
GraphAssert graphAssert = new GraphAssert(Forge.GITHUB, dependencyGraph);
ExternalId swiftCollections = externalIdFactory.createNameVersionExternalId(Forge.GITHUB, "apple/swift-collections", "1.0.1");
graphAssert.hasRootDependency(swiftCollections);
graphAssert.hasRootSize(1);
}
Aggregations