01: /*
02: * Created on 22 Jun 2007
03: */
04: package uk.org.ponder.rsf.test.dar;
05:
06: import uk.org.ponder.arrayutil.ArrayUtil;
07: import uk.org.ponder.beanutil.WriteableBeanLocator;
08: import uk.org.ponder.mapping.DARApplier;
09: import uk.org.ponder.mapping.DAREnvironment;
10: import uk.org.ponder.mapping.DataAlterationRequest;
11: import uk.org.ponder.messageutil.TargettedMessageList;
12: import uk.org.ponder.rsf.test.PlainRSFTests;
13:
14: public class TestDARApplier extends PlainRSFTests {
15:
16: private DARTestBean testApplication(Object value) {
17: WriteableBeanLocator rbl = getRSACBeanLocator()
18: .getBeanLocator();
19: DataAlterationRequest dar = new DataAlterationRequest(
20: "DARTestBean.values", value);
21: DARApplier darapplier = (DARApplier) applicationContext
22: .getBean("DARApplier");
23: TargettedMessageList tml = new TargettedMessageList();
24: darapplier.applyAlteration(rbl, dar, new DAREnvironment(tml));
25:
26: DARTestBean togo = (DARTestBean) rbl.locateBean("DARTestBean");
27: return togo;
28: }
29:
30: public void testStringVector() {
31: DARTestBean testBean = testApplication("value");
32: assertNotNull(testBean.values);
33: assertEquals(testBean.values.length, 1);
34: assertEquals(testBean.values[0], "value");
35:
36: testBean = testApplication(new String[] { "value1", "value2" });
37: assertNotNull(testBean.values);
38: assertEquals(testBean.values.length, 2);
39: }
40:
41: public String[] getRequestConfigLocations() {
42: return (String[]) ArrayUtil
43: .append(super .getRequestConfigLocations(),
44: "classpath:uk/org/ponder/rsf/test/dar/dar-request-context.xml");
45: }
46: }
|