Package com.opensymphony.xwork2.util

Examples of com.opensymphony.xwork2.util.ValueStack.push()


    public void testFindConversionMappingForInterface() {
        ModelDrivenAnnotationAction2 action = new ModelDrivenAnnotationAction2();
        ValueStack stack = ActionContext.getContext().getValueStack();
        stack.push(action);
        stack.push(action.getModel());

        Map<String, Object> ognlStackContext = stack.getContext();
        ognlStackContext.put(XWorkConverter.REPORT_CONVERSION_ERRORS, Boolean.TRUE);

        String value = "asdf:123";
View Full Code Here


        stackContext.put(ReflectionContextState.CREATE_NULL_OBJECTS, Boolean.TRUE);
        stackContext.put(ReflectionContextState.DENY_METHOD_EXECUTION, Boolean.TRUE);
        stackContext.put(XWorkConverter.REPORT_CONVERSION_ERRORS, Boolean.TRUE);

        AnnotationUser user = new AnnotationUser();
        stack.push(user);

        stack.setValue("list", "asdf");
        assertNotNull(user.getList());
        assertEquals(1, user.getList().size());
        assertEquals(String.class, user.getList().get(0).getClass());
View Full Code Here

        assertEquals(new BigInteger("123"), converter.convertValue(context, null, null, null, "123", BigInteger.class));
    }

    public void testValueStackWithTypeParameter() {
        ValueStack stack = ActionContext.getContext().getValueStack();
        stack.push(new Foo1());
        Bar1 bar = (Bar1) stack.findValue("bar", Bar1.class);
        assertNotNull(bar);
    }

    public void testGenericProperties() {
View Full Code Here

    }

    public void testGenericProperties() {
        GenericsBean gb = new GenericsBean();
        ValueStack stack = ac.getValueStack();
        stack.push(gb);

        String[] value = new String[] {"123.12", "123.45"};
        stack.setValue("doubles", value);
        assertEquals(2, gb.getDoubles().size());
        assertEquals(Double.class, gb.getDoubles().get(0).getClass());
View Full Code Here

    }

    public void testGenericPropertiesFromField() {
        GenericsBean gb = new GenericsBean();
        ValueStack stack = ac.getValueStack();
        stack.push(gb);

        stack.setValue("genericMap[123.12]", "66");
        stack.setValue("genericMap[456.12]", "42");

        assertEquals(2, gb.getGenericMap().size());
View Full Code Here

    }

    public void testGenericPropertiesFromSetter() {
        GenericsBean gb = new GenericsBean();
        ValueStack stack = ac.getValueStack();
        stack.push(gb);

        stack.setValue("genericMap[123.12]", "66");
        stack.setValue("genericMap[456.12]", "42");

        assertEquals(2, gb.getGenericMap().size());
View Full Code Here

    }

    public void testGenericPropertiesFromGetter() {
        GenericsBean gb = new GenericsBean();
        ValueStack stack = ac.getValueStack();
        stack.push(gb);

        assertEquals(1, gb.getGetterList().size());
        assertEquals(Double.class, stack.findValue("getterList.get(0).class"));
        assertEquals(new Double(42.42), stack.findValue("getterList.get(0)"));
        assertEquals(new Double(42.42), gb.getGetterList().get(0));
View Full Code Here

    // FIXME: Implement nested Generics such as: List of Generics List, Map of Generic keys/values, etc...
    public void no_testGenericPropertiesWithNestedGenerics() {
        GenericsBean gb = new GenericsBean();
        ValueStack stack = ac.getValueStack();
        stack.push(gb);

        stack.setValue("extendedMap[123.12]", new String[] {"1", "2", "3", "4"});
        stack.setValue("extendedMap[456.12]", new String[] {"5", "6", "7", "8", "9"});

        System.out.println("gb.getExtendedMap(): " + gb.getExtendedMap());
View Full Code Here

        String location = "/myaction.action";
        Bean bean = new Bean();
        bean.setLocation(location);

        ValueStack stack = ActionContext.getContext().getValueStack();
        stack.push(bean);

        assertEquals(location, stack.findValue("location"));

        result.setLocation("${location}");
        result.execute(actionInvocation);
View Full Code Here

        super.tearDown();
        converter = null;
    }
    public void testNormalBehaviour() {
        final ValueStack stack = ActionContext.getContext().getValueStack();
        stack.push(new FooBar("foo-value", "bar-value"));
        final Property property = new Property(stack);
        property.setDefault("default");
        property.setValue("foo");
        assertPropertyOutput("foo-value", property);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.