use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackagerTest method testParseProject.
@Test
public void testParseProject() {
final MavenCodeLocationPackager mavenCodeLocationPackager = new MavenCodeLocationPackager(new ExternalIdFactory());
Dependency dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:0.0.1");
assertNotNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:classifier:0.0.1");
assertNotNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar");
assertNull(dependency);
dependency = mavenCodeLocationPackager.textToProject("stuff:things:jar:classifier:0.0.1:monkey");
assertNull(dependency);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class ClangExtractorTest method checkGeneratedDependenciesComplex.
private void checkGeneratedDependenciesComplex(Extraction extraction) {
final Set<Dependency> dependencies = extraction.codeLocations.get(0).getDependencyGraph().getRootDependencies();
assertEquals(6, dependencies.size());
for (final Dependency dependency : dependencies) {
System.out.printf("Checking dependency: %s:%s / %s\n", dependency.name, dependency.version, dependency.externalId.forge.getName());
final char indexChar = dependency.name.charAt(15);
assertTrue(indexChar == '1' || indexChar == '2' || indexChar == '3');
final String forge = dependency.externalId.forge.getName();
assertTrue("centos".equals(forge) || "fedora".equals(forge) || "redhat".equals(forge));
assertEquals(String.format("testPackageName%c", indexChar), dependency.name);
assertEquals(String.format("testPackageVersion%c", indexChar), dependency.version);
assertEquals(String.format("testPackageArch%c", indexChar), dependency.externalId.architecture);
assertEquals(forge, dependency.externalId.forge.getName());
assertEquals(null, dependency.externalId.group);
assertEquals(String.format("testPackageName%c", indexChar), dependency.externalId.name);
assertEquals(null, dependency.externalId.path);
assertEquals(String.format("testPackageVersion%c", indexChar), dependency.externalId.version);
}
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class ClangExtractorTest method checkGeneratedDependenciesSimple.
private void checkGeneratedDependenciesSimple(Extraction extraction) {
boolean ubuntuComponentVerified = false;
Set<Dependency> dependencies = extraction.codeLocations.get(0).getDependencyGraph().getRootDependencies();
Iterator<Dependency> iter = dependencies.iterator();
while (iter.hasNext()) {
Dependency dependency = iter.next();
System.out.printf("Checking dependency %s\n", dependency.externalId);
if ("ubuntu".equals(dependency.externalId.forge.getName())) {
assertEquals("testPackageName", dependency.name);
assertEquals("testPackageVersion", dependency.version);
assertEquals("testPackageArch", dependency.externalId.architecture);
assertEquals("ubuntu", dependency.externalId.forge.getName());
assertEquals(null, dependency.externalId.group);
assertEquals("testPackageName", dependency.externalId.name);
assertEquals(null, dependency.externalId.path);
assertEquals("testPackageVersion", dependency.externalId.version);
ubuntuComponentVerified = true;
}
}
assertTrue(ubuntuComponentVerified);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class GradleReportLineTest method assertDependency.
private void assertDependency(final String line, final String[] expectedResults) {
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final GradleReportLine gradleReportLine = new GradleReportLine(line);
final Dependency dependency = gradleReportLine.createDependencyNode(externalIdFactory);
Assert.assertEquals(expectedResults[0], dependency.name);
Assert.assertEquals(expectedResults[1], dependency.version);
Assert.assertEquals(expectedResults[2], dependency.externalId.createExternalId());
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class RebarParserTest method testCreateDependencyFromLine.
@Test
public void testCreateDependencyFromLine() {
final String expectedName = "cf";
final String expectedVersion = "0.2.2";
final ExternalId expectedExternalId = externalIdFactory.createNameVersionExternalId(Forge.HEX, expectedName, expectedVersion);
final Dependency actualDependency = rebar3TreeParser.createDependencyFromLine(" \u2502 \u2502 \u2514\u2500 cf\u25000.2.2 (hex package)");
assertEquals(expectedName, actualDependency.name);
assertEquals(expectedVersion, actualDependency.version);
assertEquals(expectedExternalId.name, actualDependency.externalId.name);
assertEquals(expectedExternalId.version, actualDependency.externalId.version);
}
Aggregations