Target Unreachable, resolved to null while running testng
senthilnz Dec 9, 2010 7:10 PMHi,
I have this below code,
public class AuthenticatorBeanTest extends SeamTest{
@Test
public void testLoginComponent() throws Exception
{
new ComponentTest() {
@Override
protected void testComponents() throws Exception
{
assert getValue("#{identity.loggedIn}").equals(false);
setValue("#{identity.username}", "simplerun");
setValue("#{identity.password}", "changepwd");
invokeMethod("#{identity.login}");
}
}.run();
}
@Test
public void testBookHotel() throws Exception
{
//@Test
new FacesRequest("/customer/filter.xhtml") {
@Override
protected void updateModelValues() throws Exception
{
setValue("#{customerManager.filter.name}", "testingName");
}
@Override
protected void invokeApplication()
{
assert invokeAction("#{customerManager.loadResultList}")==null;
}
@Override
protected void renderResponse()
{
DataModel hotels = (DataModel) Contexts.getSessionContext().get("booking");
assert hotels.getRowCount()==1;
assert getValue("#{bookingManager.getResultList}").equals("");
assert !Manager.instance().isLongRunningConversation();
}
}.run();
}
}
The filter.xhtml is located under folder of view/customer/filter.xhtml with the following below code,
<rich:simpleTogglePanel xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j" label="Customer Filter" opened="true" switchType="client">
<h:form id="form_filter" >
<table>
<tr>
<td><h:outputLabel value="Customer Surname:" /></td>
<td>
<h:inputText value="#{customerManager.filter.name}" />
</td>
<td><a4j:commandButton action="#{customerManager.loadResultList()}" reRender="list_customer" value="Search" style="margin-bottom: 4px;" /></td>
<td><a4j:commandButton action="#{customerManager.resetFilter()}" reRender="list_customer,form_filter" value="Reset" style="margin-bottom: 4px;" />
</td>
</tr>
</table>
</h:form>
</rich:simpleTogglePanel>
Where my testLoginComponent is working but the testBookHotel is not working and it throws the below exception,
java.lang.AssertionError: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'customerManager' resolved to null
at org.jboss.seam.mock.AbstractSeamTest$Request.onException(AbstractSeamTest.java:455)
at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:504)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
Can anyone help me please, I already spent two days on this but no breakthrough.
Thanks in advance!
Regards,
Senthil
I have this below code,
public class AuthenticatorBeanTest extends SeamTest{
@Test
public void testLoginComponent() throws Exception
{
new ComponentTest() {
@Override
protected void testComponents() throws Exception
{
assert getValue("#{identity.loggedIn}").equals(false);
setValue("#{identity.username}", "simplerun");
setValue("#{identity.password}", "changepwd");
invokeMethod("#{identity.login}");
}
}.run();
}
@Test
public void testBookHotel() throws Exception
{
//@Test
new FacesRequest("/customer/filter.xhtml") {
@Override
protected void updateModelValues() throws Exception
{
setValue("#{customerManager.filter.name}", "testingName");
}
@Override
protected void invokeApplication()
{
assert invokeAction("#{customerManager.loadResultList}")==null;
}
@Override
protected void renderResponse()
{
DataModel hotels = (DataModel) Contexts.getSessionContext().get("booking");
assert hotels.getRowCount()==1;
assert getValue("#{bookingManager.getResultList}").equals("");
assert !Manager.instance().isLongRunningConversation();
}
}.run();
}
}
The filter.xhtml is located under folder of view/customer/filter.xhtml with the following below code,
<rich:simpleTogglePanel xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j" label="Customer Filter" opened="true" switchType="client">
<h:form id="form_filter" >
<table>
<tr>
<td><h:outputLabel value="Customer Surname:" /></td>
<td>
<h:inputText value="#{customerManager.filter.name}" />
</td>
<td><a4j:commandButton action="#{customerManager.loadResultList()}" reRender="list_customer" value="Search" style="margin-bottom: 4px;" /></td>
<td><a4j:commandButton action="#{customerManager.resetFilter()}" reRender="list_customer,form_filter" value="Reset" style="margin-bottom: 4px;" />
</td>
</tr>
</table>
</h:form>
</rich:simpleTogglePanel>
Where my testLoginComponent is working but the testBookHotel is not working and it throws the below exception,
java.lang.AssertionError: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'customerManager' resolved to null
at org.jboss.seam.mock.AbstractSeamTest$Request.onException(AbstractSeamTest.java:455)
at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:504)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
Can anyone help me please, I already spent two days on this but no breakthrough.
Thanks in advance!
Regards,
Senthil