Examples of ValueStack


Examples of com.opensymphony.xwork2.util.ValueStack

        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);
        assertEquals(location, result.finalLocation);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

    public void execute(ActionInvocation invocation) throws Exception {
        LOG.info("executing TestResult.");

        if ((expectedValues != null) && (expectedValues.size() > 0) && (propertyNames != null) && (propertyNames.size() > 0))
        {
            ValueStack stack = ActionContext.getContext().getValueStack();

            for (int i = 0; i < propertyNames.size(); i++) {
                String propertyName = (String) propertyNames.get(i);
                String expectedValue = null;

                if (i < expectedValues.size()) {
                    expectedValue = (String) expectedValues.get(i);
                }

                String value = (String) stack.findValue(propertyName, String.class);
                Assert.assertEquals(expectedValue, value);
            }
        } else {
            LOG.error("One of expectedValues = " + expectedValues + " and propertyNames = " + propertyNames + " was null or empty.");
            Assert.fail();
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

public class ComponentUtilsTest extends StrutsInternalTestCase {

    public void testStripExpression() throws Exception {
        // given
        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
        String anExpression = "%{foo}";

        // when
        String actual = ComponentUtils.stripExpressionIfAltSyntax(stack, anExpression);
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

    }

    public void testNoStripExpressionIfNoAltSyntax() throws Exception {
        // given
        loadConfigurationProviders(new MockConfigurationProvider());
        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
        String anExpression = "%{foo}";

        // when
        String actual = ComponentUtils.stripExpressionIfAltSyntax(stack, anExpression);
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

        assertEquals(actual, "%{foo}");
    }

    public void testAltSyntaxIsTrue() throws Exception {
        // given
        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();

        // when
        boolean actual = ComponentUtils.altSyntax(stack);

        // then
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

    }

    public void testAltSyntaxIsFalse() throws Exception {
        // given
        loadConfigurationProviders(new MockConfigurationProvider());
        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();

        // when
        boolean actual = ComponentUtils.altSyntax(stack);

        // then
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

    public void tearDown() throws Exception {
        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

Examples of com.opensymphony.xwork2.util.ValueStack

        property.setValue("foo");
        assertPropertyOutput("foo-value", property);
    }

    public void testDefaultShouldBeOutputIfBeanNotAvailable() {
        final ValueStack stack = ActionContext.getContext().getValueStack();
        final Property property = new Property(stack);
        property.setDefault("default");
        property.setValue("foo");
        assertPropertyOutput("default", property);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.util.ValueStack

        property.setValue("foo");
        assertPropertyOutput("default", property);
    }

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

Examples of com.opensymphony.xwork2.util.ValueStack

        property.setValue("foo");
        assertPropertyOutput("default", property);
    }

    public void testTopValueShouldReturnTopOfValueStack() {
        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("top");
        assertPropertyOutput("foo-value/bar-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.