Lifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
Lifecycle.beginRequest( externalContext );
Manager.instance().setCurrentConversationId("1");
Lifecycle.resumeConversation(externalContext);
ConversationalInterceptor ci = new ConversationalInterceptor();
ci.setComponent( new Component(Bar.class, appContext) );
assert !Manager.instance().isLongRunningConversation();
String result = (String) ci.aroundInvoke( new MockInvocationContext() {
@Override
public Method getMethod()
{
return InterceptorTest.getMethod("foo");
}
@Override
public Object proceed() throws Exception
{
assert false;
return null;
}
});
//assert !Manager.instance().isLongRunningConversation();
assert "error".equals(result);
result = (String) ci.aroundInvoke( new MockInvocationContext() {
@Override
public Method getMethod()
{
return InterceptorTest.getMethod("begin");
}
@Override
public Object proceed() throws Exception
{
return "begun";
}
});
Manager.instance().initializeTemporaryConversation();
Manager.instance().beginConversation("bar");
//assert Manager.instance().isLongRunningConversation();
assert "begun".equals(result);
result = (String) ci.aroundInvoke( new MockInvocationContext() {
@Override
public Method getMethod()
{
return InterceptorTest.getMethod("foo");
}
@Override
public Object proceed() throws Exception
{
return "foo";
}
});
//assert Manager.instance().isLongRunningConversation();
assert "foo".equals(result);
result = (String) ci.aroundInvoke( new MockInvocationContext() {
@Override
public Method getMethod()
{
return InterceptorTest.getMethod("end");
}