use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class NpmLockfileParserTest method init.
@Before
public void init() {
testUtil = new TestUtil();
npmLockfileParser = new NpmLockfileParser(new GsonBuilder().setPrettyPrinting().create(), new ExternalIdFactory());
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class PearDependencyTest method init.
@Before
public void init() {
detectConfiguration = Mockito.mock(DetectConfiguration.class);
pearParser = new PearParser(new ExternalIdFactory(), detectConfiguration);
testUtil = new TestUtil();
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class GoVendorJsonParserTest method test.
@Test
public void test() throws IOException {
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
GoVendorJsonParser parser = new GoVendorJsonParser(externalIdFactory);
File vendorJsonFile = new File("src/test/resources/go/vendor/vendor.json");
String vendorJsonContents = FileUtils.readFileToString(vendorJsonFile, StandardCharsets.UTF_8);
DependencyGraph graph = parser.parseVendorJson(new Gson(), vendorJsonContents);
assertEquals(2, graph.getRootDependencies().size());
boolean foundErrorsPkg = false;
boolean foundMathPkg = false;
for (Dependency dep : graph.getRootDependencies()) {
if ("github.com/pkg/errors".equals(dep.name)) {
foundErrorsPkg = true;
assertEquals("github.com/pkg/errors", dep.externalId.name);
assertEquals("059132a15dd08d6704c67711dae0cf35ab991756", dep.externalId.version);
}
if ("github.com/pkg/math".equals(dep.name)) {
foundMathPkg = true;
assertEquals("github.com/pkg/math", dep.externalId.name);
assertEquals("f2ed9e40e245cdeec72c4b642d27ed4553f90667", dep.externalId.version);
}
}
assertTrue(foundErrorsPkg);
assertTrue(foundMathPkg);
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory 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()));
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class GradleReportParserTest method build.
private DetectCodeLocation build(final String resource) throws IOException {
final File file = new File(resource);
final GradleReportParser gradleReportParser = new GradleReportParser(new ExternalIdFactory());
final Optional<DetectCodeLocation> result = gradleReportParser.parseDependencies(file);
if (result.isPresent()) {
return result.get();
} else {
return null;
}
}
Aggregations