use of com.synopsys.integration.bdio.model.dependency.Dependency 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.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testLineWithBadColonPlacement.
@Test
public void testLineWithBadColonPlacement() {
final MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
String line = "[INFO] | | | \\- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:jar:3.8.0.v20160509-0411:pants (version selected from: [3.8.0,3.8.1))";
line = mavenCodeLocationPackager.trimLogLevel(line);
final String cleanedLine = mavenCodeLocationPackager.calculateCurrentLevelAndCleanLine(line);
final Dependency dependency = mavenCodeLocationPackager.textToDependency(cleanedLine);
assertEquals("org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:pants (version selected from", dependency.externalId.createExternalId());
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testLineWithExtraTextAfterScope.
@Test
public void testLineWithExtraTextAfterScope() {
final MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
String line = "[INFO] | | | \\- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:jar:3.8.0.v20160509-0411:compile (version selected from constraint [3.8.0,3.8.1))";
line = mavenCodeLocationPackager.trimLogLevel(line);
final String cleanedLine = mavenCodeLocationPackager.calculateCurrentLevelAndCleanLine(line);
final Dependency dependency = mavenCodeLocationPackager.textToDependency(cleanedLine);
assertEquals("org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:3.8.0.v20160509-0411", dependency.externalId.createExternalId());
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class CondaListParserTest method condaListElementToDependencyNodeTransformerTest.
@Test
public void condaListElementToDependencyNodeTransformerTest() {
final String platform = "linux";
final CondaListElement element = new CondaListElement();
element.name = "sampleName";
element.version = "sampleVersion";
element.buildString = "py36_0";
final Dependency dependency = condaListParser.condaListElementToDependency(platform, element);
assertEquals("sampleName", dependency.name);
assertEquals("sampleVersion-py36_0-linux", dependency.version);
assertEquals("sampleName=sampleVersion-py36_0-linux", dependency.externalId.createExternalId());
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class GoVendorExtractorTest method test.
@Test
public void test() {
GoVendorExtractor extractor = new GoVendorExtractor(new Gson(), new ExternalIdFactory());
Extraction extraction = extractor.extract(new File("src/test/resources/go"), new File("src/test/resources/go/vendor/vendor.json"));
DependencyGraph graph = extraction.codeLocations.get(0).getDependencyGraph();
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);
}
Aggregations