use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class YarnListParserTest method testThatYarnListWithOnlyTopLevelDependenciesIsParsedCorrectly.
@Test
public void testThatYarnListWithOnlyTopLevelDependenciesIsParsedCorrectly() {
final List<String> designedYarnLock = new ArrayList<>();
designedYarnLock.add("esprima@5.5.2:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add("");
designedYarnLock.add("extsprintf@5.5.2:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add("");
final List<String> testLines = new ArrayList<>();
testLines.add("├─ esprima@3.1.3");
testLines.add("└─ extsprintf@1.3.0");
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final YarnLockParser yarnLockParser = new YarnLockParser();
final YarnListParser yarnListParser = new YarnListParser(externalIdFactory, yarnLockParser);
final DependencyGraph dependencyGraph = yarnListParser.parseYarnList(designedYarnLock, testLines);
final List<ExternalId> tempList = new ArrayList<>(dependencyGraph.getRootDependencyExternalIds());
assertListContainsDependency("esprima", "3.1.3", tempList);
assertListContainsDependency("extsprintf", "1.3.0", tempList);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class YarnListParserTest method testThatYarnListWithGreatGrandchildrenIsParsedCorrectly.
@Test
public void testThatYarnListWithGreatGrandchildrenIsParsedCorrectly() {
final List<String> designedYarnLock = new ArrayList<>();
designedYarnLock.add("yargs-parser@5.5.2:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add("");
designedYarnLock.add("camelcase@^3.0.0:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add("");
designedYarnLock.add("ms@5.5.2:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add("");
final List<String> testLines = new ArrayList<>();
testLines.add("├─ yargs-parser@4.2.1");
testLines.add("│ └─ camelcase@^3.0.0");
testLines.add("│ │ └─ ms@0.7.2");
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final YarnLockParser yarnLockParser = new YarnLockParser();
final YarnListParser yarnListParser = new YarnListParser(externalIdFactory, yarnLockParser);
final DependencyGraph dependencyGraph = yarnListParser.parseYarnList(designedYarnLock, testLines);
final List<ExternalId> rootDependencies = new ArrayList<>(dependencyGraph.getRootDependencyExternalIds());
assertListContainsDependency("yargs-parser", "4.2.1", rootDependencies);
final List<ExternalId> childDependencies = new ArrayList<>(dependencyGraph.getChildrenExternalIdsForParent(rootDependencies.get(0)));
assertListContainsDependency("camelcase", "5.5.2", childDependencies);
final List<ExternalId> grandchildDependencies = new ArrayList<>(dependencyGraph.getChildrenExternalIdsForParent(childDependencies.get(0)));
assertListContainsDependency("ms", "0.7.2", grandchildDependencies);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class YarnListParserTest method parseYarnListWithResolvableVersions.
@Test
public void parseYarnListWithResolvableVersions() {
final List<String> designedYarnLock = new ArrayList<>();
designedYarnLock.add("ajv@5.5.2:");
designedYarnLock.add(" version \"5.5.2\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536\"");
designedYarnLock.add(" dependencies:");
designedYarnLock.add(" co \"^4.6.0\"");
designedYarnLock.add(" tr46 \"~0.0.3\"");
designedYarnLock.add(" cssstyle \">= 0.2.37 < 0.3.0\"");
designedYarnLock.add("");
designedYarnLock.add("co@^4.6.0:");
designedYarnLock.add(" version \"4.6.0\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184\"");
designedYarnLock.add(" dependencies:");
designedYarnLock.add(" hoek \"4.x.x\"");
designedYarnLock.add("");
designedYarnLock.add("tr46@~0.0.3:");
designedYarnLock.add(" version \"0.0.3\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a\"");
designedYarnLock.add("");
designedYarnLock.add("\"cssstyle@>= 0.2.37 < 0.3.0\":");
designedYarnLock.add(" version \"0.2.37\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54\"");
designedYarnLock.add(" dependencies:");
designedYarnLock.add(" cssom \"0.3.x\"");
designedYarnLock.add("hoek@4.x.x:");
designedYarnLock.add(" version \"4.2.1\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb\"");
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final YarnLockParser yarnLockParser = new YarnLockParser();
final YarnListParser yarnListParser = new YarnListParser(externalIdFactory, yarnLockParser);
final String yarnListText = testUtil.getResourceAsUTF8String("/yarn/yarn.list.res.txt");
final DependencyGraph dependencyGraph = yarnListParser.parseYarnList(designedYarnLock, Arrays.asList(yarnListText.split(System.lineSeparator())));
DependencyGraphResourceTestUtil.assertGraph("/yarn/list_expected_graph_2.json", dependencyGraph);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class GraphParserTransformerTest method transform.
@Test
public void transform() throws IOException {
final GraphParserTransformer graphParserTransformer = new GraphParserTransformer();
final InputStream inputStream = new ClassPathResource("/bitbake/recipe-depends.dot").getInputStream();
final GraphParser graphParser = new GraphParser(inputStream);
final DependencyGraph dependencyGraph = graphParserTransformer.transform(graphParser, "i586-poky-linux");
assert dependencyGraph.getRootDependencies().size() == 480;
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class CocoapodsPackagerTest method simpleTest.
@Test
public void simpleTest() throws IOException {
final String podlockText = testUtil.getResourceAsUTF8String("/cocoapods/simplePodfile.lock");
final DependencyGraph projectDependencies = podlockParser.extractDependencyGraph(podlockText);
DependencyGraphResourceTestUtil.assertGraph("/cocoapods/simpleExpected_graph.json", projectDependencies);
}
Aggregations