mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 08:13:43 +01:00
fixed analyzer method signature, added SpringCleaningAnalyzer, and removed ArchiveAnalyzer interface
Former-commit-id: 789fcd7a7c463ee2528c9a325a8536f2cc9278c5
This commit is contained in:
@@ -19,7 +19,7 @@ import static org.junit.Assert.*;
|
||||
* @author Jeremy Long (jeremy.long@gmail.com)
|
||||
*/
|
||||
public class FileNameAnalyzerTest {
|
||||
|
||||
|
||||
public FileNameAnalyzerTest() {
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ public class FileNameAnalyzerTest {
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class FileNameAnalyzerTest {
|
||||
File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath());
|
||||
Dependency result = new Dependency(file);
|
||||
FileNameAnalyzer instance = new FileNameAnalyzer();
|
||||
instance.analyze(result);
|
||||
instance.analyze(result, null);
|
||||
assertTrue(result.getVendorEvidence().toString().toLowerCase().contains("struts"));
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class FileNameAnalyzerTest {
|
||||
public void testClose() {
|
||||
System.out.println("close");
|
||||
FileNameAnalyzer instance = new FileNameAnalyzer();
|
||||
instance.close();
|
||||
instance.close();
|
||||
assertTrue(true); //close does nothing.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,14 +53,14 @@ public class JarAnalyzerTest {
|
||||
File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath());
|
||||
Dependency result = new Dependency(file);
|
||||
JarAnalyzer instance = new JarAnalyzer();
|
||||
instance.analyze(result);
|
||||
instance.analyze(result, null);
|
||||
assertTrue(result.getVendorEvidence().toString().toLowerCase().contains("apache"));
|
||||
assertTrue(result.getVendorEvidence().getWeighting().contains("apache"));
|
||||
|
||||
|
||||
file = new File(this.getClass().getClassLoader().getResource("org.mortbay.jetty.jar").getPath());
|
||||
result = new Dependency(file);
|
||||
instance.analyze(result);
|
||||
instance.analyze(result, null);
|
||||
boolean found = false;
|
||||
for (Evidence e : result.getProductEvidence()) {
|
||||
if (e.getName().equalsIgnoreCase("package-title")
|
||||
@@ -93,7 +93,7 @@ public class JarAnalyzerTest {
|
||||
|
||||
file = new File(this.getClass().getClassLoader().getResource("org.mortbay.jmx.jar").getPath());
|
||||
result = new Dependency(file);
|
||||
instance.analyze(result);
|
||||
instance.analyze(result, null);
|
||||
assertEquals("org.mortbar,jmx.jar has version evidence?", result.getVersionEvidence().size(), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,11 +97,11 @@ public class CPEAnalyzerTest extends BaseIndexTestCase {
|
||||
File file = new File(this.getClass().getClassLoader().getResource("struts2-core-2.1.2.jar").getPath());
|
||||
JarAnalyzer jarAnalyzer = new JarAnalyzer();
|
||||
Dependency depends = new Dependency(file);
|
||||
jarAnalyzer.analyze(depends);
|
||||
jarAnalyzer.analyze(depends, null);
|
||||
|
||||
File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath());
|
||||
Dependency spring = new Dependency(fileSpring);
|
||||
jarAnalyzer.analyze(spring);
|
||||
jarAnalyzer.analyze(spring, null);
|
||||
|
||||
CPEAnalyzer instance = new CPEAnalyzer();
|
||||
instance.open();
|
||||
|
||||
Reference in New Issue
Block a user