renamed and moved classes

Former-commit-id: b0e9d931be4d61eb25178182e8602a0c0be4b6b9
This commit is contained in:
Jeremy Long
2014-01-04 08:47:25 -05:00
parent 133a18b70c
commit a4771090ed
11 changed files with 30 additions and 28 deletions

View File

@@ -34,8 +34,8 @@ import org.owasp.dependencycheck.analyzer.AnalysisPhase;
import org.owasp.dependencycheck.analyzer.Analyzer;
import org.owasp.dependencycheck.analyzer.AnalyzerService;
import org.owasp.dependencycheck.data.CachedWebDataSource;
import org.owasp.dependencycheck.data.NoDataException;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.exception.NoDataException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.data.UpdateService;
import org.owasp.dependencycheck.data.cpe.CpeMemoryIndex;
import org.owasp.dependencycheck.data.cpe.IndexException;

View File

@@ -18,6 +18,8 @@
*/
package org.owasp.dependencycheck.data;
import org.owasp.dependencycheck.update.UpdateException;
/**
* Defines an Index who's data is retrieved from the Internet. This data can be
* downloaded and the index updated.

View File

@@ -19,7 +19,7 @@
package org.owasp.dependencycheck.data.nvdcve;
import java.util.Properties;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.data.update.NvdCveInfo;
/**

View File

@@ -22,7 +22,7 @@ import org.owasp.dependencycheck.data.CachedWebDataSource;
import java.net.MalformedURLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
import org.owasp.dependencycheck.utils.DownloadFailedException;

View File

@@ -31,7 +31,7 @@ import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.data.nvdcve.CveDB;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
import org.owasp.dependencycheck.dependency.VulnerableSoftware;

View File

@@ -32,7 +32,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.data.nvdcve.CveDB;
import org.owasp.dependencycheck.utils.DownloadFailedException;
import org.owasp.dependencycheck.utils.Settings;
@@ -59,7 +59,7 @@ public class StandardUpdate {
/**
* A collection of updateable NVD CVE items.
*/
private Updateable updateable;
private UpdateableNvdCve updateable;
/**
* A flag indicating whether or not the current data store should be
* deleted; this only occurs if the database schema has been updated.
@@ -223,8 +223,8 @@ public class StandardUpdate {
* @throws UpdateException Is thrown if there is an issue with the last
* updated properties file
*/
protected final Updateable updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException {
Updateable updates = null;
protected final UpdateableNvdCve updatesNeeded() throws MalformedURLException, DownloadFailedException, UpdateException {
UpdateableNvdCve updates = null;
try {
updates = retrieveCurrentTimestampsFromWeb();
} catch (InvalidDataException ex) {
@@ -319,10 +319,10 @@ public class StandardUpdate {
* timestamps
* @throws InvalidSettingException thrown if the settings are invalid
*/
private Updateable retrieveCurrentTimestampsFromWeb()
private UpdateableNvdCve retrieveCurrentTimestampsFromWeb()
throws MalformedURLException, DownloadFailedException, InvalidDataException, InvalidSettingException {
final Updateable updates = new Updateable();
final UpdateableNvdCve updates = new UpdateableNvdCve();
updates.add(MODIFIED, Settings.getString(Settings.KEYS.CVE_MODIFIED_20_URL),
Settings.getString(Settings.KEYS.CVE_MODIFIED_12_URL),
false);

View File

@@ -33,7 +33,7 @@ import org.owasp.dependencycheck.utils.Downloader;
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class Updateable implements java.lang.Iterable<NvdCveInfo>, Iterator<NvdCveInfo> {
public class UpdateableNvdCve implements java.lang.Iterable<NvdCveInfo>, Iterator<NvdCveInfo> {
/**
* A collection of sources of data.

View File

@@ -16,7 +16,7 @@
*
* Copyright (c) 2013 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.data;
package org.owasp.dependencycheck.exception;
import java.io.IOException;

View File

@@ -16,7 +16,7 @@
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.data;
package org.owasp.dependencycheck.update;
import java.io.IOException;

View File

@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.owasp.dependencycheck.data.UpdateException;
import org.owasp.dependencycheck.update.UpdateException;
import org.owasp.dependencycheck.utils.DownloadFailedException;
/**
@@ -120,7 +120,7 @@ public class StandardUpdateIntegrationTest {
@Test
public void testUpdatesNeeded() throws Exception {
StandardUpdate instance = getStandardUpdateTask();
Updateable result = instance.updatesNeeded();
UpdateableNvdCve result = instance.updatesNeeded();
assertNotNull(result);
}
}

View File

@@ -33,9 +33,9 @@ import org.owasp.dependencycheck.utils.DownloadFailedException;
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class UpdateableTest {
public class UpdateableNvdCveTest {
public UpdateableTest() {
public UpdateableNvdCveTest() {
}
@BeforeClass
@@ -55,7 +55,7 @@ public class UpdateableTest {
}
/**
* Test of isUpdateNeeded method, of class Updateable.
* Test of isUpdateNeeded method, of class UpdateableNvdCve.
*/
@Test
public void testIsUpdateNeeded() throws MalformedURLException, DownloadFailedException, IOException {
@@ -63,7 +63,7 @@ public class UpdateableTest {
//use a local file as this test will load the result and check the timestamp
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
String url = "file:///" + f.getCanonicalPath();
Updateable instance = new Updateable();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add(id, url, url, false);
boolean expResult = false;
@@ -78,7 +78,7 @@ public class UpdateableTest {
}
/**
* Test of add method, of class Updateable.
* Test of add method, of class UpdateableNvdCve.
*/
@Test
public void testAdd_3args() throws Exception {
@@ -86,7 +86,7 @@ public class UpdateableTest {
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
//use a local file as this test will load the result and check the timestamp
String url = "file:///" + f.getCanonicalPath();
Updateable instance = new Updateable();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add(id, url, url);
NvdCveInfo results = instance.get(id);
assertEquals(id, results.getId());
@@ -95,7 +95,7 @@ public class UpdateableTest {
}
/**
* Test of add method, of class Updateable.
* Test of add method, of class UpdateableNvdCve.
*/
@Test
public void testAdd_4args() throws Exception {
@@ -103,7 +103,7 @@ public class UpdateableTest {
//use a local file as this test will load the result and check the timestamp
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
String url = "file:///" + f.getCanonicalPath();
Updateable instance = new Updateable();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add(id, url, url, false);
boolean expResult = false;
@@ -120,7 +120,7 @@ public class UpdateableTest {
}
/**
* Test of clear method, of class Updateable.
* Test of clear method, of class UpdateableNvdCve.
*/
@Test
public void testClear() throws MalformedURLException, DownloadFailedException, IOException {
@@ -128,7 +128,7 @@ public class UpdateableTest {
//use a local file as this test will load the result and check the timestamp
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
String url = "file:///" + f.getCanonicalPath();
Updateable instance = new Updateable();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add(id, url, url, false);
assertFalse(instance.getCollection().isEmpty());
instance.clear();
@@ -136,14 +136,14 @@ public class UpdateableTest {
}
/**
* Test of iterator method, of class Updateable.
* Test of iterator method, of class UpdateableNvdCve.
*/
@Test
public void testIterator() throws IOException {
//use a local file as this test will load the result and check the timestamp
File f = new File("target/test-classes/nvdcve-2.0-2012.xml");
String url = "file:///" + f.getCanonicalPath();
Updateable instance = new Updateable();
UpdateableNvdCve instance = new UpdateableNvdCve();
instance.add("one", url, url, false);
instance.add("two", url, url, false);
instance.add("three", url, url, false);