Package com.opensymphony.xwork2.config.entities

Examples of com.opensymphony.xwork2.config.entities.ResultConfig


        if (_actionForwards == null) {
            _actionForwards = new HashMap();
            for (Iterator i = delegate.getGlobalResultConfigs().entrySet().iterator(); i.hasNext();) {
                Map.Entry entry = (Map.Entry) i.next();
                String name = (String) entry.getKey();
                ResultConfig config = (ResultConfig) entry.getValue();
                _actionForwards.put(name, strutsFactory.createActionForward(config));
            }
        }
    }
View Full Code Here


        ActionConfig parentActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "parentAction");
        ActionConfig anotherActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "anotherAction");
        ActionConfig childActionConfig = configuration.getRuntimeConfiguration().getActionConfig("/base", "childAction");

        ResultConfig parentResultConfig1 = parentActionConfig.getResults().get("mockResult1");
        ResultConfig parentResultConfig2 = parentActionConfig.getResults().get("mockResult2");
        ResultConfig anotherResultConfig1 = anotherActionConfig.getResults().get("mockResult1");
        ResultConfig anotherResultConfig2 = anotherActionConfig.getResults().get("mockResult2");
        ResultConfig childResultConfig1 = childActionConfig.getResults().get("mockResult1");
        ResultConfig childResultConfig2 = childActionConfig.getResults().get("mockResult2");

        System.out.println(parentResultConfig1.getParams().get("identity"));
        System.out.println(parentResultConfig2.getParams().get("identity"));
        System.out.println(anotherResultConfig1.getParams().get("identity"));
        System.out.println(anotherResultConfig2.getParams().get("identity"));
        System.out.println(childResultConfig1.getParams().get("identity"));
        System.out.println(childResultConfig2.getParams().get("identity"));

        assertFalse(parentResultConfig1 == anotherResultConfig1);
        assertFalse(parentResultConfig2 == anotherResultConfig2);

        assertFalse(parentResultConfig1 == childResultConfig1);
View Full Code Here

   
   
    ActionConfig action1ActionConfig = (ActionConfig) actionConfigMap.get("action1");
    ActionConfig action2ActionConfig = (ActionConfig) actionConfigMap.get("action2");
   
    ResultConfig action1Result = (ResultConfig) action1ActionConfig.getResults().get("success");
    ResultConfig action2Result = (ResultConfig) action2ActionConfig.getResults().get("success");
   
    assertEquals(action1Result.getName(), "success");
    assertEquals(action1Result.getClassName(), "com.opensymphony.xwork2.mock.MockResult");
    assertEquals(action1Result.getName(), "success");
    assertEquals(action1Result.getClassName(), "com.opensymphony.xwork2.mock.MockResult");
   
    Map action1ResultMap = action1Result.getParams();
    Map action2ResultMap = action2Result.getParams();
   
    assertEquals(action1ResultMap.size(), 5);
    assertTrue(action1ResultMap.containsKey("param1"));
    assertTrue(action1ResultMap.containsKey("param2"));
    assertTrue(action1ResultMap.containsKey("param3"));
View Full Code Here

        }
        params.put(resultTypeConfig.getDefaultResultParam(), path);

        PackageConfig pkg = configuration.getPackageConfig(defaultParentPackageName);
        List<InterceptorMapping> interceptors = InterceptorBuilder.constructInterceptorReference(pkg, pkg.getFullDefaultInterceptorRef(), Collections.<String, String>emptyMap(), null, objectFactory);
        ResultConfig config = new ResultConfig.Builder(Action.SUCCESS, resultTypeConfig.getClassName()).
                addParams(params).build();
        results.put(Action.SUCCESS, config);

        return new ActionConfig.Builder(defaultParentPackageName, "execute", ActionSupport.class.getName()).
                addInterceptors(interceptors).addResultConfigs(results).build();
View Full Code Here

        if (config.getParams() != null) {
            params.putAll(config.getParams());
        }
        params.put(config.getDefaultResultParam(), path);

        ResultConfig resultConfig = new ResultConfig.Builder(resultCode, resultClass).addParams(params).build();
        try {
            return objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
        } catch (Exception e) {
            throw new XWorkException("Unable to build convention result", e, resultConfig);
        }
View Full Code Here

        assertEquals(ModelDrivenInterceptor.class, interceptor.getClass());
    }

    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());
    }
View Full Code Here

    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());
    }
View Full Code Here

        assertEquals(ParametersInterceptor.class, ((InterceptorMapping) actionConfig.getInterceptors().get(0)).getInterceptor().getClass());
        assertNotNull(actionConfig.getResults());
        assertEquals(1, actionConfig.getResults().size());
        assertTrue(actionConfig.getResults().containsKey("success"));

        ResultConfig resultConfig = (ResultConfig) actionConfig.getResults().get("success");
        assertEquals(ActionChainResult.class.getName(), resultConfig.getClassName());
    }
View Full Code Here

        assertTrue("Wrong exception",
                "java.lang.methodException".equals(ex.getExceptionClassName()));
        assertTrue("First param isn't correct", "class".equals(ex.getParams().get("first")));
        assertTrue("Second param isn't correct", "method".equals(ex.getParams().get("second")));
       
        ResultConfig result = m.getResults().get("successclass");
        assertTrue("Wrong name, was "+result.getName(), "successclass".equals(result.getName()));
        assertTrue("Wrong classname", "foo.method".equals(result.getClassName()));
        assertTrue("First param isn't correct", "class".equals(result.getParams().get("first")));
        assertTrue("Second param isn't correct", "method".equals(result.getParams().get("second")));
       
    }
View Full Code Here

        }

        if (result == null && hasErrors && defaultErrorResultName != null) {

            // Get default error result
            ResultConfig resultConfig = this.proxy.getConfig().getResults().get(defaultErrorResultName);
            if (resultConfig != null) {
                this.result = objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Found default error result.");
                }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.config.entities.ResultConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.