[jira] [Updated] (TAP5-2029) JPA annotations expose implementation details in service interfaces
[ https://issues.apache.org/jira/browse/TAP5-2029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thiago H. de Paula Figueiredo updated TAP5-2029: Component/s: (was: tapestry-jpa) tapestry-ioc Changing the component from tapestry-jpa to tapestry-ioc as this is actually a shortcoming in Tapestry-IoC. JPA annotations expose implementation details in service interfaces --- Key: TAP5-2029 URL: https://issues.apache.org/jira/browse/TAP5-2029 Project: Tapestry 5 Issue Type: Improvement Components: tapestry-ioc Affects Versions: 5.3.6 Reporter: John Coleman Priority: Minor The commit after and persistence context annotations are required on the service interface definition thereby exposing internal implementation details (see below example from docs). Details of implementation should be hidden at the interface level, both these annotations break the rule. Perhaps this code could appear in the Impl classes, or be provided in configuration somehow? public interface UserDAO { @CommitAfter @PersistenceContext(unitName = DemoUnit) void add(User user); -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[2/9] git commit: Fix the code that accesses the alert to use explict css matching
Fix the code that accesses the alert to use explict css matching Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/762d453e Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/762d453e Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/762d453e Branch: refs/heads/5.4-js-rewrite Commit: 762d453e709f6d39c8bea7a1982cd99a7f46908a Parents: 989f961 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 10:56:47 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 10:56:47 2012 -0800 -- .../integration/TapestryCoreTestCase.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/762d453e/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java index 51a5673..55b379f 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java @@ -63,6 +63,6 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase waitForCSSSelectedElementToAppear([data-container-type=alerts] .alert); // Add the special x for the close button to the text. -assertText([data-container-type=alerts] .alert, \u00d7 + text); +assertText(css=[data-container-type=alerts] .alert, \u00d7 + text); } }
[1/9] git commit: Fix broken tests
Updated Branches: refs/heads/5.4-js-rewrite 2ce2925e8 - e0dd5d2b6 Fix broken tests Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e0dd5d2b Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e0dd5d2b Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e0dd5d2b Branch: refs/heads/5.4-js-rewrite Commit: e0dd5d2b6968d95009e584e6ae2c8e7e5863d272 Parents: 762d453 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 10:58:25 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 10:58:25 2012 -0800 -- .../integration/app1/CanceledEventTests.groovy |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e0dd5d2b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy -- diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy index 595b977..a6f7ddc 100644 --- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy +++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy @@ -10,9 +10,11 @@ class CanceledEventTests extends TapestryCoreTestCase { openLinks Canceled Event Demo +sleep 100 + clickAndWait SUBMIT -assertText css=.t-alert-container, Form was canceled. +assertFirstAlert Form was canceled. } @Test @@ -20,8 +22,10 @@ class CanceledEventTests extends TapestryCoreTestCase { openLinks Canceled Event Demo +sleep 100 + clickAndWait link=Cancel Form -assertText css=.t-alert-container, Form was canceled. +assertFirstAlert Form was canceled. } }
[4/9] git commit: Add a easy way to verify that alert text is present
Add a easy way to verify that alert text is present Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3c4ee267 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3c4ee267 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3c4ee267 Branch: refs/heads/5.4-js-rewrite Commit: 3c4ee267898033b6c0b250d980512545ac5615c7 Parents: 7cdb639 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 10:52:00 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 10:52:00 2012 -0800 -- .../integration/TapestryCoreTestCase.java | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3c4ee267/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java index 8907ba6..51a5673 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java @@ -51,4 +51,18 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase assertFieldValue(id, values[i]); } } + +/** + * Asserts that the text of the first alert matches the given value. Waits for the alerts container + * and the alert itself to appear. + * + * @param text + */ +protected final void assertFirstAlert(String text) +{ +waitForCSSSelectedElementToAppear([data-container-type=alerts] .alert); + +// Add the special x for the close button to the text. +assertText([data-container-type=alerts] .alert, \u00d7 + text); +} }
[8/9] git commit: Fix broken Alerts tests
Fix broken Alerts tests Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e59b5e46 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e59b5e46 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e59b5e46 Branch: refs/heads/5.4-js-rewrite Commit: e59b5e465cd383259b1590e02a7a857fa2413fd2 Parents: 3dd5c8e Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 09:24:04 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 09:24:04 2012 -0800 -- .../tapestry5/integration/app1/AlertsTests.groovy | 62 +++ .../integration/app1/components/Border.tml |3 +- .../integration/app1/pages/AlertsDemo.tml |6 +- 3 files changed, 31 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e59b5e46/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy -- diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy index 4936cee..b174b03 100644 --- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy +++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy @@ -15,7 +15,7 @@ package org.apache.tapestry5.integration.app1; -import org.apache.tapestry5.test.SeleniumTestCase +import org.apache.tapestry5.integration.TapestryCoreTestCase import org.testng.annotations.Test /** @@ -23,12 +23,13 @@ import org.testng.annotations.Test * * @since 5.3 */ -class AlertsTests extends SeleniumTestCase -{ +class AlertsTests extends TapestryCoreTestCase { + +def CONTAINER = [data-container-type=alerts] + @Test -void traditional_update_and_remove() -{ -openLinks Alerts Demo, reset +void traditional_update_and_remove() { +openLinks Alerts Demo, Reset Alerts Storage select id=severity, Warn select id=duration, Until Dismissed @@ -36,25 +37,30 @@ class AlertsTests extends SeleniumTestCase clickAndWait //input[@value='Traditional Update'] +waitForCSSSelectedElementToAppear $CONTAINER .alert + assertTextPresent trad warn until -clickAndWait link=Back to index +clickAndWait BACK_TO_INDEX + +waitForCSSSelectedElementToAppear $CONTAINER .alert assertTextPresent trad warn until // Click the first and only dismiss icon -click css=.t-dismiss +click css=$CONTAINER button.close + +sleep 50 // Check that the alert container is now empty -assertText css=.t-alert-container, +assertText css=$CONTAINER, } @Test -void ajax_update_and_remove() -{ -openLinks Alerts Demo, reset +void ajax_update_and_remove() { +openLinks Alerts Demo, Reset Alerts Storage select css=#ajax select[name=\severity\], Error select css=#ajax select[name=\duration\], Until Dismissed @@ -62,23 +68,24 @@ class AlertsTests extends SeleniumTestCase click //input[@value='Ajax Update'] -sleep 200 +sleep 50 // Give page time to fully initialize + +waitForCSSSelectedElementToAppear $CONTAINER .alert assertTextPresent ajax error until -click link=Dismiss all +click css=$CONTAINER .btn.btn-mini // Check that the alert container is now empty -assertText css=.t-alert-container, +assertText css=$CONTAINER, } /** Disabled by HLS 7-oct-2011; there's a timing issue that makes it very fragile. */ @Test(enabled = false) -void ajax_update_with_redirect() -{ +void ajax_update_with_redirect() { -openLinks Alerts Demo, reset +openLinks Alerts Demo, Reset Alerts Storage select css=#ajax select[name=\severity\], Error select css=#ajax select[name=\duration\], Single @@ -96,24 +103,11 @@ class AlertsTests extends SeleniumTestCase click link=Dismiss all } -/** #1633 - alerts shouldn't hard-code the 'Dismiss all' label... */ @Test -void dismiss_label_is_parameter() -{ -openLinks Alerts Demo, reset -select id=severity, Warn -select id=duration, Until Dismissed -type id=message, I'm sorry, Hal, I can't do that. -clickAndWait //input[@value='Traditional Update'] -assertTextPresent I'm sorry, Hal, I can't do that. -assertTrue isElementPresent(link=Zenbu Kesu) -} - -@Test -void check_informal_parameters() -{ +void
[9/9] git commit: Handle the case where Prototype may not yet have loaded when waitForCSSSelectedElementToAppear is invoked
Handle the case where Prototype may not yet have loaded when waitForCSSSelectedElementToAppear is invoked Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3dd5c8e0 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3dd5c8e0 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3dd5c8e0 Branch: refs/heads/5.4-js-rewrite Commit: 3dd5c8e0455baabcea50a834f825bb4cab85bb02 Parents: 2ce2925 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 09:23:40 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 09:23:40 2012 -0800 -- .../apache/tapestry5/test/SeleniumTestCase.java|2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3dd5c8e0/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java -- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java index 3f7b33b..59d754e 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java @@ -1346,7 +1346,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium */ protected void waitForCSSSelectedElementToAppear(String cssRule) { -String condition = String.format(window.$$(\%s\).size() 0, cssRule); +String condition = String.format(window.$$ window.$$(\%s\).size() 0, cssRule); waitForCondition(condition, PAGE_LOAD_TIMEOUT); }
[7/9] git commit: Fix broken BeanEditor tests
Fix broken BeanEditor tests Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/59c5d3d3 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/59c5d3d3 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/59c5d3d3 Branch: refs/heads/5.4-js-rewrite Commit: 59c5d3d3cda90384be00025c96ab72a25e62f43b Parents: e59b5e4 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 09:27:51 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 09:27:51 2012 -0800 -- .../integration/app1/BeanEditorTests.java |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/59c5d3d3/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java index 46d5c13..12749e6 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java @@ -1,4 +1,4 @@ -// Copyright 2009, 2011 The Apache Software Foundation +// Copyright 2009, 2011, 2012 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ public class BeanEditorTests extends TapestryCoreTestCase type(path, /var/www); clickAndWait(//input[@value='Set Access']); -assertTextSeries(//li[%d], 1, First Name: [Howard], Last Name: [Lewis Ship], +assertTextSeries(//div[@class='main']//li[%d], 1, First Name: [Howard], Last Name: [Lewis Ship], Path: [/var/www], Role: [GRANT]); } @@ -181,7 +181,8 @@ public class BeanEditorTests extends TapestryCoreTestCase clickAndWait(SUBMIT); -assertText(//div[@id='content']//h1, Nested BeanDisplay); + +assertTextPresent(Nested BeanDisplay); // As usual, Selenium is fighting me in terms of extracting data, so the // above check just ensures
[6/9] git commit: When reporting a failure, include the recent Selenium server logs
When reporting a failure, include the recent Selenium server logs Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/be3d6eea Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/be3d6eea Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/be3d6eea Branch: refs/heads/5.4-js-rewrite Commit: be3d6eeae3dcce641fd43c5af379d85ac1d52ee6 Parents: 59c5d3d Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 10:29:43 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 10:29:43 2012 -0800 -- .../test/ErrorReportingCommandProcessor.java | 44 ++- 1 files changed, 29 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/be3d6eea/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java -- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java index 08fd181..9711cf4 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java @@ -1,4 +1,4 @@ -// Copyright 2007, 2009 The Apache Software Foundation +// Copyright 2007, 2009, 2012 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. @@ -55,10 +55,31 @@ public class ErrorReportingCommandProcessor implements CommandProcessor builder.append(): ); builder.append(ex.toString()); +try +{ +String logs = delegate.getString(retrieveLastRemoteControlLogs, new String[]{}); + +if (logs != null logs.length() 0) +{ + +builder.append(\n); +builder.append(BORDER); + +builder.append(logs); +} + +} catch (Exception ex2) +{ +// Skip the logs. +} + + +builder.append(\n); builder.append(BORDER); System.err.println(builder.toString()); + errorReporter.writeErrorReport(); } @@ -67,8 +88,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.doCommand(command, args); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(command, args, ex); throw ex; @@ -80,8 +100,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getBoolean(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex; @@ -93,8 +112,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getBooleanArray(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex; @@ -106,8 +124,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getNumber(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex; @@ -119,8 +136,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getNumberArray(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex; @@ -132,8 +148,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getString(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex; @@ -145,8 +160,7 @@ public class ErrorReportingCommandProcessor implements CommandProcessor try { return delegate.getStringArray(string, strings); -} -catch (RuntimeException ex) +} catch (RuntimeException ex) { reportError(string, strings, ex); throw ex;
[3/9] git commit: When reporting errors, write an additional .txt file that captures information about the failure, including recent log entries of the Selenium server
When reporting errors, write an additional .txt file that captures information about the failure, including recent log entries of the Selenium server Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/989f9618 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/989f9618 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/989f9618 Branch: refs/heads/5.4-js-rewrite Commit: 989f9618d9454e430804d39be400199356eb2eef Parents: 3c4ee26 Author: Howard M. Lewis Ship hls...@apache.org Authored: Mon Nov 26 10:53:27 2012 -0800 Committer: Howard M. Lewis Ship hls...@apache.org Committed: Mon Nov 26 10:53:27 2012 -0800 -- .../org/apache/tapestry5/test/ErrorReporter.java |6 +- .../apache/tapestry5/test/ErrorReporterImpl.java | 39 +++-- .../test/ErrorReportingCommandProcessor.java | 14 +- .../apache/tapestry5/test/SeleniumTestCase.java| 142 ++- 4 files changed, 131 insertions(+), 70 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/989f9618/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java -- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java index acf3423..7df8487 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java @@ -1,4 +1,4 @@ -// Copyright 2009 The Apache Software Foundation +// Copyright 2009, 2012 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ public interface ErrorReporter /** * Writes an error report file into the TestNG output directory, based on the name of the test, * containing the current page content. + * + * @param reportText text to store in an associated .txt file, describing the failure. */ -void writeErrorReport(); +void writeErrorReport(String reportText); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/989f9618/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java -- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java index 84e3e08..fe75289 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java @@ -1,4 +1,4 @@ -// Copyright 2009, 2010 The Apache Software Foundation +// Copyright 2009, 2010, 2012 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class ErrorReporterImpl implements ErrorReporter } -public void writeErrorReport() +public void writeErrorReport(String reportText) { String htmlSource = commandProcessor.getString(getHtmlSource, new String[] {}); @@ -88,23 +88,17 @@ public class ErrorReporterImpl implements ErrorReporter previousNames.add(baseFileName); } -File report = new File(dir, baseFileName + .html); +File report = new File(dir, baseFileName + .txt); -System.err.println(Writing current page's HTML source to: + report); +System.err.println(Writing failure report to: + report); -try -{ -FileWriter fw = new FileWriter(report); +writeContent(report, reportText); -fw.write(htmlSource); +File capturedSource = new File(dir, baseFileName + .html); -outputPaths.add(report); +System.err.println(Writing current page's HTML source to: + capturedSource); -fw.close(); -} catch (IOException ex) -{ -// Ignore. -} +writeContent(capturedSource, htmlSource); File capture = new File(dir, baseFileName + .png); @@ -122,4 +116,21 @@ public class ErrorReporterImpl implements ErrorReporter } } +private void writeContent(File file, String content) +{ +try +{ +FileWriter fw = new FileWriter(file); + +fw.write(content); + +outputPaths.add(file); + +fw.close(); +} catch (IOException ex) +{ +// Ignore. +} +} + }