Search in sources :

Example 6 with Result

use of com.walmartlabs.concord.plugins.s3.Result in project struts by apache.

the class PostbackResultTest method testPassingNullInvocation.

public void testPassingNullInvocation() throws Exception {
    Result result = new PostbackResult();
    try {
        result.execute(null);
        fail("Exception should be thrown!");
    } catch (IllegalArgumentException e) {
        assertEquals("Invocation cannot be null!", e.getMessage());
    }
}
Also used : Result(com.opensymphony.xwork2.Result)

Example 7 with Result

use of com.walmartlabs.concord.plugins.s3.Result in project struts by apache.

the class ServletRedirectResultTest method testPassingNullInvocation.

public void testPassingNullInvocation() throws Exception {
    Result result = new ServletRedirectResult();
    try {
        result.execute(null);
        fail("Exception should be thrown!");
    } catch (IllegalArgumentException e) {
        assertEquals("Invocation cannot be null!", e.getMessage());
    }
}
Also used : Result(com.opensymphony.xwork2.Result)

Example 8 with Result

use of com.walmartlabs.concord.plugins.s3.Result in project struts by apache.

the class StrutsResultFactory method buildResult.

public Result buildResult(ResultConfig resultConfig, Map<String, Object> extraContext) throws Exception {
    String resultClassName = resultConfig.getClassName();
    Result result = null;
    if (resultClassName != null) {
        result = (Result) objectFactory.buildBean(resultClassName, extraContext);
        Map<String, String> params = resultConfig.getParams();
        if (params != null) {
            setParameters(extraContext, result, params);
        }
    }
    return result;
}
Also used : Result(com.opensymphony.xwork2.Result) ParamNameAwareResult(com.opensymphony.xwork2.result.ParamNameAwareResult)

Example 9 with Result

use of com.walmartlabs.concord.plugins.s3.Result in project struts by apache.

the class TokenSessionStoreInterceptor method handleInvalidToken.

/**
 * Handles processing of invalid tokens.  If a previously stored invocation is
 * available, the method will attempt to return and render its result.  Otherwise
 * it will return INVALID_TOKEN_CODE.
 *
 * Note: Because a stored (previously completed) invocation's PageContext will be closed,
 *   this method must replace the stored PageContext with the current invocation's one (or a null).
 *   See {@link org.apache.struts2.util.InvocationSessionStore#loadInvocation(String key, String token)} for details.
 *
 * @param invocation
 *
 * @return
 * @throws Exception
 */
@Override
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
    ActionContext ac = invocation.getInvocationContext();
    HttpServletRequest request = ac.getServletRequest();
    HttpServletResponse response = ac.getServletResponse();
    String tokenName = TokenHelper.getTokenName();
    String token = TokenHelper.getToken(tokenName);
    if ((tokenName != null) && (token != null)) {
        HttpParameters params = ac.getParameters();
        params.remove(tokenName);
        params.remove(TokenHelper.TOKEN_NAME_FIELD);
        String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
        ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(sessionTokenName, token);
        if (savedInvocation != null) {
            // set the savedInvocation's valuestack to the request scope
            ValueStack stack = savedInvocation.getStack();
            request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
            ActionContext savedContext = savedInvocation.getInvocationContext();
            savedContext.getContextMap().put(ServletActionContext.HTTP_REQUEST, request);
            savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response);
            Result result = savedInvocation.getResult();
            if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
                result.execute(savedInvocation);
            }
            // turn off execution of this invocations result
            invocation.getProxy().setExecuteResult(false);
            return savedInvocation.getResultCode();
        }
    }
    return INVALID_TOKEN_CODE;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpParameters(org.apache.struts2.dispatcher.HttpParameters) ValueStack(com.opensymphony.xwork2.util.ValueStack) ActionInvocation(com.opensymphony.xwork2.ActionInvocation) HttpServletResponse(javax.servlet.http.HttpServletResponse) ActionContext(com.opensymphony.xwork2.ActionContext) ServletActionContext(org.apache.struts2.ServletActionContext) Result(com.opensymphony.xwork2.Result)

Example 10 with Result

use of com.walmartlabs.concord.plugins.s3.Result in project struts by apache.

the class SpringObjectFactoryTest method testObtainResultBySpringName.

public void testObtainResultBySpringName() throws Exception {
    // TODO: Does this need to be a prototype?
    sac.registerPrototype("chaining-result", ActionChainResult.class, new MutablePropertyValues());
    ResultConfig rConfig = new ResultConfig.Builder(Action.SUCCESS, "chaining-result").build();
    Result result = objectFactory.buildResult(rConfig, ActionContext.getContext().getContextMap());
    assertEquals(ActionChainResult.class, result.getClass());
}
Also used : ResultConfig(com.opensymphony.xwork2.config.entities.ResultConfig) MutablePropertyValues(org.springframework.beans.MutablePropertyValues) Result(com.opensymphony.xwork2.Result) ActionChainResult(com.opensymphony.xwork2.ActionChainResult)

Aggregations

Test (org.junit.Test)46 Result (edu.stanford.CVC4.Result)35 Expr (edu.stanford.CVC4.Expr)32 SExpr (edu.stanford.CVC4.SExpr)32 CVC4.vectorExpr (edu.stanford.CVC4.vectorExpr)31 Rational (edu.stanford.CVC4.Rational)25 Result (com.opensymphony.xwork2.Result)18 List (java.util.List)15 ArrayList (java.util.ArrayList)13 ArrayType (edu.stanford.CVC4.ArrayType)8 CompletableFuture (java.util.concurrent.CompletableFuture)8 TimeUnit (java.util.concurrent.TimeUnit)8 DataSource (jdk.incubator.sql2.DataSource)8 Result (jdk.incubator.sql2.Result)8 Session (jdk.incubator.sql2.Session)8 AfterClass (org.junit.AfterClass)8 BeforeClass (org.junit.BeforeClass)8 BitVectorType (edu.stanford.CVC4.BitVectorType)6 SortType (edu.stanford.CVC4.SortType)6 Type (edu.stanford.CVC4.Type)6