aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java12
-rw-r--r--test/java/org/apache/fop/fotreetest/FOTreeTester.java11
-rw-r--r--test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java6
-rw-r--r--test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java3
-rw-r--r--test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java12
-rw-r--r--test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java29
-rw-r--r--test/java/org/apache/fop/layoutengine/LayoutEngineTester.java21
-rw-r--r--test/java/org/apache/fop/util/ConsoleEventListenerForTests.java56
8 files changed, 119 insertions, 31 deletions
diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java
index 04752064f..aa9af4226 100644
--- a/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java
+++ b/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java
@@ -35,6 +35,7 @@ import org.apache.commons.io.filefilter.NameFileFilter;
import org.apache.commons.io.filefilter.PrefixFileFilter;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
+
import org.apache.fop.DebugHelper;
import org.apache.fop.fo.flow.table.CollapsedConditionalBorderTestCase;
import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase;
@@ -104,9 +105,14 @@ public final class FOTreeTestSuite {
final FOTreeTester tester, final File f) {
suite.addTest(new FOTreeTestCase(f.getName()) {
public void runTest() throws Exception {
- org.apache.commons.logging.LogFactory.getLog(this.getClass()).info("Starting " + f.getName());
- prepare(tester, f);
- testMain();
+ try {
+ prepare(tester, f);
+ testMain();
+ } catch (Exception e) {
+ org.apache.commons.logging.LogFactory.getLog(this.getClass()).info(
+ "Error on " + f.getName());
+ throw e;
+ }
}
});
}
diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTester.java b/test/java/org/apache/fop/fotreetest/FOTreeTester.java
index 9c2a260bc..6ffad6989 100644
--- a/test/java/org/apache/fop/fotreetest/FOTreeTester.java
+++ b/test/java/org/apache/fop/fotreetest/FOTreeTester.java
@@ -25,14 +25,15 @@ import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
-
import org.apache.fop.fotreetest.ext.TestElementMapping;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLFilterImpl;
+import org.apache.fop.util.ConsoleEventListenerForTests;
/**
* Test driver class for FO tree tests.
@@ -66,6 +67,8 @@ public class FOTreeTester {
FOUserAgent ua = fopFactory.newFOUserAgent();
ua.setBaseURL(testFile.getParentFile().toURL().toString());
ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua));
+ ua.getEventBroadcaster().addEventListener(
+ new ConsoleEventListenerForTests(testFile.getName()));
//Used to set values in the user agent through processing instructions
reader = new PIListener(reader, ua);
diff --git a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
index e19547345..a7fa11950 100644
--- a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
+++ b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
@@ -26,11 +26,13 @@ import javax.xml.parsers.SAXParserFactory;
import junit.framework.TestCase;
+import org.xml.sax.XMLReader;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.fo.FOEventHandler;
-import org.xml.sax.XMLReader;
+import org.apache.fop.util.ConsoleEventListenerForTests;
/**
@@ -82,6 +84,8 @@ public abstract class FOTreeUnitTester extends TestCase {
public void setUp(String filename, FOEventHandlerFactory factory) throws Exception {
FOUserAgent ua = fopFactory.newFOUserAgent();
ua.setFOEventHandlerOverride(factory.createFOEventHandler(ua));
+ ua.getEventBroadcaster().addEventListener(
+ new ConsoleEventListenerForTests(filename));
Fop fop = fopFactory.newFop(ua);
diff --git a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
index ced81932b..96aa89bc3 100644
--- a/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
+++ b/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
@@ -50,6 +50,7 @@ import org.apache.fop.area.RenderPagesModel;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.xml.XMLRenderer;
+import org.apache.fop.util.ConsoleEventListenerForTests;
//XML Unit 1.0: See http://xmlunit.sourceforge.net (BSD-style License)
import org.custommonkey.xmlunit.XMLTestCase;
@@ -170,6 +171,8 @@ public class AreaTreeParserTestCase extends XMLTestCase {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
try {
userAgent.setBaseURL(testDir.toURL().toExternalForm());
+ userAgent.getEventBroadcaster().addEventListener(
+ new ConsoleEventListenerForTests(testFile.getName()));
} catch (MalformedURLException e) {
//ignore, won't happen
}
diff --git a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java
index f72b2da87..68c81da81 100644
--- a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java
+++ b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java
@@ -56,10 +56,14 @@ public class IntermediateFormatTestSuite {
final File f) {
suite.addTest(new AreaTreeParserTestCase(f) {
public void runTest() throws Exception {
- org.apache.commons.logging.LogFactory.getLog(
- this.getClass()).info("Starting " + f.getName());
- testParserToAT();
- testParserToPDF();
+ try {
+ testParserToAT();
+ testParserToPDF();
+ } catch (Exception e) {
+ org.apache.commons.logging.LogFactory.getLog(
+ this.getClass()).error("Error on " + f.getName());
+ throw e;
+ }
}
});
}
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
index 99a63f2b7..0597e0e91 100644
--- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
+++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
@@ -34,6 +34,14 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.AndFileFilter;
import org.apache.commons.io.filefilter.IOFileFilter;
@@ -42,15 +50,8 @@ import org.apache.commons.io.filefilter.NotFileFilter;
import org.apache.commons.io.filefilter.PrefixFileFilter;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.apache.fop.DebugHelper;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.fop.DebugHelper;
/**
* JUnit test suit for running layout engine test under JUnit control.
@@ -187,10 +188,14 @@ public class LayoutEngineTestSuite {
final LayoutEngineTester tester, final File f) {
suite.addTest(new LayoutEngineTestCase(f.getName()) {
public void runTest() throws Exception {
- org.apache.commons.logging.LogFactory.getLog(
- this.getClass()).info("Starting " + f.getName());
- prepare(tester, f);
- testMain();
+ try {
+ prepare(tester, f);
+ testMain();
+ } catch (Exception e) {
+ org.apache.commons.logging.LogFactory.getLog(
+ this.getClass()).error("Error on " + f.getName());
+ throw e;
+ }
}
});
}
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
index a10bfa0e3..bcd5f1db4 100644
--- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
+++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
@@ -43,19 +43,23 @@ import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.SAXException;
+
+import org.apache.xpath.XPathAPI;
+import org.apache.xpath.objects.XObject;
+
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FormattingResults;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.render.xml.XMLRenderer;
-import org.apache.xpath.XPathAPI;
-import org.apache.xpath.objects.XObject;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
+import org.apache.fop.util.ConsoleEventListenerForTests;
/**
* Class for testing the FOP's layout engine using testcases specified in XML
@@ -154,6 +158,9 @@ public class LayoutEngineTester {
//Setup FOP for area tree rendering
FOUserAgent ua = effFactory.newFOUserAgent();
ua.setBaseURL(testFile.getParentFile().toURL().toString());
+ ua.getEventBroadcaster().addEventListener(
+ new ConsoleEventListenerForTests(testFile.getName()));
+
XMLRenderer atrenderer = new XMLRenderer();
atrenderer.setUserAgent(ua);
atrenderer.setContentHandler(athandler);
diff --git a/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java b/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java
new file mode 100644
index 000000000..9e8a57285
--- /dev/null
+++ b/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.util;
+
+import org.apache.fop.events.Event;
+import org.apache.fop.events.EventFormatter;
+import org.apache.fop.events.EventListener;
+import org.apache.fop.events.model.EventSeverity;
+
+/** A simple event listener that writes the events to stdout and sterr. */
+public class ConsoleEventListenerForTests implements EventListener {
+
+ private String name;
+
+ public ConsoleEventListenerForTests(String name) {
+ this.name = name;
+ }
+
+ /** {@inheritDoc} */
+ public void processEvent(Event event) {
+ if (this.name != null) {
+ System.out.println("Test: " + this.name);
+ this.name = null;
+ }
+ String msg = EventFormatter.format(event);
+ EventSeverity severity = event.getSeverity();
+ if (severity == EventSeverity.INFO) {
+ System.out.println(" [INFO ] " + msg);
+ } else if (severity == EventSeverity.WARN) {
+ System.out.println(" [WARN ] " + msg);
+ } else if (severity == EventSeverity.ERROR) {
+ System.out.println(" [ERROR] " + msg);
+ } else if (severity == EventSeverity.FATAL) {
+ System.out.println(" [FATAL] " + msg);
+ } else {
+ assert false;
+ }
+ }
+} \ No newline at end of file