use of org.apache.tapestry5.services.Request in project tapestry-5 by apache.
the class SubmitTest method test_imagesubmit_event_fired.
@Test
public void test_imagesubmit_event_fired() {
Request request = mockRequest();
final ComponentResources resources = mockComponentResources();
FormSupport formSupport = mockFormSupport();
Asset image = mockAsset();
String elementName = "myname";
train_getParameter(request, Form.SUBMITTING_ELEMENT_ID, null);
train_getParameter(request, elementName + ".x", "15");
formSupport.defer(isA(Runnable.class));
replay();
Submit submit = new Submit(request);
TestBase.set(submit, "resources", resources, "formSupport", formSupport, "image", image);
submit.processSubmission("xyz", elementName);
verify();
}
use of org.apache.tapestry5.services.Request in project tapestry-5 by apache.
the class SubmitTest method test_submit_event_fired.
@Test
public void test_submit_event_fired() {
Request request = mockRequest();
final ComponentResources resources = mockComponentResources();
FormSupport formSupport = mockFormSupport();
String elementName = "myname";
train_getParameter(request, Form.SUBMITTING_ELEMENT_ID, null);
train_getParameter(request, elementName, "login");
formSupport.defer(isA(Runnable.class));
replay();
Submit submit = new Submit(request);
TestBase.set(submit, "resources", resources, "formSupport", formSupport);
submit.processSubmission("xyz", elementName);
verify();
}
use of org.apache.tapestry5.services.Request in project tapestry-5 by apache.
the class SessionApplicationStatePersistenceStrategyTest method check_exists_with_invalid_session.
@SuppressWarnings("unchecked")
@Test
@Issue("TAP5-2537")
public void check_exists_with_invalid_session() {
Request request = mockRequest();
Session session = mockSession();
Class asoClass = ReadOnlyBean.class;
train_getSession(request, false, session);
train_isInvalidated(session, true);
replay();
ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(request);
assertFalse(strategy.exists(asoClass));
verify();
}
use of org.apache.tapestry5.services.Request in project tapestry-5 by apache.
the class SessionApplicationStatePersistenceStrategyTest method set_aso.
@SuppressWarnings("unchecked")
@Test
public void set_aso() {
Request request = mockRequest();
Session session = mockSession();
Class asoClass = ReadOnlyBean.class;
Object aso = new ReadOnlyBean();
String key = "sso:" + asoClass.getName();
train_getSession(request, true, session);
session.setAttribute(key, aso);
replay();
ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(request);
strategy.set(asoClass, aso);
verify();
}
use of org.apache.tapestry5.services.Request in project tapestry-5 by apache.
the class SessionApplicationStatePersistenceStrategyTest method get_aso_already_exists.
@SuppressWarnings("unchecked")
@Test
public void get_aso_already_exists() {
Request request = mockRequest();
Session session = mockSession();
Class asoClass = ReadOnlyBean.class;
Object aso = new ReadOnlyBean();
String key = "sso:" + asoClass.getName();
ApplicationStateCreator creator = mockApplicationStateCreator();
train_getSession(request, true, session);
train_getAttribute(session, key, aso);
replay();
ApplicationStatePersistenceStrategy strategy = new SessionApplicationStatePersistenceStrategy(request);
assertSame(strategy.get(asoClass, creator), aso);
verify();
}
Aggregations