PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/projects/struts-2.2.1/src/xwork-core/src/test/java/com/opensymphony/xwork2/interceptor/ParametersInterceptorTest.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 548 lines | 415 code | 92 blank | 41 comment | 0 complexity | 71eb469d98c60a9bcfba00effbed5618 MD5 | raw file
  1. /*
  2. * Copyright 2002-2006,2009 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.opensymphony.xwork2.interceptor;
  17. import com.opensymphony.xwork2.Action;
  18. import com.opensymphony.xwork2.ActionContext;
  19. import com.opensymphony.xwork2.ActionProxy;
  20. import com.opensymphony.xwork2.ModelDrivenAction;
  21. import com.opensymphony.xwork2.SimpleAction;
  22. import com.opensymphony.xwork2.TestBean;
  23. import com.opensymphony.xwork2.TextProvider;
  24. import com.opensymphony.xwork2.XWorkTestCase;
  25. import com.opensymphony.xwork2.config.entities.ActionConfig;
  26. import com.opensymphony.xwork2.config.providers.MockConfigurationProvider;
  27. import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
  28. import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
  29. import com.opensymphony.xwork2.mock.MockActionInvocation;
  30. import com.opensymphony.xwork2.ognl.OgnlValueStack;
  31. import com.opensymphony.xwork2.ognl.OgnlValueStackFactory;
  32. import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor;
  33. import com.opensymphony.xwork2.util.CompoundRoot;
  34. import com.opensymphony.xwork2.util.ValueStack;
  35. import com.opensymphony.xwork2.util.ValueStackFactory;
  36. import ognl.PropertyAccessor;
  37. import java.util.ArrayList;
  38. import java.util.Collections;
  39. import java.util.HashMap;
  40. import java.util.LinkedHashMap;
  41. import java.util.List;
  42. import java.util.Map;
  43. /**
  44. * Unit test for {@link ParametersInterceptor}.
  45. *
  46. * @author Jason Carreira
  47. */
  48. public class ParametersInterceptorTest extends XWorkTestCase {
  49. public void testParameterNameAware() {
  50. ParametersInterceptor pi = createParametersInterceptor();
  51. final Map actual = injectValueStackFactory(pi);
  52. ValueStack stack = createStubValueStack(actual);
  53. final Map expected = new HashMap() {
  54. {
  55. put("fooKey", "fooValue");
  56. put("barKey", "barValue");
  57. }
  58. };
  59. Object a = new ParameterNameAware() {
  60. public boolean acceptableParameterName(String parameterName) {
  61. return expected.containsKey(parameterName);
  62. }
  63. };
  64. Map parameters = new HashMap() {
  65. {
  66. put("fooKey", "fooValue");
  67. put("barKey", "barValue");
  68. put("error", "error");
  69. }
  70. };
  71. pi.setParameters(a, stack, parameters);
  72. assertEquals(expected, actual);
  73. }
  74. public void testDoesNotAllowMethodInvocations() throws Exception {
  75. Map<String, Object> params = new HashMap<String, Object>();
  76. params.put("@java.lang.System@exit(1).dummy", "dumb value");
  77. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  78. extraContext.put(ActionContext.PARAMETERS, params);
  79. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.MODEL_DRIVEN_PARAM_TEST, extraContext);
  80. assertEquals(Action.SUCCESS, proxy.execute());
  81. ModelDrivenAction action = (ModelDrivenAction) proxy.getAction();
  82. TestBean model = (TestBean) action.getModel();
  83. String property = System.getProperty("xwork.security.test");
  84. assertNull(property);
  85. }
  86. public void testModelDrivenParameters() throws Exception {
  87. Map<String, Object> params = new HashMap<String, Object>();
  88. final String fooVal = "com.opensymphony.xwork2.interceptor.ParametersInterceptorTest.foo";
  89. params.put("foo", fooVal);
  90. final String nameVal = "com.opensymphony.xwork2.interceptor.ParametersInterceptorTest.name";
  91. params.put("name", nameVal);
  92. params.put("count", "15");
  93. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  94. extraContext.put(ActionContext.PARAMETERS, params);
  95. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.MODEL_DRIVEN_PARAM_TEST, extraContext);
  96. assertEquals(Action.SUCCESS, proxy.execute());
  97. ModelDrivenAction action = (ModelDrivenAction) proxy.getAction();
  98. TestBean model = (TestBean) action.getModel();
  99. assertEquals(nameVal, model.getName());
  100. assertEquals(15, model.getCount());
  101. assertEquals(fooVal, action.getFoo());
  102. }
  103. public void testParametersDoesNotAffectSession() throws Exception {
  104. Map<String, Object> params = new HashMap<String, Object>();
  105. params.put("blah", "This is blah");
  106. params.put("#session.foo", "Foo");
  107. params.put("\u0023session[\'user\']", "0wn3d");
  108. params.put("\\u0023session[\'user\']", "0wn3d");
  109. params.put("\u0023session.user2", "0wn3d");
  110. params.put("\\u0023session.user2", "0wn3d");
  111. params.put("('\u0023'%20%2b%20'session[\'user3\']')(unused)", "0wn3d");
  112. params.put("('\\u0023' + 'session[\\'user4\\']')(unused)", "0wn3d");
  113. params.put("('\u0023'%2b'session[\'user5\']')(unused)", "0wn3d");
  114. params.put("('\\u0023'%2b'session[\'user5\']')(unused)", "0wn3d");
  115. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  116. extraContext.put(ActionContext.PARAMETERS, params);
  117. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  118. ValueStack stack = proxy.getInvocation().getStack();
  119. HashMap<String, Object> session = new HashMap<String, Object>();
  120. stack.getContext().put("session", session);
  121. proxy.execute();
  122. assertEquals("This is blah", ((SimpleAction) proxy.getAction()).getBlah());
  123. assertNull(session.get("foo"));
  124. assertNull(session.get("user"));
  125. assertNull(session.get("user2"));
  126. assertNull(session.get("user3"));
  127. assertNull(session.get("user4"));
  128. assertNull(session.get("user5"));
  129. }
  130. public void testAccessToOgnlInternals() throws Exception {
  131. // given
  132. Map<String, Object> params = new HashMap<String, Object>();
  133. params.put("blah", "This is blah");
  134. params.put("('\\u0023_memberAccess[\\'allowStaticMethodAccess\\']')(meh)", "true");
  135. params.put("('(aaa)(('\\u0023context[\\'xwork.MethodAccessor.denyMethodExecution\\']\\u003d\\u0023foo')(\\u0023foo\\u003dnew java.lang.Boolean(\"false\")))", "");
  136. params.put("(asdf)(('\\u0023rt.exit(1)')(\\u0023rt\\u003d@java.lang.Runtime@getRuntime()))", "1");
  137. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  138. extraContext.put(ActionContext.PARAMETERS, params);
  139. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, "", extraContext);
  140. ValueStack stack = proxy.getInvocation().getStack();
  141. // when
  142. proxy.execute();
  143. proxy.getAction();
  144. //then
  145. assertEquals("This is blah", ((SimpleAction) proxy.getAction()).getBlah());
  146. Object allowMethodAccess = stack.findValue("\u0023_memberAccess['allowStaticMethodAccess']");
  147. assertNotNull(allowMethodAccess);
  148. assertEquals(Boolean.FALSE, allowMethodAccess);
  149. }
  150. public void testParameters() throws Exception {
  151. Map<String, Object> params = new HashMap<String, Object>();
  152. params.put("blah", "This is blah");
  153. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  154. extraContext.put(ActionContext.PARAMETERS, params);
  155. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  156. proxy.execute();
  157. assertEquals("This is blah", ((SimpleAction) proxy.getAction()).getBlah());
  158. }
  159. public void testParametersWithSpacesInTheName() throws Exception {
  160. Map<String, Object> params = new HashMap<String, Object>();
  161. params.put("theProtectedMap['p0 p1']", "test1");
  162. params.put("theProtectedMap['p0p1 ']", "test2");
  163. params.put("theProtectedMap[' p0p1 ']", "test3");
  164. params.put("theProtectedMap[' p0 p1 ']", "test4");
  165. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  166. extraContext.put(ActionContext.PARAMETERS, params);
  167. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  168. proxy.execute();
  169. Map<String, String> existingMap = ((SimpleAction) proxy.getAction()).getTheProtectedMap();
  170. assertEquals(4, existingMap.size());
  171. assertEquals("test1", existingMap.get("p0 p1"));
  172. assertEquals("test2", existingMap.get("p0p1 "));
  173. assertEquals("test3", existingMap.get(" p0p1 "));
  174. assertEquals("test4", existingMap.get(" p0 p1 "));
  175. }
  176. public void testExcludedTrickyParameters() throws Exception {
  177. Map<String, Object> params = new HashMap<String, Object>() {
  178. {
  179. put("blah", "This is blah");
  180. put("name", "try_1");
  181. put("(name)", "try_2");
  182. put("['name']", "try_3");
  183. put("['na' + 'me']", "try_4");
  184. put("{name}[0]", "try_5");
  185. put("(new string{'name'})[0]", "try_6");
  186. put("#{key: 'name'}.key", "try_7");
  187. }
  188. };
  189. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  190. extraContext.put(ActionContext.PARAMETERS, params);
  191. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  192. ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME);
  193. ParametersInterceptor pi =(ParametersInterceptor) config.getInterceptors().get(0).getInterceptor();
  194. pi.setExcludeParams("name");
  195. proxy.execute();
  196. SimpleAction action = (SimpleAction) proxy.getAction();
  197. assertNull(action.getName());
  198. assertEquals("This is blah", (action).getBlah());
  199. }
  200. public void testAcceptedTrickyParameters() throws Exception {
  201. Map<String, Object> params = new HashMap<String, Object>() {
  202. {
  203. put("blah", "This is blah");
  204. put("baz", "123");
  205. put("name", "try_1");
  206. put("(name)", "try_2");
  207. put("['name']", "try_3");
  208. put("['na' + 'me']", "try_4");
  209. put("{name}[0]", "try_5");
  210. put("(new string{'name'})[0]", "try_6");
  211. put("#{key: 'name'}.key", "try_7");
  212. }
  213. };
  214. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  215. extraContext.put(ActionContext.PARAMETERS, params);
  216. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  217. ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME);
  218. ParametersInterceptor pi =(ParametersInterceptor) config.getInterceptors().get(0).getInterceptor();
  219. pi.setAcceptParamNames("blah, baz");
  220. proxy.execute();
  221. SimpleAction action = (SimpleAction) proxy.getAction();
  222. assertNull(action.getName());
  223. assertEquals("This is blah", (action).getBlah());
  224. assertEquals(123, action.getBaz());
  225. }
  226. public void testParametersNotAccessPrivateVariables() throws Exception {
  227. Map<String, Object> params = new HashMap<String, Object>();
  228. params.put("protectedMap.foo", "This is blah");
  229. params.put("theProtectedMap.boo", "This is blah");
  230. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  231. extraContext.put(ActionContext.PARAMETERS, params);
  232. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  233. proxy.execute();
  234. SimpleAction action = (SimpleAction) proxy.getAction();
  235. assertEquals(1, action.getTheProtectedMap().size());
  236. assertNotNull(action.getTheProtectedMap().get("boo"));
  237. assertNull(action.getTheProtectedMap().get("foo"));
  238. }
  239. public void testParametersNotAccessProtectedMethods() throws Exception {
  240. Map<String, Object> params = new HashMap<String, Object>();
  241. params.put("theSemiProtectedMap.foo", "This is blah");
  242. params.put("theProtectedMap.boo", "This is blah");
  243. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  244. extraContext.put(ActionContext.PARAMETERS, params);
  245. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  246. proxy.execute();
  247. SimpleAction action = (SimpleAction) proxy.getAction();
  248. assertEquals(1, action.getTheProtectedMap().size());
  249. assertNotNull(action.getTheProtectedMap().get("boo"));
  250. assertNull(action.getTheProtectedMap().get("foo"));
  251. }
  252. public void testParametersOverwriteField() throws Exception {
  253. Map<String, Object> params = new LinkedHashMap<String, Object>();
  254. params.put("existingMap.boo", "This is blah");
  255. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  256. extraContext.put(ActionContext.PARAMETERS, params);
  257. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  258. proxy.execute();
  259. SimpleAction action = (SimpleAction) proxy.getAction();
  260. assertEquals(1, action.getTheExistingMap().size());
  261. assertNotNull(action.getTheExistingMap().get("boo"));
  262. assertNull(action.getTheExistingMap().get("existingKey"));
  263. }
  264. public void testNonexistentParametersGetLoggedInDevMode() throws Exception {
  265. loadConfigurationProviders(new XmlConfigurationProvider("xwork-test-beans.xml"),
  266. new MockConfigurationProvider(Collections.singletonMap("devMode", "true")));
  267. Map<String, Object> params = new HashMap<String, Object>();
  268. params.put("not_a_property", "There is no action property named like this");
  269. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  270. extraContext.put(ActionContext.PARAMETERS, params);
  271. ParametersInterceptor.setDevMode("true");
  272. ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME);
  273. container.inject(config.getInterceptors().get(0).getInterceptor());
  274. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  275. proxy.execute();
  276. final String actionMessage = "" + ((SimpleAction) proxy.getAction()).getActionMessages().toArray()[0];
  277. assertTrue(actionMessage.contains("Error setting expression 'not_a_property' with value 'There is no action property named like this'"));
  278. }
  279. public void testNonexistentParametersAreIgnoredInProductionMode() throws Exception {
  280. loadConfigurationProviders(new XmlConfigurationProvider("xwork-test-beans.xml"),
  281. new MockConfigurationProvider(Collections.singletonMap("devMode", "false")));
  282. Map<String, Object> params = new HashMap<String, Object>();
  283. params.put("not_a_property", "There is no action property named like this");
  284. HashMap<String, Object> extraContext = new HashMap<String, Object>();
  285. extraContext.put(ActionContext.PARAMETERS, params);
  286. ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME);
  287. container.inject(config.getInterceptors().get(0).getInterceptor());
  288. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  289. proxy.execute();
  290. assertTrue(((SimpleAction) proxy.getAction()).getActionMessages().isEmpty());
  291. }
  292. public void testNoParametersAction() throws Exception {
  293. ParametersInterceptor interceptor = new ParametersInterceptor();
  294. interceptor.init();
  295. MockActionInvocation mai = new MockActionInvocation();
  296. Action action = new NoParametersAction();
  297. mai.setAction(action);
  298. interceptor.doIntercept(mai);
  299. interceptor.destroy();
  300. }
  301. public void testNoOrdered() throws Exception {
  302. ParametersInterceptor pi = createParametersInterceptor();
  303. final Map<String, Object> actual = new LinkedHashMap<String, Object>();
  304. pi.setValueStackFactory(createValueStackFactory(actual));
  305. ValueStack stack = createStubValueStack(actual);
  306. Map<String, Object> parameters = new HashMap<String, Object>();
  307. parameters.put("user.address.city", "London");
  308. parameters.put("user.name", "Superman");
  309. Action action = new SimpleAction();
  310. pi.setParameters(action, stack, parameters);
  311. assertEquals("ordered should be false by default", false, pi.isOrdered());
  312. assertEquals(2, actual.size());
  313. assertEquals("London", actual.get("user.address.city"));
  314. assertEquals("Superman", actual.get("user.name"));
  315. // is not ordered
  316. List<Object> values = new ArrayList<Object>(actual.values());
  317. assertEquals("London", values.get(0));
  318. assertEquals("Superman", values.get(1));
  319. }
  320. public void testOrdered() throws Exception {
  321. ParametersInterceptor pi = new ParametersInterceptor();
  322. pi.setOrdered(true);
  323. container.inject(pi);
  324. final Map<String, Object> actual = new LinkedHashMap<String, Object>();
  325. pi.setValueStackFactory(createValueStackFactory(actual));
  326. ValueStack stack = createStubValueStack(actual);
  327. Map<String, Object> parameters = new HashMap<String, Object>();
  328. parameters.put("user.address.city", "London");
  329. parameters.put("user.name", "Superman");
  330. Action action = new SimpleAction();
  331. pi.setParameters(action, stack, parameters);
  332. assertEquals(true, pi.isOrdered());
  333. assertEquals(2, actual.size());
  334. assertEquals("London", actual.get("user.address.city"));
  335. assertEquals("Superman", actual.get("user.name"));
  336. // should be ordered so user.name should be first
  337. List<Object> values = new ArrayList<Object>(actual.values());
  338. assertEquals("Superman", values.get(0));
  339. assertEquals("London", values.get(1));
  340. }
  341. public void testSetOrdered() throws Exception {
  342. ParametersInterceptor pi = createParametersInterceptor();
  343. assertEquals("ordered should be false by default", false, pi.isOrdered());
  344. pi.setOrdered(true);
  345. assertEquals(true, pi.isOrdered());
  346. }
  347. public void testExcludedParametersAreIgnored() throws Exception {
  348. ParametersInterceptor pi = createParametersInterceptor();
  349. pi.setExcludeParams("dojo\\..*");
  350. final Map actual = injectValueStackFactory(pi);
  351. ValueStack stack = injectValueStack(actual);
  352. final Map<String, Object> expected = new HashMap<String, Object>() {
  353. {
  354. put("fooKey", "fooValue");
  355. }
  356. };
  357. Map<String, Object> parameters = new HashMap<String, Object>() {
  358. {
  359. put("dojo.test", "dojoValue");
  360. put("fooKey", "fooValue");
  361. }
  362. };
  363. pi.setParameters(new NoParametersAction(), stack, parameters);
  364. assertEquals(expected, actual);
  365. }
  366. public void testInternalParametersAreIgnored() throws Exception {
  367. // given
  368. ParametersInterceptor interceptor = createParametersInterceptor();
  369. final Map actual = injectValueStackFactory(interceptor);
  370. ValueStack stack = injectValueStack(actual);
  371. final Map<String, Object> expected = new HashMap<String, Object>() {
  372. {
  373. put("ordinary.bean", "value");
  374. }
  375. };
  376. Map<String, Object> parameters = new HashMap<String, Object>() {
  377. {
  378. put("ordinary.bean", "value");
  379. put("#some.internal.object", "true");
  380. put("(bla)#some.internal.object", "true");
  381. put("#some.internal.object(bla)#some.internal.object", "true");
  382. put("#_some.internal.object", "true");
  383. put("\u0023_some.internal.object", "true");
  384. put("\u0023_some.internal.object,[dfd],bla(\u0023_some.internal.object)", "true");
  385. put("\\u0023_some.internal.object", "true");
  386. }
  387. };
  388. // when
  389. interceptor.setParameters(new NoParametersAction(), stack, parameters);
  390. // then
  391. assertEquals(expected, actual);
  392. }
  393. private ValueStack injectValueStack(Map actual) {
  394. ValueStack stack = createStubValueStack(actual);
  395. container.inject(stack);
  396. return stack;
  397. }
  398. private Map injectValueStackFactory(ParametersInterceptor interceptor) {
  399. final Map actual = new HashMap();
  400. interceptor.setValueStackFactory(createValueStackFactory(actual));
  401. return actual;
  402. }
  403. private ParametersInterceptor createParametersInterceptor() {
  404. ParametersInterceptor pi = new ParametersInterceptor();
  405. container.inject(pi);
  406. return pi;
  407. }
  408. private ValueStackFactory createValueStackFactory(final Map<String, Object> context) {
  409. OgnlValueStackFactory factory = new OgnlValueStackFactory() {
  410. @Override
  411. public ValueStack createValueStack(ValueStack stack) {
  412. return createStubValueStack(context);
  413. }
  414. };
  415. container.inject(factory);
  416. return factory;
  417. }
  418. private ValueStack createStubValueStack(final Map<String, Object> actual) {
  419. ValueStack stack = new OgnlValueStack(
  420. container.getInstance(XWorkConverter.class),
  421. (CompoundRootAccessor)container.getInstance(PropertyAccessor.class, CompoundRoot.class.getName()),
  422. container.getInstance(TextProvider.class, "system"), true) {
  423. @Override
  424. public void setValue(String expr, Object value) {
  425. actual.put(expr, value);
  426. }
  427. };
  428. container.inject(stack);
  429. return stack;
  430. }
  431. /*
  432. public void testIndexedParameters() throws Exception {
  433. Map params = new HashMap();
  434. params.put("indexedProp[33]", "This is blah");
  435. HashMap extraContext = new HashMap();
  436. extraContext.put(ActionContext.PARAMETERS, params);
  437. ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, extraContext);
  438. proxy.execute();
  439. assertEquals("This is blah", ((SimpleAction) proxy.getAction()).getIndexedProp(33));
  440. }
  441. */
  442. private class NoParametersAction implements Action, NoParameters {
  443. public String execute() throws Exception {
  444. return SUCCESS;
  445. }
  446. }
  447. @Override
  448. protected void setUp() throws Exception {
  449. super.setUp();
  450. loadConfigurationProviders(new XmlConfigurationProvider("xwork-test-beans.xml"), new MockConfigurationProvider());
  451. ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME);
  452. container.inject(config.getInterceptors().get(0).getInterceptor());
  453. }
  454. }