use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class NugetInspectorPackagerTest method createCodeLocationDWService.
@Test(timeout = 5000L)
public void createCodeLocationDWService() throws IOException {
final File dependencyNodeFile = new File(getClass().getResource("/nuget/dwCheckApi_inspection_martin.json").getFile());
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final NugetInspectorPackager packager = new NugetInspectorPackager(gson, externalIdFactory);
final NugetParseResult result = packager.createDetectCodeLocation(dependencyNodeFile);
for (final DetectCodeLocation codeLocation : result.codeLocations) {
final BdioPropertyHelper bdioPropertyHelper = new BdioPropertyHelper();
final BdioNodeFactory bdioNodeFactory = new BdioNodeFactory(bdioPropertyHelper);
final DependencyGraphTransformer dependencyNodeTransformer = new DependencyGraphTransformer(bdioPropertyHelper, bdioNodeFactory);
final BdioExternalIdentifier projectId = bdioPropertyHelper.createExternalIdentifier(codeLocation.getExternalId());
final BdioProject project = bdioNodeFactory.createProject(result.projectName, result.projectVersion, Forge.NUGET.toString(), projectId);
final Map<ExternalId, BdioNode> components = new HashMap<>();
components.put(codeLocation.getExternalId(), project);
final List<BdioComponent> bdioComponents = dependencyNodeTransformer.transformDependencyGraph(codeLocation.getDependencyGraph(), project, codeLocation.getDependencyGraph().getRootDependencies(), components);
assertEquals(bdioComponents.size(), bdioComponents.size());
}
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory 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.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class RubygemsNodePackagerTest method findsAllVersions.
@Test
public void findsAllVersions() {
// Finds all versions of the package not just the first matching architecture.
final List<String> actualText = Arrays.asList(testUtils.getResourceAsUTF8String("/rubygems/Gemfile-rails.lock").split("\n"));
final GemlockParser rubygemsNodePackager = new GemlockParser(new ExternalIdFactory());
final DependencyGraph graph = rubygemsNodePackager.parseProjectDependencies(actualText);
assertNoDependency("nokogiri", "", graph);
assertDependency("nokogiri", "1.8.2", graph);
assertDependency("nokogiri", "1.8.2-java", graph);
assertDependency("nokogiri", "1.8.2-x86-mingw32", graph);
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class RubygemsNodePackagerTest method packagerTest.
@Test
public void packagerTest() {
final List<String> actualText = Arrays.asList(testUtils.getResourceAsUTF8String("/rubygems/Gemfile.lock").split("\n"));
final GemlockParser rubygemsNodePackager = new GemlockParser(new ExternalIdFactory());
final DependencyGraph projects = rubygemsNodePackager.parseProjectDependencies(actualText);
Assert.assertEquals(8, projects.getRootDependencies().size());
DependencyGraphResourceTestUtil.assertGraph("/rubygems/expectedPackager_graph.json", projects);
}
use of com.synopsys.integration.bdio.model.externalid.ExternalIdFactory in project hub-detect by blackducksoftware.
the class VndrParserTest method vndrParserTest.
@Test
public void vndrParserTest() throws IOException {
final TestUtil testUtil = new TestUtil();
final VndrParser vndrParser = new VndrParser(new ExternalIdFactory());
final String text = testUtil.getResourceAsUTF8String("/go/vendor.conf");
final List<String> vendorConfContents = Arrays.asList(text.split("\r?\n"));
final DependencyGraph dependencyGraph = vndrParser.parseVendorConf(vendorConfContents);
Assert.assertNotNull(dependencyGraph);
DependencyGraphResourceTestUtil.assertGraph("/go/Go_VndrExpected_graph.json", dependencyGraph);
}
Aggregations