use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation in project hub-detect by blackducksoftware.
the class NugetInspectorPackagerTest method createCodeLocation.
private void createCodeLocation(final File dependencyNodeFile, final List<String> expectedOutputFiles) throws IOException {
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final NugetInspectorPackager packager = new NugetInspectorPackager(gson, externalIdFactory);
final NugetParseResult result = packager.createDetectCodeLocation(dependencyNodeFile);
for (int i = 0; i < expectedOutputFiles.size(); i++) {
final DetectCodeLocation codeLocation = result.codeLocations.get(i);
final String expectedOutputFile = expectedOutputFiles.get(i);
DependencyGraphResourceTestUtil.assertGraph(expectedOutputFile, codeLocation.getDependencyGraph());
}
}
use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation in project hub-detect by blackducksoftware.
the class GradleReportParserTest method complexTest.
@Test
public void complexTest() throws IOException {
final DetectCodeLocation codeLocation = build("src/test/resources/gradle/parse-tests/complex_dependencyGraph.txt");
final DependencyGraph graph = codeLocation.getDependencyGraph();
assertHasMavenGav(graph, "non-project:with-nested:1.0.0");
assertHasMavenGav(graph, "solo:component:4.12");
assertHasMavenGav(graph, "some.group:child:2.2.2");
assertHasMavenGav(graph, "terminal:child:6.2.3");
assertDoesNotHave(graph, "child-project");
assertDoesNotHave(graph, "nested-parent");
assertDoesNotHave(graph, "spring-webflux");
assertDoesNotHave(graph, "spring-beans");
assertDoesNotHave(graph, "spring-core");
assertDoesNotHave(graph, "spring-web");
assertDoesNotHave(graph, "should-suppress");
assertHasRootMavenGavs(graph, "solo:component:4.12", "non-project:with-nested:1.0.0", "some.group:parent:5.0.0", "terminal:child:6.2.3");
assertParentHasChildMavenGav("some.group:parent:5.0.0", graph, "some.group:child:2.2.2");
}
use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method createNewCodeLocationTest.
private void createNewCodeLocationTest(final String mavenOutputText, final String expectedResourcePath, final int numberOfCodeLocations, final String excludedModules, final String includedModules, int codeLocationIndex, final String scope) {
final MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
final List<MavenParseResult> result = mavenCodeLocationPackager.extractCodeLocations("/test/path", mavenOutputText, scope, excludedModules, includedModules);
assertEquals(numberOfCodeLocations, result.size());
final DetectCodeLocation codeLocation = result.get(codeLocationIndex).codeLocation;
testUtil.testJsonResource(expectedResourcePath, codeLocation);
}
use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation in project hub-detect by blackducksoftware.
the class NugetInspectorPackagerPerfTest method performanceTestNuget.
@Test(timeout = 120000L)
public void performanceTestNuget() throws IOException {
final File dependencyGraphFile = new File(getClass().getResource("/nuget/dwCheckApi_inspection.json").getFile());
final NugetInspectorPackager packager = new NugetInspectorPackager(gson, externalIdFactory);
final NugetParseResult result = packager.createDetectCodeLocation(dependencyGraphFile);
final DetectCodeLocation codeLocation = result.codeLocations.get(0);
final BdioPropertyHelper bdioPropertyHelper = new BdioPropertyHelper();
final BdioNodeFactory bdioNodeFactory = new BdioNodeFactory(bdioPropertyHelper);
final DependencyGraphTransformer dependencyGraphTransformer = new DependencyGraphTransformer(bdioPropertyHelper, bdioNodeFactory);
final BdioProject bdioNode = bdioNodeFactory.createProject("test", "1.0.0", "bdioId", externalIdFactory.createMavenExternalId("group", "name", "version"));
final List<BdioComponent> components = dependencyGraphTransformer.transformDependencyGraph(codeLocation.getDependencyGraph(), bdioNode, codeLocation.getDependencyGraph().getRootDependencies(), new HashMap<ExternalId, BdioNode>());
assertEquals(211, components.size());
}
use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation in project hub-detect by blackducksoftware.
the class GradleReportParserTest method testImplementationsGraph.
@Test
public void testImplementationsGraph() throws IOException {
final File file = new File("src/test/resources/gradle/gradle_implementations_dependencyGraph.txt");
final GradleReportParser gradleReportParser = new GradleReportParser(new ExternalIdFactory());
final Optional<DetectCodeLocation> result = gradleReportParser.parseDependencies(file);
assertTrue(result.isPresent());
System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(result.get()));
}
Aggregations