com.opensymphony.xwork2.ActionProxy Java Examples

The following examples show how to use com.opensymphony.xwork2.ActionProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestingTest.java    From java2word with MIT License 6 votes vote down vote up
@Test
public void testSanity() throws Exception{
    //pre requirements
    request.setParameter("xml", "this is the xml");

    //kinda of replay()
    ActionProxy proxy = getActionProxy("/testing");
    Testing testingAction = (Testing) proxy.getAction();

    String result = proxy.execute();


    assertEquals("XML entered should be the same in SESSION after execution", "this is the xml", request.getSession().getAttribute("xml"));
    assertEquals("XML entered should be the same after execution", "this is the xml", testingAction.getXml());
    assertNotNull("Request attribute 'res' shouldn't be null", request.getAttribute("res"));
    assertTrue("There shouldn't be any field error.", testingAction.getFieldErrors().size() == 0);
    assertEquals("Result returned when there is an XML should have been 'null'.", null, result);

    //assertTrue("Problem field account.userName not present in fieldErrors but it should have been",
    //        testingAction.getFieldErrors().containsKey("xml") );

}
 
Example #2
Source File: StrutsInterceptor.java    From javamelody with Apache License 2.0 5 votes vote down vote up
protected String getRequestName(ActionInvocation invocation) {
	// final String actionName = invocation.getInvocationContext().getName();
	final String actionName;
	final ActionProxy proxy = invocation.getProxy();
	final String action = proxy.getActionName();
	final String method = proxy.getMethod();
	final String namespace = proxy.getNamespace();
	if (method == null || "execute".equals(method)) {
		actionName = namespace + '/' + action;
	} else {
		actionName = namespace + '/' + action + '!' + method;
	}
	return actionName;
}