Author: hermanns Date: Wed Apr 12 10:29:13 2006 New Revision: 393539 URL: http://svn.apache.org/viewcvs?rev=393539&view=rev Log: ANT Unit tests broken o fixed the unit test targets o readded -Dtestcase=<NameOfTestClass> Issue Number: WW-1283
Added: incubator/webwork2/action/src/test/resources/xwork.xml (with props) Modified: incubator/webwork2/action/src/test/java/org/apache/struts/action2/sitegraph/SiteGraphTest.java incubator/webwork2/action/src/test/resources/org/apache/struts/action2/sitegraph/out.txt Modified: incubator/webwork2/action/src/test/java/org/apache/struts/action2/sitegraph/SiteGraphTest.java URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/test/java/org/apache/struts/action2/sitegraph/SiteGraphTest.java?rev=393539&r1=393538&r2=393539&view=diff ============================================================================== --- incubator/webwork2/action/src/test/java/org/apache/struts/action2/sitegraph/SiteGraphTest.java (original) +++ incubator/webwork2/action/src/test/java/org/apache/struts/action2/sitegraph/SiteGraphTest.java Wed Apr 12 10:29:13 2006 @@ -22,6 +22,7 @@ import java.io.File; import java.io.StringWriter; +import java.io.InputStream; import java.net.URL; /** @@ -30,11 +31,11 @@ * Time: 4:18:28 PM */ public class SiteGraphTest extends StrutsTestCase { - public void testWebFlow() { + public void testWebFlow() throws Exception { // use the classloader rather than relying on the // working directory being an assumed value when // running the test: so let's get this class's parent dir - URL url = this.getClass().getClassLoader().getResource(this.getClass().getName().replace(".", "/") + ".class"); + URL url = this.getClass().getClassLoader().getResource(this.getClass().getName().replace('.', '/') + ".class"); File file = new File(url.toString().substring(5)); String dir = file.getParent(); SiteGraph siteGraph = new SiteGraph(dir, dir, dir, ""); @@ -42,7 +43,18 @@ siteGraph.setWriter(writer); siteGraph.prepare(); - String out = dir + "/out.txt"; - assertEquals(FileUtils.readFile(new File(out)), writer.toString()); + URL compare = SiteGraphTest.class.getResource("out.txt"); + StringBuffer buffer = new StringBuffer(128); + InputStream in = compare.openStream(); + byte[] buf = new byte[4096]; + int nbytes; + + while ((nbytes = in.read(buf)) > 0) { + buffer.append(new String(buf, 0, nbytes)); + } + + in.close(); + + assertEquals(buffer.toString(), writer.toString()); } } Modified: incubator/webwork2/action/src/test/resources/org/apache/struts/action2/sitegraph/out.txt URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/test/resources/org/apache/struts/action2/sitegraph/out.txt?rev=393539&r1=393538&r2=393539&view=diff ============================================================================== --- incubator/webwork2/action/src/test/resources/org/apache/struts/action2/sitegraph/out.txt (original) +++ incubator/webwork2/action/src/test/resources/org/apache/struts/action2/sitegraph/out.txt Wed Apr 12 10:29:13 2006 @@ -24,8 +24,6 @@ tutorial_sitegraph_guess -> tutorial_sitegraph_guess_error_ftl [label="error",color="darkseagreen2"]; tutorial_sitegraph_guess -> tutorial_sitegraph_guess_input_ftl [label="input",color="darkseagreen2"]; tutorial_sitegraph_guess -> tutorial_sitegraph_guess_success_jsp [label="redirect: success"]; - tutorial_sitegraph_guess_input_ftl -> tutorial_sitegraph_guess [label="form"]; - tutorial_sitegraph_guess_success_jsp -> tutorial_sitegraph_guess [label="href\n(!default)"]; hello -> hello_jsp [label="success",color="darkseagreen2"]; hello -> tutorial_test [label="redirect: tutorial"]; tutorial_test -> tutorial_sitegraph_guess_input_ftl [label="input",color="darkseagreen2"]; Added: incubator/webwork2/action/src/test/resources/xwork.xml URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/test/resources/xwork.xml?rev=393539&view=auto ============================================================================== --- incubator/webwork2/action/src/test/resources/xwork.xml (added) +++ incubator/webwork2/action/src/test/resources/xwork.xml Wed Apr 12 10:29:13 2006 @@ -0,0 +1,36 @@ +<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN" "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"> + +<xwork> + <include file="struts-default.xml"/> + + <package name="default" extends="struts-default"> + <action name="hello" class="com.opensymphony.xwork.ActionSupport"> + <result name="success">hello.jsp</result> + <result name="tutorial" type="redirect">/tutorial/test.action</result> + </action> + </package> + + <package name="tutorial" namespace="/tutorial" extends="struts-default"> + <result-types> + <result-type name="freemarker" default="true" + class="org.apache.struts.action2.views.freemarker.FreemarkerResult"/> + </result-types> + + <action name="test" class="com.opensymphony.xwork.ActionSupport"> + <result name="input">sitegraph/guess-input.ftl</result> + </action> + </package> + + <package name="sitegraph" namespace="/tutorial/sitegraph" extends="struts-default"> + <result-types> + <result-type name="freemarker" default="true" + class="org.apache.struts.action2.views.freemarker.FreemarkerResult"/> + </result-types> + + <action name="guess" class="com.opensymphony.xwork.ActionSupport"> + <result name="success" type="redirect">guess-success.jsp</result> + <result name="input">guess-input.ftl</result> + <result name="error">guess-error.ftl</result> + </action> + </package> +</xwork> Propchange: incubator/webwork2/action/src/test/resources/xwork.xml ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]