[seam-commits] Seam SVN: r9537 - in trunk/src: test/unit/org/jboss/seam/test/unit and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Nov 10 07:12:20 EST 2008
Author: shane.bryzak at jboss.com
Date: 2008-11-10 07:12:19 -0500 (Mon, 10 Nov 2008)
New Revision: 9537
Modified:
trunk/src/remoting/org/jboss/seam/remoting/Call.java
trunk/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java
Log:
fix tests
Modified: trunk/src/remoting/org/jboss/seam/remoting/Call.java
===================================================================
--- trunk/src/remoting/org/jboss/seam/remoting/Call.java 2008-11-10 09:54:23 UTC (rev 9536)
+++ trunk/src/remoting/org/jboss/seam/remoting/Call.java 2008-11-10 12:12:19 UTC (rev 9537)
@@ -89,6 +89,16 @@
{
return result;
}
+
+ /**
+ * Required for unit tests
+ *
+ * @param result
+ */
+ public void setResult(Object result)
+ {
+ this.result = result;
+ }
/**
* Returns the id of this call.
@@ -110,6 +120,16 @@
{
return constraints;
}
+
+ /**
+ * Required for unit tests
+ *
+ * @param constraints
+ */
+ public void setConstraints(List<String> constraints)
+ {
+ this.constraints = constraints;
+ }
/**
* Execute this call
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java 2008-11-10 09:54:23 UTC (rev 9536)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java 2008-11-10 12:12:19 UTC (rev 9537)
@@ -34,6 +34,7 @@
import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.init.Initialization;
import org.jboss.seam.mock.MockServletContext;
+import org.jboss.seam.remoting.Call;
import org.jboss.seam.remoting.CallContext;
import org.jboss.seam.remoting.MarshalUtils;
import org.jboss.seam.remoting.client.ParserUtils;
@@ -738,11 +739,12 @@
result.setSecret("bar");
ByteArrayOutputStream out = new ByteArrayOutputStream();
-
+
// Constrain a single field of the result
- List<String> constraints = Arrays.asList(new String[] { "secret" });
- MarshalUtils.marshalResult(null, new CallContext(), out, result,
- constraints);
+ Call c = new Call(null, null, null);
+ c.setConstraints(Arrays.asList(new String[] { "secret" }));
+ c.setResult(result);
+ MarshalUtils.marshalResult(c, out);
SAXReader xmlReader = new SAXReader();
Document doc = xmlReader.read(new StringReader(new String(out
@@ -766,9 +768,8 @@
out.reset();
// Now we're going to constrain result.child's secret field
- constraints = Arrays.asList(new String[] { "child.secret" });
- MarshalUtils.marshalResult(null, new CallContext(), out, result,
- constraints);
+ c.setConstraints(Arrays.asList(new String[] { "child.secret" }));
+ MarshalUtils.marshalResult(c, out);
doc = xmlReader.read(new StringReader(new String(out.toByteArray())));
widget = (Widget) ParserUtils.unmarshalResult(doc.getRootElement());
@@ -789,10 +790,8 @@
// Constrain the "secret" field of the widgetMap map's values (sounds
// confusing, I know...)
- constraints = Arrays
- .asList(new String[] { "widgetMap[value].secret" });
- MarshalUtils.marshalResult(null, new CallContext(), out, result,
- constraints);
+ c.setConstraints(Arrays.asList(new String[] { "widgetMap[value].secret" }));
+ MarshalUtils.marshalResult(c, out);
doc = xmlReader.read(new StringReader(new String(out.toByteArray())));
widget = (Widget) ParserUtils.unmarshalResult(doc.getRootElement());
@@ -812,9 +811,8 @@
result.getWidgetList().add(item);
// Constraint the "secret" field of widgetList
- constraints = Arrays.asList(new String[] { "widgetList.secret" });
- MarshalUtils.marshalResult(null, new CallContext(), out, result,
- constraints);
+ c.setConstraints(Arrays.asList(new String[] { "widgetList.secret" }));
+ MarshalUtils.marshalResult(c, out);
doc = xmlReader.read(new StringReader(new String(out.toByteArray())));
widget = (Widget) ParserUtils.unmarshalResult(doc.getRootElement());
@@ -827,10 +825,8 @@
out.reset();
// Now constrain all secrets
- constraints = Arrays
- .asList(new String[] { "[" + Widget.class.getName() + "].secret" });
- MarshalUtils.marshalResult(null, new CallContext(), out, result,
- constraints);
+ c.setConstraints(Arrays.asList(new String[] { "[" + Widget.class.getName() + "].secret" }));
+ MarshalUtils.marshalResult(c, out);
doc = xmlReader.read(new StringReader(new String(out.toByteArray())));
widget = (Widget) ParserUtils.unmarshalResult(doc.getRootElement());
More information about the seam-commits
mailing list