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,217 @@
/*
* This file is part of dependency-check-maven.
*
* Dependency-check-maven 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-maven 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-maven. If not, see http://www.gnu.org/licenses/.
*
* Copyright (c) 2013 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.maven;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.File;
import java.util.Locale;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* TODO - figure out how to get the test harness to work. ATM no tests are
* running.
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class DependencyCheckMojoTest extends AbstractMojoTestCase {
public DependencyCheckMojoTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
//
// /**
// * Test of execute method, of class DependencyCheckMojo.
// */
// @Test
// public void testExecute() throws Exception {
// System.out.println("execute");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// instance.execute();
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of generate method, of class DependencyCheckMojo.
// */
// @Test
// public void testGenerate_Sink_Locale() throws Exception {
// System.out.println("generate");
// org.codehaus.doxia.sink.Sink sink = null;
// Locale locale = null;
// DependencyCheckMojo instance = new DependencyCheckMojo();
// instance.generate(sink, locale);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
/**
* Test of generate method, of class DependencyCheckMojo.
*/
@Test
public void testGenerate_Sink_SinkFactory_Locale() throws Exception {
//can't get the test-harness to work.
// File samplePom = new File(this.getClass().getClassLoader().getResource("sample.xml").toURI());
// DependencyCheckMojo mojo = (DependencyCheckMojo) lookupMojo("check", samplePom);
// assertNotNull("Unable to load mojo", mojo);
//
// File out = mojo.getReportOutputDirectory();
// OutputStream os = new FileOutputStream(out);
// MySink sink = new MySink(os);
// Locale locale = new Locale("en");
//
//
// mojo.generate(sink, null, locale);
// sink.close();
}
// /**
// * Test of getOutputName method, of class DependencyCheckMojo.
// */
// @Test
// public void testGetOutputName() {
// System.out.println("getOutputName");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// String expResult = "";
// String result = instance.getOutputName();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getCategoryName method, of class DependencyCheckMojo.
// */
// @Test
// public void testGetCategoryName() {
// System.out.println("getCategoryName");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// String expResult = "";
// String result = instance.getCategoryName();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getName method, of class DependencyCheckMojo.
// */
// @Test
// public void testGetName() {
// System.out.println("getName");
// Locale locale = null;
// DependencyCheckMojo instance = new DependencyCheckMojo();
// String expResult = "";
// String result = instance.getName(locale);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of setReportOutputDirectory method, of class DependencyCheckMojo.
// */
// @Test
// public void testSetReportOutputDirectory() {
// System.out.println("setReportOutputDirectory");
// File directory = null;
// DependencyCheckMojo instance = new DependencyCheckMojo();
// instance.setReportOutputDirectory(directory);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getReportOutputDirectory method, of class DependencyCheckMojo.
// */
// @Test
// public void testGetReportOutputDirectory() {
// System.out.println("getReportOutputDirectory");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// File expResult = null;
// File result = instance.getReportOutputDirectory();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getDescription method, of class DependencyCheckMojo.
// */
// @Test
// public void testGetDescription() {
// System.out.println("getDescription");
// Locale locale = null;
// DependencyCheckMojo instance = new DependencyCheckMojo();
// String expResult = "";
// String result = instance.getDescription(locale);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of isExternalReport method, of class DependencyCheckMojo.
// */
// @Test
// public void testIsExternalReport() {
// System.out.println("isExternalReport");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// boolean expResult = false;
// boolean result = instance.isExternalReport();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of canGenerateReport method, of class DependencyCheckMojo.
// */
// @Test
// public void testCanGenerateReport() {
// System.out.println("canGenerateReport");
// DependencyCheckMojo instance = new DependencyCheckMojo();
// boolean expResult = false;
// boolean result = instance.canGenerateReport();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
}

View File

