Search in sources :

Example 46 with Result

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

the class XSLTResultTest method testPassingNullInvocation.

public void testPassingNullInvocation() throws Exception {
    Result result = new XSLTResult();
    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) ActionChainResult(com.opensymphony.xwork2.ActionChainResult)

Example 47 with Result

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

the class SpringObjectFactoryTest method testFallsBackToDefaultObjectFactoryResultBuilding.

public void testFallsBackToDefaultObjectFactoryResultBuilding() throws Exception {
    ResultConfig rConfig = new ResultConfig.Builder(Action.SUCCESS, ActionChainResult.class.getName()).build();
    Result result = objectFactory.buildResult(rConfig, ActionContext.getContext().getContextMap());
    assertEquals(ActionChainResult.class, result.getClass());
}
Also used : ResultConfig(com.opensymphony.xwork2.config.entities.ResultConfig) Result(com.opensymphony.xwork2.Result) ActionChainResult(com.opensymphony.xwork2.ActionChainResult)

Example 48 with Result

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

the class DefaultResultFactory 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) {
            for (Map.Entry<String, String> paramEntry : params.entrySet()) {
                try {
                    reflectionProvider.setProperty(paramEntry.getKey(), paramEntry.getValue(), result, extraContext, true);
                } catch (ReflectionException ex) {
                    if (result instanceof ReflectionExceptionHandler) {
                        ((ReflectionExceptionHandler) result).handle(ex);
                    }
                }
            }
        }
    }
    return result;
}
Also used : ReflectionException(com.opensymphony.xwork2.util.reflection.ReflectionException) ReflectionExceptionHandler(com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler) Map(java.util.Map) Result(com.opensymphony.xwork2.Result)

Example 49 with Result

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

the class PlainResultTest method testPassingNullInvocation.

public void testPassingNullInvocation() throws Exception {
    Result result = (PlainResult) response -> response.write("ignore");
    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 50 with Result

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

the class StrutsResultFactoryTest method testAcceptParams.

public void testAcceptParams() throws Exception {
    // given
    initDispatcherWithConfigs("struts-default.xml");
    StrutsResultFactory builder = (StrutsResultFactory) container.getInstance(ResultFactory.class);
    Map<String, String> params = new HashMap<String, String>();
    params.put("accept", "ok");
    params.put("reject", "bad");
    ResultConfig config = new ResultConfig.Builder("struts", MyResult.class.getName()).addParams(params).build();
    // when
    Result result = builder.buildResult(config, ActionContext.getContext().getContextMap());
    // then
    assertEquals("ok", ((MyResult) result).getAccept());
    assertEquals("ok", ((MyResult) result).getReject());
}
Also used : ResultConfig(com.opensymphony.xwork2.config.entities.ResultConfig) HashMap(java.util.HashMap) ResultFactory(com.opensymphony.xwork2.factory.ResultFactory) Result(com.opensymphony.xwork2.Result) ParamNameAwareResult(com.opensymphony.xwork2.result.ParamNameAwareResult)

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