Skip to content

Commit

Permalink
fix: maven dependencies are sent as object; package name is only grou…
Browse files Browse the repository at this point in the history
…pId and artifactId
  • Loading branch information
Dror Ben-Gai authored and darscan committed Jan 5, 2017
1 parent 11c8b6f commit dfbf1a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/module-info/maven/mvn-tree-parse.js
Expand Up @@ -45,7 +45,7 @@ function assemblePackage(source, projectDeps) {
if (sourceDeps) {
for (var i = 0; i < sourceDeps.length; i++) {
var pkg = assemblePackage(sourceDeps[i], projectDeps);
sourcePackage.dependencies.push(pkg);
sourcePackage.dependencies[pkg.name] = pkg;
}
}
return sourcePackage;
Expand All @@ -62,8 +62,8 @@ function createPackage(pkgStr) {
artifactId: parts[1],
packaging: parts[2],
version: parts[3],
name: parts[0] + ':' + parts[1] + ':' + parts[2],
dependencies: [],
name: parts[0] + ':' + parts[1],
dependencies: {},
};
if (parts.length === 5) {
result.scope = parts[4];
Expand Down
10 changes: 6 additions & 4 deletions test/acceptance/cli.acceptance.test.js
Expand Up @@ -190,8 +190,9 @@ function(t) {
t.equal(req.method, 'POST', 'makes POST request');
t.match(req.url, '/vuln/maven', 'posts to correct url');
t.equal(pkg.artifactId, 'maven-app', 'specifies artifactId');
t.equal(pkg.dependencies.length, 1, 'specifies dependency list');
t.equal(pkg.dependencies[0].artifactId, 'junit', 'specifies dependency');
t.ok(pkg.dependencies['junit:junit'], 'specifies dependency');
t.equal(pkg.dependencies['junit:junit'].artifactId, 'junit',
'specifies dependency artifactId');
});
});

Expand Down Expand Up @@ -241,8 +242,9 @@ test('`monitor maven-app`', function(t) {
t.equal(req.method, 'PUT', 'makes PUT request');
t.match(req.url, '/monitor/maven', 'puts at correct url');
t.equal(pkg.artifactId, 'maven-app', 'specifies artifactId');
t.equal(pkg.dependencies.length, 1, 'specifies dependency list');
t.equal(pkg.dependencies[0].artifactId, 'junit', 'specifies dependency');
t.ok(pkg.dependencies['junit:junit'], 'specifies dependency');
t.equal(pkg.dependencies['junit:junit'].artifactId, 'junit',
'specifies dependency artifactId');
});
});

Expand Down

0 comments on commit dfbf1a4

Please sign in to comment.