@@ -0,0 +1,422 @@
/*
* This file is part of dependency-check-maven.
*
* Dependency-check-maven 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-maven 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-maven. If not, see http://www.gnu.org/licenses/.
*
* Copyright (c) 2013 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.maven;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.maven.doxia.sink.Sink;
/**
*
* @author Jeremy Long (jeremy.long@owasp.org)
*/
public class MySink implements Sink {
private OutputStreamWriter out = null;
public MySink(OutputStream os) {
out = new OutputStreamWriter(os);
}
private void writeTag(String tag) {
try {
out.write(tag);
} catch (IOException ex) {
Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void head() {
writeTag("<head>");
}
public void head_() {
writeTag("</head>");
}
public void title() {
writeTag("<title>");
}
public void title_() {
writeTag("</title>");
}
public void author() {
writeTag("<author>");
}
public void author_() {
writeTag("</author>");
}
public void date() {
writeTag("<time>");
}
public void date_() {
writeTag("</time>");
}
public void body() {
writeTag("<body>");
}
public void body_() {
writeTag("</body>");
}
public void sectionTitle() {
writeTag("<h1>");
}
public void sectionTitle_() {
writeTag("</h1>");
}
public void section1() {
writeTag("<div>");
}
public void section1_() {
writeTag("</div>");
}
public void sectionTitle1() {
writeTag("<h2>");
}
public void sectionTitle1_() {
writeTag("</h2>");
}
public void section2() {
writeTag("<div>");
}
public void section2_() {
writeTag("</div>");
}
public void sectionTitle2() {
writeTag("<h3>");
}
public void sectionTitle2_() {
writeTag("</h3>");
}
public void section3() {
writeTag("<div>");
}
public void section3_() {
writeTag("</div>");
}
public void sectionTitle3() {
writeTag("<h4>");
}
public void sectionTitle3_() {
writeTag("</h4>");
}
public void section4() {
writeTag("<div>");
}
public void section4_() {
writeTag("</div>");
}
public void sectionTitle4() {
writeTag("<h5>");
}
public void sectionTitle4_() {
writeTag("</h5>");
}
public void section5() {
writeTag("<div>");
}
public void section5_() {
writeTag("</div>");
}
public void sectionTitle5() {
writeTag("<h6>");
}
public void sectionTitle5_() {
writeTag("</h6>");
}
public void list() {
writeTag("<ul>");
}
public void list_() {
writeTag("</ul>");
}
public void listItem() {
writeTag("<li>");
}
public void listItem_() {
writeTag("</li>");
}
public void numberedList(int numbering) {
writeTag("<ol>");
}
public void numberedList_() {
writeTag("</ol>");
}
public void numberedListItem() {
writeTag("<li>");
}
public void numberedListItem_() {
writeTag("</li>");
}
public void definitionList() {
writeTag("<dl>");
}
public void definitionList_() {
writeTag("</dl>");
}
public void definitionListItem() {
writeTag("<dt>");
}
public void definitionListItem_() {
writeTag("</dt>");
}
public void definition() {
writeTag("<dd>");
}
public void definition_() {
writeTag("</dd>");
}
public void definedTerm() {
writeTag("<dt>");
}
public void definedTerm_() {
writeTag("</dt>");
}
public void figure() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void figure_() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void figureCaption() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void figureCaption_() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void figureGraphics(String name) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void table() {
writeTag("<table>");
}
public void table_() {
writeTag("</table>");
}
public void tableRows(int[] justification, boolean grid) {
writeTag("<tr>");
}
public void tableRows_() {
writeTag("</tr>");
}
public void tableRow() {
writeTag("<tr>");
}
public void tableRow_() {
writeTag("</tr>");
}
public void tableCell() {
writeTag("<td>");
}
public void tableCell(String width) {
writeTag("<td>");
}
public void tableCell_() {
writeTag("</td>");
}
public void tableHeaderCell() {
writeTag("<th>");
}
public void tableHeaderCell(String width) {
writeTag("<th>");
}
public void tableHeaderCell_() {
writeTag("</th>");
}
public void tableCaption() {
writeTag("<caption>");
}
public void tableCaption_() {
writeTag("</caption>");
}
public void paragraph() {
writeTag("<p>");
}
public void paragraph_() {
writeTag("</p>");
}
public void verbatim(boolean boxed) {
writeTag("<pre>");
}
public void verbatim_() {
writeTag("</pre>");
}
public void horizontalRule() {
writeTag("<hr/>");
}
public void pageBreak() {
writeTag("<br/>");
}
public void anchor(String name) {
writeTag("<a href=\"" + name + "\">");
}
public void anchor_() {
writeTag("</a>");
}
public void link(String name) {
writeTag("<link href=\"" + name + "\">");
}
public void link_() {
writeTag("</link>");
}
public void italic() {
writeTag("<i>");
}
public void italic_() {
writeTag("</i>");
}
public void bold() {
writeTag("<b>");
}
public void bold_() {
writeTag("</b>");
}
public void monospaced() {
writeTag("<pre>");
}
public void monospaced_() {
writeTag("</pre>");
}
public void lineBreak() {
writeTag("<br>");
}
public void nonBreakingSpace() {
writeTag("&nbsp;");
}
public void text(String text) {
try {
//TODO add HTML Encoding - or figure out how to get the doxia xhtmlsink to work.
out.write(text);
} catch (IOException ex) {
Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void rawText(String text) {
try {
out.write(text);
} catch (IOException ex) {
Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void flush() {
try {
out.flush();
} catch (IOException ex) {
Logger.getLogger(MySink.class.getName()).log(Level.FINEST, null, ex);
}
}
public void close() {
flush();
try {
out.close();
} catch (IOException ex) {
Logger.getLogger(MySink.class.getName()).log(Level.FINEST, null, ex);
}
}
}

View File

@@ -0,0 +1,57 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.owasp.dependency-check</groupId>
<artifactId>sample</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sample</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<name>staging</name>
<id>staging</id>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<executions>
<execution>
<goals>check</goals>
</execution>
</executions>
<configuration>
<showEvidence>false</showEvidence>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>