Return-Path: Delivered-To: apmail-xmlgraphics-fop-commits-archive@www.apache.org Received: (qmail 21034 invoked from network); 3 Dec 2007 13:21:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2007 13:21:28 -0000 Received: (qmail 84066 invoked by uid 500); 3 Dec 2007 13:21:16 -0000 Delivered-To: apmail-xmlgraphics-fop-commits-archive@xmlgraphics.apache.org Received: (qmail 84043 invoked by uid 500); 3 Dec 2007 13:21:16 -0000 Mailing-List: contact fop-commits-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: fop-dev@xmlgraphics.apache.org Delivered-To: mailing list fop-commits@xmlgraphics.apache.org Received: (qmail 84032 invoked by uid 99); 3 Dec 2007 13:21:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 05:21:16 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 13:21:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 723C51A9832; Mon, 3 Dec 2007 05:21:07 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r600521 - /xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java Date: Mon, 03 Dec 2007 13:21:07 -0000 To: fop-commits@xmlgraphics.apache.org From: jeremias@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071203132107.723C51A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jeremias Date: Mon Dec 3 05:21:06 2007 New Revision: 600521 URL: http://svn.apache.org/viewvc?rev=600521&view=rev Log: Added a possibility to rerun the whole run a defined number of times to test for possible issues outside a single rendering run. Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java?rev=600521&r1=600520&r2=600521&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java Mon Dec 3 05:21:06 2007 @@ -23,15 +23,19 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; +import java.net.MalformedURLException; import javax.xml.transform.Result; import javax.xml.transform.Source; +import javax.xml.transform.Templates; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.output.NullOutputStream; + import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; @@ -41,17 +45,23 @@ */ public class MemoryEater { - private static void eatMemory(File foFile, int replicatorRepeats) throws Exception { - - SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); - FopFactory fopFactory = FopFactory.newInstance(); - + private SAXTransformerFactory tFactory + = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); + private FopFactory fopFactory = FopFactory.newInstance(); + private Templates replicatorTemplates; + + public MemoryEater() throws TransformerConfigurationException, MalformedURLException { File xsltFile = new File("test/xsl/fo-replicator.xsl"); Source xslt = new StreamSource(xsltFile); + replicatorTemplates = tFactory.newTemplates(xslt); + fopFactory.setBaseURL("C:/Dev/FOP/testing/xslt-1.0-book"); + } + + private void eatMemory(File foFile, int replicatorRepeats) throws Exception { Source src = new StreamSource(foFile); - Transformer transformer = tFactory.newTransformer(xslt); + Transformer transformer = replicatorTemplates.newTransformer(); transformer.setParameter("repeats", new Integer(replicatorRepeats)); OutputStream out = new NullOutputStream(); //write to /dev/nul @@ -78,13 +88,17 @@ boolean doPrompt = true; //true if you want a chance to start the monitoring console try { int replicatorRepeats = 2; + int runRepeats = 1; if (args.length > 0) { replicatorRepeats = Integer.parseInt(args[0]); } + if (args.length > 1) { + runRepeats = Integer.parseInt(args[1]); + } File testFile = new File("examples/fo/basic/readme.fo"); System.out.println("MemoryEater! About to replicate the test file " - + replicatorRepeats + " times..."); + + replicatorRepeats + " times and run it " + runRepeats + " times..."); if (doPrompt) { prompt(); } @@ -92,7 +106,10 @@ System.out.println("Processing..."); long start = System.currentTimeMillis(); - eatMemory(testFile, replicatorRepeats); + MemoryEater app = new MemoryEater(); + for (int i = 0; i < runRepeats; i++) { + app.eatMemory(testFile, replicatorRepeats); + } long duration = System.currentTimeMillis() - start; System.out.println("Success! Job took " + duration + " ms"); --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org