releasing updates from private repo

Former-commit-id: 064139c68ad185358d6c74a77511d9ca36229633
This commit is contained in:
Jeremy Long
2013-07-31 10:21:31 -04:00
parent a036b9fc27
commit c3f9f16ce3
264 changed files with 13532 additions and 3394 deletions

View File

@@ -0,0 +1,121 @@
/*
* This file is part of dependency-check-ant.
*
* Dependency-check-ant is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Dependency-check-ant is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* dependency-check-ant. If not, see http://www.gnu.org/licenses/.
*
* Copyright (c) 2013 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.taskdefs;
import java.io.File;
import static junit.framework.TestCase.assertTrue;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.tools.ant.BuildFileTest;
/**
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class DependencyCheckTaskTest extends BuildFileTest {
public DependencyCheckTaskTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
@Override
public void setUp() {
final String buildFile = this.getClass().getClassLoader().getResource("build.xml").getPath();
configureProject(buildFile);
}
@After
@Override
public void tearDown() {
//no cleanup...
//executeTarget("cleanup");
}
/**
* Test of addFileSet method, of class DependencyCheckTask.
*/
@Test
public void testAddFileSet() throws Exception {
File report = new File("target/DependencyCheck-Report.html");
if (report.exists()) {
if (!report.delete()) {
throw new Exception("Unable to delete 'target/DependencyCheck-Report.html' prior to test.");
}
}
executeTarget("test.fileset");
assertTrue("DependencyCheck report was not generated", report.exists());
}
/**
* Test of addFileList method, of class DependencyCheckTask.
*
* @throws Exception
*/
@Test
public void testAddFileList() throws Exception {
File report = new File("target/DependencyCheck-Report.xml");
if (report.exists()) {
if (!report.delete()) {
throw new Exception("Unable to delete 'target/DependencyCheck-Report.xml' prior to test.");
}
}
executeTarget("test.filelist");
assertTrue("DependencyCheck report was not generated", report.exists());
}
/**
* Test of addDirSet method, of class DependencyCheckTask.
*
* @throws Exception
*/
@Test
public void testAddDirSet() throws Exception {
File report = new File("target/DependencyCheck-Vulnerability.html");
if (report.exists()) {
if (!report.delete()) {
throw new Exception("Unable to delete 'target/DependencyCheck-Vulnerability.html' prior to test.");
}
}
executeTarget("test.dirset");
assertTrue("DependencyCheck report was not generated", report.exists());
}
/**
* Test of getFailBuildOnCVSS method, of class DependencyCheckTask.
*/
@Test
public void testGetFailBuildOnCVSS() {
expectBuildException("failCVSS", "asdfasdfscore");
System.out.println(this.getOutput());
}
}

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dependency-Check Test Build" default="test.fileset" basedir=".">
<taskdef name="dependency-check" classname="org.owasp.dependencycheck.taskdefs.DependencyCheckTask" />
<target name="test.fileset">
<dependency-check
applicationName="My Project"
reportOutputDirectory="${project.build.directory}"
autoupdate="false"
reportFormat="HTML">
<!-- Scan a single file -->
<fileset dir="${project.build.directory}/test-classes/jars">
<include name="axis-1.4.jar"/>
</fileset>
<!-- Scan for all jar/war/ear in the webroot dir and all sub directories -->
<fileset dir="${project.build.directory}/test-classes/webroot">
<include name="**/*.jar"/>
<include name="**/*.war"/>
<include name="**/*.ear"/>
</fileset>
</dependency-check>
</target>
<target name="test.filelist">
<dependency-check
applicationName="My Project"
reportOutputDirectory="${project.build.directory}"
autoupdate="false"
reportFormat="XML">
<!-- Scan specific files -->
<filelist
dir="${project.build.directory}/test-classes/list"
files="jetty-6.1.0.jar,org.mortbay.jetty.jar"/>
</dependency-check>
</target>
<target name="test.dirset">
<dependency-check
applicationName="My Project"
reportOutputDirectory="${project.build.directory}"
autoupdate="false"
reportFormat="VULN">
<!-- Scan a specific directory -->
<dirset dir="${project.build.directory}/test-classes">
<include name="lib"/>
</dirset>
</dependency-check>
</target>
<target name="formatBAD">
<dependency-check
applicationName="test formatBAD"
reportOutputDirectory="${project.build.directory}"
autoupdate="false"
reportFormat="BAD">
</dependency-check>
</target>
<target name="failCVSS">
<dependency-check
applicationName="test formatBAD"
reportOutputDirectory="${project.build.directory}"
reportFormat="XML"
autoupdate="false"
failBuildOnCVSS="8">
</dependency-check>
</target>
</project>