use of com.synopsys.integration.detectable.detectables.gradle.inspection.parse.GradleReportParser in project synopsys-detect by blackducksoftware.
the class GradleReportParserFunctionalTest method extractCodeLocationTest.
@Test
void extractCodeLocationTest() throws JSONException, IOException {
// Does not work on windows due to path issues.
Assumptions.assumeFalse(SystemUtils.IS_OS_WINDOWS);
GradleReportParser gradleReportParser = new GradleReportParser();
Optional<GradleReport> gradleReport = gradleReportParser.parseReport(FunctionalTestFiles.asFile("/gradle/dependencyGraph.txt"));
Assertions.assertTrue(gradleReport.isPresent());
GradleReportTransformer transformer = new GradleReportTransformer(EnumListFilter.excludeNone());
CodeLocation codeLocation = transformer.transform(gradleReport.get());
Assertions.assertNotNull(codeLocation);
Assertions.assertEquals("hub-detect", gradleReport.get().getProjectName());
Assertions.assertEquals("2.0.0-SNAPSHOT", gradleReport.get().getProjectVersionName());
String actual = new GsonBuilder().setPrettyPrinting().create().toJson(codeLocation);
JSONAssert.assertEquals(FunctionalTestFiles.asString("/gradle/dependencyGraph-expected.json"), actual, false);
}
use of com.synopsys.integration.detectable.detectables.gradle.inspection.parse.GradleReportParser in project synopsys-detect by blackducksoftware.
the class GradleReportParserFunctionalTest method buildCodeLocation.
private Optional<CodeLocation> buildCodeLocation(String resource, boolean includeUnresolvedConfigurations) {
File file = FunctionalTestFiles.asFile(resource);
GradleReportParser gradleReportParser = new GradleReportParser();
EnumListFilter<GradleConfigurationType> enumListFilter = EnumListFilter.excludeNone();
if (!includeUnresolvedConfigurations) {
enumListFilter = EnumListFilter.fromExcluded(GradleConfigurationType.UNRESOLVED);
}
GradleReportTransformer gradleReportTransformer = new GradleReportTransformer(enumListFilter);
return gradleReportParser.parseReport(file).map(gradleReportTransformer::transform);
}
Aggregations