update to ensure NodePackageAnalyzer will not run without a backing vulnerability analyzer

This commit is contained in:
Jeremy Long
2017-11-20 06:46:25 -05:00
parent a754a8e6b4
commit e4b7f7aa8f
8 changed files with 86 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ import java.io.File;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.dependency.EvidenceType;
/**
@@ -42,6 +43,7 @@ public class NodePackageAnalyzerTest extends BaseTest {
* The analyzer to test.
*/
private NodePackageAnalyzer analyzer;
private Engine engine;
/**
* Correctly setup the analyzer for testing.
@@ -52,14 +54,15 @@ public class NodePackageAnalyzerTest extends BaseTest {
@Override
public void setUp() throws Exception {
super.setUp();
engine = new Engine(this.getSettings());
analyzer = new NodePackageAnalyzer();
analyzer.setFilesMatched(true);
analyzer.initialize(getSettings());
analyzer.prepare(null);
analyzer.prepare(engine);
}
/**
* Cleanup the analyzer's temp files, etc.
* Cleanup temp files, close resources, etc.
*
* @throws Exception thrown if there is a problem
*/
@@ -67,6 +70,7 @@ public class NodePackageAnalyzerTest extends BaseTest {
@Override
public void tearDown() throws Exception {
analyzer.close();
engine.close();
super.tearDown();
}

View File

@@ -123,3 +123,5 @@ analyzer.nvdcve.enabled=true
analyzer.vulnerabilitysuppression.enabled=true
updater.nvdcve.enabled=true
updater.versioncheck.enabled=true
ecosystem.skip.nvdcve=npm