[
http://jira.jboss.com/jira/browse/JBSEAM-1804?page=all ]
Christian Bauer closed JBSEAM-1804.
-----------------------------------
Resolution: Rejected
I forgot that we have two page contexts in INVOKE APPLICATION, one for write and one for
read. Sorry, Pete and thanks for pointing this out :)
I solved the original problem (which did not suffer from the two-context issue) in a
different way, by resolving the chain of events into two events that are raised one after
another, instead of chained. This is also much cleaner from several other angles.
Page context instance not recognized in SeamTest
------------------------------------------------
Key: JBSEAM-1804
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1804
Project: JBoss Seam
Issue Type: Bug
Components: Test Harness
Reporter: Christian Bauer
I didn't try CVS yet, this is 3 weeks old CVS. The issue with the following test is
that 'beanB' is instantiated again on every call, be it a Component.getInstance()
lookup or an Event that is fired. The goal of the test is to modify a value in BeanA and
then get this new value into BeanB through a chain of events.
@Name("beanA")
@Scope(ScopeType.CONVERSATION)
@AutoCreate
public class BeanA {
private String myValue;
public String getMyValue() {
return myValue;
}
public void setMyValue(String myValue) {
this.myValue = myValue;
}
@Create
public void create() {
myValue = "Foo";
}
@Observer(value = "BeanA.refreshMyValue")
public void refreshMyValue() {
myValue = "Bar";
Events.instance().raiseEvent("BeanA.valueModified");
}
}
@Name("beanB")
@Scope(ScopeType.PAGE)
@AutoCreate
public class BeanB implements Serializable {
private String myValue;
public String getMyValue() {
return myValue;
}
public void setMyValue(String myValue) {
this.myValue = myValue;
}
@Observer(value = "BeanA.valueModified")
public void takeValueFromBeanA() {
BeanA beanA = (BeanA) Component.getInstance("beanA");
myValue = beanA.getMyValue();
}
}
public class MiscTests extends SeamTest {
@Test
public void eventChain() throws Exception {
new FacesRequest("/docDisplay.xhtml") {
protected void invokeApplication() throws Exception {
BeanA beanA = (BeanA) Component.getInstance("beanA");
BeanB beanB = (BeanB) Component.getInstance("beanB");
assert "Foo".equals(beanA.getMyValue());
assert beanB.getMyValue() == null;
Events.instance().raiseEvent("BeanA.refreshMyValue");
beanA = (BeanA) Component.getInstance("beanA");
beanB = (BeanB) Component.getInstance("beanB");
assert "Bar".equals(beanA.getMyValue());
assert "Bar".equals(beanB.getMyValue());
}
}.run();
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira