updated test cases to track down build issue

This commit is contained in:
Jeremy Long
2016-04-30 10:56:50 -04:00
parent abebecac4a
commit 9e46364759
31 changed files with 55 additions and 313 deletions

View File

@@ -31,8 +31,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An abstract database test case that is used to ensure the H2 DB exists prior to performing tests that utilize the data
* contained within.
* An abstract database test case that is used to ensure the H2 DB exists prior
* to performing tests that utilize the data contained within.
*
* @author Jeremy Long
*/
@@ -49,6 +49,11 @@ public abstract class BaseDBTestCase extends BaseTest {
public static void ensureDBExists() throws Exception {
File f = new File("./target/data/dc.h2.db");
if (f.exists() && f.isFile() && f.length() < 71680) {
f.delete();
}
java.io.File dataPath = Settings.getDataDirectory();
String fileName = Settings.getString(Settings.KEYS.DB_FILE_NAME);
LOGGER.trace("DB file name {}", fileName);

View File

@@ -39,7 +39,7 @@ public class BaseTest {
if (f.exists() && f.isFile() && f.length() < 71680) {
System.err.println("------------------------------------------------");
System.err.println("------------------------------------------------");
System.err.println("I broke the build");
System.err.println("Test referenced CveDB() and does not extend BaseDbTestCases?");
System.err.println("------------------------------------------------");
System.err.println("------------------------------------------------");
}

View File

@@ -30,16 +30,7 @@ import org.owasp.dependencycheck.utils.Settings;
*
* @author Jeremy Long
*/
public class EngineIntegrationTest extends BaseTest {
@Before
public void setUp() throws Exception {
org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists();
}
@After
public void tearDown() {
}
public class EngineIntegrationTest extends BaseDBTestCase {
/**
* Test running the entire engine.

View File

@@ -20,13 +20,13 @@ package org.owasp.dependencycheck.analyzer;
import java.util.Iterator;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.BaseDBTestCase;
/**
*
* @author Jeremy Long
*/
public class AnalyzerServiceTest extends BaseTest {
public class AnalyzerServiceTest extends BaseDBTestCase {
/**
* Test of getAnalyzers method, of class AnalyzerService.

View File

@@ -55,6 +55,7 @@ public class ComposerLockAnalyzerTest extends BaseDBTestCase {
*/
@Before
public void setUp() throws Exception {
super.setUp();
analyzer = new ComposerLockAnalyzer();
analyzer.setFilesMatched(true);
analyzer.initialize();

View File

@@ -18,6 +18,7 @@ package org.owasp.dependencycheck.analyzer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.dependency.Dependency;
@@ -25,7 +26,7 @@ import org.owasp.dependencycheck.dependency.Dependency;
*
* @author Jeremy Long
*/
public class FalsePositiveAnalyzerTest {
public class FalsePositiveAnalyzerTest extends BaseTest {
/**
* Test of getName method, of class FalsePositiveAnalyzer.

View File

@@ -28,7 +28,7 @@ import org.owasp.dependencycheck.dependency.Dependency;
*
* @author Jeremy Long
*/
public class FileNameAnalyzerTest {
public class FileNameAnalyzerTest extends BaseTest {
/**
* Test of getName method, of class FileNameAnalyzer.

View File

@@ -25,11 +25,12 @@ import java.io.InputStream;
import java.nio.charset.Charset;
import static org.junit.Assert.*;
import org.owasp.dependencycheck.BaseTest;
/**
* Created by colezlaw on 9/5/15.
*/
public class ComposerLockParserTest {
public class ComposerLockParserTest extends BaseTest {
private InputStream inputStream;

View File

@@ -19,12 +19,13 @@ package org.owasp.dependencycheck.data.cpe;
import org.junit.Assert;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class IndexEntryTest {
public class IndexEntryTest extends BaseTest {
/**
* Test of setName method, of class IndexEntry.

View File

@@ -23,31 +23,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class CweDBTest {
public CweDBTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class CweDBTest extends BaseTest {
/**
* Method to serialize the CWE HashMap. This is not used in production; this is only used once during dev to create

View File

@@ -43,28 +43,13 @@ import static org.junit.Assert.assertFalse;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class FieldAnalyzerTest {
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class FieldAnalyzerTest extends BaseTest {
@Test
public void testAnalyzers() throws Exception {

View File

@@ -23,28 +23,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class LuceneUtilsTest {
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class LuceneUtilsTest extends BaseTest {
/**
* Test of appendEscapedLuceneQuery method, of class LuceneUtils.

View File

@@ -39,14 +39,6 @@ import org.junit.Test;
*/
public class TokenPairConcatenatingFilterTest extends BaseTokenStreamTestCase {
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Override
@Before
public void setUp() throws Exception {

View File

@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.dependency.Vulnerability;
import org.owasp.dependencycheck.dependency.VulnerableSoftware;
import org.owasp.dependencycheck.utils.Settings;
@@ -33,25 +34,7 @@ import org.owasp.dependencycheck.utils.Settings;
*
* @author Jeremy Long
*/
public class CveDBMySQLTest {
@BeforeClass
public static void setUpClass() {
Settings.initialize();
}
@AfterClass
public static void tearDownClass() {
Settings.cleanup();
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
public class CveDBMySQLTest extends BaseTest {
/**
* Pretty useless tests of open, commit, and close methods, of class CveDB.

View File

@@ -33,26 +33,7 @@ import org.owasp.dependencycheck.BaseTest;
*
* @author Jeremy Long
*/
public class DriverLoaderTest {
public DriverLoaderTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class DriverLoaderTest extends BaseTest {
/**
* Test of load method, of class DriverLoader.
@@ -71,7 +52,8 @@ public class DriverLoaderTest {
}
/**
* Test of load method, of class DriverLoader; expecting an exception due to a bad driver class name.
* Test of load method, of class DriverLoader; expecting an exception due to
* a bad driver class name.
*/
@Test(expected = DriverLoadException.class)
public void testLoad_String_ex() throws Exception {

View File

@@ -36,26 +36,7 @@ import org.owasp.dependencycheck.dependency.VulnerableSoftware;
*
* @author Jeremy Long
*/
public class NvdCve_1_2_HandlerTest {
public NvdCve_1_2_HandlerTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class NvdCve_1_2_HandlerTest extends BaseTest {
@Test
public void testParse() throws Exception {

View File

@@ -33,26 +33,7 @@ import org.owasp.dependencycheck.BaseTest;
*
* @author Jeremy Long
*/
public class NvdCve_2_0_HandlerTest {
public NvdCve_2_0_HandlerTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class NvdCve_2_0_HandlerTest extends BaseTest {
@Test
public void testParse() {

View File

@@ -35,26 +35,7 @@ import org.owasp.dependencycheck.data.nexus.MavenArtifact;
*
* @author Jeremy Long
*/
public class DependencyTest {
public DependencyTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class DependencyTest extends BaseTest {
/**
* Test of getFileName method, of class Dependency.

View File

@@ -20,12 +20,13 @@ package org.owasp.dependencycheck.dependency;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class EvidenceTest {
public class EvidenceTest extends BaseTest {
/**
* Test of equals method, of class Evidence.

View File

@@ -23,31 +23,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class VulnerableSoftwareTest {
public VulnerableSoftwareTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class VulnerableSoftwareTest extends BaseTest {
/**
* Test of equals method, of class VulnerableSoftware.

View File

@@ -26,6 +26,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.junit.Before;
import org.junit.Test;
import org.owasp.dependencycheck.BaseDBTestCase;
import org.owasp.dependencycheck.BaseTest;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.data.nvdcve.CveDB;
@@ -36,12 +37,7 @@ import org.owasp.dependencycheck.utils.Settings;
*
* @author Jeremy Long
*/
public class ReportGeneratorIntegrationTest extends BaseTest {
@Before
public void setUp() throws Exception {
org.owasp.dependencycheck.BaseDBTestCase.ensureDBExists();
}
public class ReportGeneratorIntegrationTest extends BaseDBTestCase {
/**
* Test of generateReport method, of class ReportGenerator.

View File

@@ -25,31 +25,13 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class PropertyTypeTest {
public PropertyTypeTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class PropertyTypeTest extends BaseTest {
/**
* Test of set and getValue method, of class PropertyType.

View File

@@ -39,26 +39,7 @@ import org.xml.sax.XMLReader;
*
* @author Jeremy Long
*/
public class SuppressionHandlerTest {
public SuppressionHandlerTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class SuppressionHandlerTest extends BaseTest {
/**
* Test of getSuppressionRules method, of class SuppressionHandler.

View File

@@ -32,26 +32,7 @@ import org.owasp.dependencycheck.BaseTest;
*
* @author Jeremy Long
*/
public class SuppressionParserTest {
public SuppressionParserTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class SuppressionParserTest extends BaseTest {
/**
* Test of parseSuppressionRules method, of class SuppressionParser.

View File

@@ -34,7 +34,7 @@ import org.owasp.dependencycheck.dependency.Vulnerability;
*
* @author Jeremy Long
*/
public class SuppressionRuleTest {
public class SuppressionRuleTest extends BaseTest {
//<editor-fold defaultstate="collapsed" desc="Stupid tests of properties">
/**

View File

@@ -22,31 +22,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class DateUtilTest {
public DateUtilTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class DateUtilTest extends BaseTest {
/**
* Test of withinDateRange method, of class DateUtil.

View File

@@ -24,12 +24,13 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class DependencyVersionTest {
public class DependencyVersionTest extends BaseTest {
/**
* Test of parseVersion method, of class DependencyVersion.

View File

@@ -24,31 +24,13 @@ import static org.junit.Assert.assertNull;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class DependencyVersionUtilTest {
public DependencyVersionUtilTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
public class DependencyVersionUtilTest extends BaseTest {
/**
* Test of parseVersion method, of class DependencyVersionUtil.

View File

@@ -23,12 +23,13 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author Jeremy Long
*/
public class FilterTest {
public class FilterTest extends BaseTest {
/**
* Test of passes method, of class Filter.

View File

@@ -23,12 +23,13 @@ import java.util.Properties;
import org.junit.Test;
import static org.junit.Assert.*;
import org.owasp.dependencycheck.BaseTest;
/**
*
* @author jeremy
*/
public class ModelTest {
public class ModelTest extends BaseTest {
/**
* Test of getName method, of class Model.

View File

@@ -27,7 +27,7 @@ import org.owasp.dependencycheck.BaseTest;
*
* @author jeremy
*/
public class PomUtilsTest {
public class PomUtilsTest extends BaseTest {
/**
* Test of readPom method, of class PomUtils.