Search in sources :

Example 56 with Foo

use of com.opensymphony.xwork2.util.Foo in project struts by apache.

the class OgnlValueStackTest method testSetReallyDeepBarAsString.

public void testSetReallyDeepBarAsString() {
    Foo foo = new Foo();
    Foo foo2 = new Foo();
    foo.setChild(foo2);
    Foo foo3 = new Foo();
    foo2.setChild(foo3);
    OgnlValueStack vs = createValueStack();
    vs.push(foo);
    vs.setValue("child.child.bar", "bar:123");
    assertEquals("bar", foo.getChild().getChild().getBar().getTitle());
    assertEquals(123, foo.getChild().getChild().getBar().getSomethingElse());
}
Also used : Foo(com.opensymphony.xwork2.util.Foo)

Example 57 with Foo

use of com.opensymphony.xwork2.util.Foo in project struts by apache.

the class OgnlValueStackTest method testFooBarAsString.

public void testFooBarAsString() {
    OgnlValueStack vs = createValueStack();
    Foo foo = new Foo();
    Bar bar = new Bar();
    bar.setTitle("blah");
    bar.setSomethingElse(123);
    foo.setBar(bar);
    vs.push(foo);
    assertEquals("blah:123", vs.findValue("bar", String.class));
}
Also used : Foo(com.opensymphony.xwork2.util.Foo)

Example 58 with Foo

use of com.opensymphony.xwork2.util.Foo in project struts by apache.

the class OgnlValueStackTest method testSetDeepBarAsString.

public void testSetDeepBarAsString() {
    Foo foo = new Foo();
    Foo foo2 = new Foo();
    foo.setChild(foo2);
    OgnlValueStack vs = createValueStack();
    vs.push(foo);
    vs.setValue("child.bar", "bar:123");
    assertEquals("bar", foo.getChild().getBar().getTitle());
    assertEquals(123, foo.getChild().getBar().getSomethingElse());
}
Also used : Foo(com.opensymphony.xwork2.util.Foo)

Example 59 with Foo

use of com.opensymphony.xwork2.util.Foo in project struts by apache.

the class OgnlValueStackTest method testPetSoarBug.

public void testPetSoarBug() {
    Cat cat = new Cat();
    cat.setFoo(new Foo());
    Bar bar = new Bar();
    bar.setTitle("bar");
    bar.setSomethingElse(123);
    cat.getFoo().setBar(bar);
    OgnlValueStack vs = createValueStack();
    vs.push(cat);
    assertEquals("bar:123", vs.findValue("foo.bar", String.class));
}
Also used : Foo(com.opensymphony.xwork2.util.Foo)

Example 60 with Foo

use of com.opensymphony.xwork2.util.Foo in project struts by apache.

the class OgnlValueStackTest method testConvertStringArrayToList.

public void testConvertStringArrayToList() {
    Foo foo = new Foo();
    OgnlValueStack vs = createValueStack();
    vs.push(foo);
    vs.setValue("strings", new String[] { "one", "two" });
    assertNotNull(foo.getStrings());
    assertEquals("one", foo.getStrings().get(0));
    assertEquals("two", foo.getStrings().get(1));
}
Also used : Foo(com.opensymphony.xwork2.util.Foo)

Aggregations

Foo (com.opensymphony.xwork2.util.Foo)53 HashMap (java.util.HashMap)32 ValueStack (com.opensymphony.xwork2.util.ValueStack)23 ConfigurationException (com.opensymphony.xwork2.config.ConfigurationException)20 ActionConfig (com.opensymphony.xwork2.config.entities.ActionConfig)19 StrutsException (org.apache.struts2.StrutsException)19 OgnlException (ognl.OgnlException)18 IntrospectionException (java.beans.IntrospectionException)17 InappropriateExpressionException (ognl.InappropriateExpressionException)17 MethodFailedException (ognl.MethodFailedException)17 NoSuchPropertyException (ognl.NoSuchPropertyException)17 ActionProxy (com.opensymphony.xwork2.ActionProxy)16 PackageConfig (com.opensymphony.xwork2.config.entities.PackageConfig)9 ActionContext (com.opensymphony.xwork2.ActionContext)8 ConfigurationProvider (com.opensymphony.xwork2.config.ConfigurationProvider)8 Bar (com.opensymphony.xwork2.util.Bar)8 Map (java.util.Map)8 ResultConfig (com.opensymphony.xwork2.config.entities.ResultConfig)7 ConversionData (com.opensymphony.xwork2.conversion.impl.ConversionData)7 StubValueStack (com.opensymphony.xwork2.StubValueStack)6