use of com.synopsys.integration.bdio.BdioNodeFactory 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.BdioNodeFactory in project hub-detect by blackducksoftware.
the class NugetInspectorPackagerPerfTest method performanceTestNuget.
@Test(timeout = 120000L)
public void performanceTestNuget() throws IOException {
final File dependencyGraphFile = new File(getClass().getResource("/nuget/dwCheckApi_inspection.json").getFile());
final NugetInspectorPackager packager = new NugetInspectorPackager(gson, externalIdFactory);
final NugetParseResult result = packager.createDetectCodeLocation(dependencyGraphFile);
final DetectCodeLocation codeLocation = result.codeLocations.get(0);
final BdioPropertyHelper bdioPropertyHelper = new BdioPropertyHelper();
final BdioNodeFactory bdioNodeFactory = new BdioNodeFactory(bdioPropertyHelper);
final DependencyGraphTransformer dependencyGraphTransformer = new DependencyGraphTransformer(bdioPropertyHelper, bdioNodeFactory);
final BdioProject bdioNode = bdioNodeFactory.createProject("test", "1.0.0", "bdioId", externalIdFactory.createMavenExternalId("group", "name", "version"));
final List<BdioComponent> components = dependencyGraphTransformer.transformDependencyGraph(codeLocation.getDependencyGraph(), bdioNode, codeLocation.getDependencyGraph().getRootDependencies(), new HashMap<ExternalId, BdioNode>());
assertEquals(211, components.size());
}
Aggregations