Try to make Sonar builds run again: add missing dependency, add ooxml-schema-security, don't depend on dir test-data and build-directory directly, don't override a POILogger that is set via System Properties
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d90309db4e
commit
0345110611
84
sonar/ooxml-schema-security/pom.xml
Normal file
84
sonar/ooxml-schema-security/pom.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema-security</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Apach POI - Openxmlformats Security-Schema package</name>
|
||||
|
||||
<properties>
|
||||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
|
||||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- reuse Ant build here instead of trying to tweak Maven to do this as we got stuck
|
||||
because we cannot provide "-noupa -nopvr" using the xmlbeans-maven-plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-jar</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<echo message="build jar-file for ooxml-security" />
|
||||
<ant dir="../.." target="compile-ooxml-xsds" useNativeBasedir="true"/>
|
||||
<unzip src="../../ooxml-lib/ooxml-security-1.0.jar" dest="target/jar"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- copy resulting files from the jar-file as "resources" as otherwise Sonar does not pick them up -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>target/jar</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>poi-main</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -22,7 +22,6 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<!-- here the phase you need -->
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
@ -38,7 +37,6 @@
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<!-- here the phase you need -->
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
@ -54,7 +52,6 @@
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-tests</id>
|
||||
<!-- here the phase you need -->
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
@ -97,6 +94,11 @@
|
||||
<artifactId>poi-ooxml-schema-encryption</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>poi-ooxml-schema-security</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>poi-main</artifactId>
|
||||
@ -116,6 +118,22 @@
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.santuario</groupId>
|
||||
<artifactId>xmlsec</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- non-test dependency for OOXMLLite -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -56,6 +56,7 @@
|
||||
<module>main</module>
|
||||
<module>ooxml-schema</module>
|
||||
<module>ooxml-schema-encryption</module>
|
||||
<module>ooxml-schema-security</module>
|
||||
<module>ooxml</module>
|
||||
<module>scratchpad</module>
|
||||
<module>excelant</module>
|
||||
@ -100,7 +101,8 @@
|
||||
<java.awt.headless>true</java.awt.headless>
|
||||
<org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
|
||||
</systemPropertyVariables>
|
||||
<argLine>-Duser.language=en -Duser.country=US</argLine>
|
||||
<!-- use to following to analyze OOM issues: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
|
||||
<argLine>-Duser.language=en -Duser.country=US -Xmx512m</argLine>
|
||||
<excludes>
|
||||
<exclude>**/All*Tests.java</exclude>
|
||||
<exclude>**/TestUnfixedBugs.java</exclude>
|
||||
|
@ -33,6 +33,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.ConnectException;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -632,13 +633,31 @@ public class TestSignatureInfo {
|
||||
|
||||
private static File copy(File input) throws IOException {
|
||||
String extension = input.getName().replaceAll(".*?(\\.[^.]+)?$", "$1");
|
||||
if (extension == null || "".equals(extension)) extension = ".zip";
|
||||
File tmpFile = new File("build", "sigtest"+extension);
|
||||
FileOutputStream fos = new FileOutputStream(tmpFile);
|
||||
FileInputStream fis = new FileInputStream(input);
|
||||
IOUtils.copy(fis, fos);
|
||||
fis.close();
|
||||
fos.close();
|
||||
if (extension == null || "".equals(extension)) {
|
||||
extension = ".zip";
|
||||
}
|
||||
|
||||
// ensure that we create the "build" directory as it might not be existing
|
||||
// in the Sonar Maven runs where we are at a different source directory
|
||||
File buildDir = new File("build");
|
||||
if(!buildDir.exists()) {
|
||||
assertTrue("Failed to create " + buildDir.getAbsolutePath(),
|
||||
buildDir.mkdirs());
|
||||
}
|
||||
File tmpFile = new File(buildDir, "sigtest"+extension);
|
||||
|
||||
OutputStream fos = new FileOutputStream(tmpFile);
|
||||
try {
|
||||
InputStream fis = new FileInputStream(input);
|
||||
try {
|
||||
IOUtils.copy(fis, fos);
|
||||
} finally {
|
||||
fis.close();
|
||||
}
|
||||
} finally {
|
||||
fos.close();
|
||||
}
|
||||
|
||||
return tmpFile;
|
||||
}
|
||||
|
||||
|
@ -1923,6 +1923,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
|
||||
@Test
|
||||
public void test57196_WorkbookEvaluator() {
|
||||
String previousLogger = System.getProperty("org.apache.poi.util.POILogger");
|
||||
//System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger");
|
||||
//System.setProperty("poi.log.level", "3");
|
||||
try {
|
||||
@ -1990,7 +1991,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||
workbookEvaluator.setDebugEvaluationOutputForNextEval(true);
|
||||
workbookEvaluator.evaluate(new XSSFEvaluationCell(cell));
|
||||
} finally {
|
||||
System.clearProperty("org.apache.poi.util.POILogger");
|
||||
if(previousLogger == null) {
|
||||
System.clearProperty("org.apache.poi.util.POILogger");
|
||||
} else {
|
||||
System.setProperty("org.apache.poi.util.POILogger", previousLogger);
|
||||
}
|
||||
System.clearProperty("poi.log.level");
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
||||
import org.apache.poi.ss.usermodel.BaseTestHyperlink;
|
||||
@ -32,15 +34,6 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
|
||||
super(XSSFITestDataProvider.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
// Use system out logger
|
||||
System.setProperty(
|
||||
"org.apache.poi.util.POILogger",
|
||||
"org.apache.poi.util.SystemOutLogger"
|
||||
);
|
||||
}
|
||||
|
||||
public void testLoadExisting() {
|
||||
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("WithMoreVariousData.xlsx");
|
||||
assertEquals(3, workbook.getNumberOfSheets());
|
||||
@ -94,7 +87,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
|
||||
}
|
||||
}
|
||||
|
||||
public void testInvalidURLs() {
|
||||
public void testInvalidURLs() throws IOException {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
XSSFCreationHelper createHelper = workbook.getCreationHelper();
|
||||
|
||||
@ -111,6 +104,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
|
||||
|
||||
}
|
||||
}
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
public void testLoadSave() {
|
||||
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.hwpf.HWPFDocument;
|
||||
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
||||
import org.apache.poi.hwpf.extractor.WordExtractor;
|
||||
@ -38,7 +39,7 @@ public class TestWordDocument {
|
||||
|
||||
//WordDocument.main(new String[] {"test-data/document/Word95.doc", "/tmp/test.doc"});
|
||||
//WordDocument.main(new String[] {"test-data/document/Word6.doc", "/tmp/test.doc"});
|
||||
WordDocument.main(new String[] {"test-data/document/53446.doc", "/tmp/test.doc"});
|
||||
WordDocument.main(new String[] {POIDataSamples.getDocumentInstance().getFile("53446.doc").getAbsolutePath(), "/tmp/test.doc"});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -53,7 +54,7 @@ public class TestWordDocument {
|
||||
assertTrue("Had: " + text, text.contains("Just a \u201Ctest\u201D"));
|
||||
extractor.close();
|
||||
|
||||
WordDocument wordDoc = new WordDocument("test-data/document/47304.doc");
|
||||
WordDocument wordDoc = new WordDocument(POIDataSamples.getDocumentInstance().getFile("47304.doc").getAbsolutePath());
|
||||
|
||||
StringWriter docTextWriter = new StringWriter();
|
||||
PrintWriter out = new PrintWriter(docTextWriter);
|
||||
|
@ -33,15 +33,6 @@ import org.apache.poi.util.DummyPOILogger;
|
||||
* @author Marc Johnson
|
||||
*/
|
||||
public final class TestRawDataBlock extends TestCase {
|
||||
static {
|
||||
// We always want to use our own
|
||||
// logger
|
||||
System.setProperty(
|
||||
"org.apache.poi.util.POILogger",
|
||||
"org.apache.poi.util.DummyPOILogger"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating a normal RawDataBlock
|
||||
*/
|
||||
@ -130,7 +121,7 @@ public final class TestRawDataBlock extends TestCase {
|
||||
|
||||
assertEquals(
|
||||
"7 - Unable to read entire block; "+bts+" read before EOF; expected 512 bytes. Your document was either written by software that ignores the spec, or has been truncated!",
|
||||
(String)(logger.logged.get(0))
|
||||
logger.logged.get(0)
|
||||
);
|
||||
} else {
|
||||
assertEquals(0, logger.logged.size());
|
||||
|
@ -32,15 +32,6 @@ import org.apache.poi.util.DummyPOILogger;
|
||||
* @author Marc Johnson
|
||||
*/
|
||||
public final class TestRawDataBlockList extends TestCase {
|
||||
static {
|
||||
// We always want to use our own
|
||||
// logger
|
||||
System.setProperty(
|
||||
"org.apache.poi.util.POILogger",
|
||||
"org.apache.poi.util.DummyPOILogger"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test creating a normal RawDataBlockList
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user