01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.directwebremoting.spring;
18:
19: import org.apache.commons.logging.Log;
20: import org.apache.commons.logging.LogFactory;
21: import org.junit.Ignore;
22: import org.junit.Test;
23: import org.springframework.context.ConfigurableApplicationContext;
24: import org.springframework.mock.web.MockHttpServletRequest;
25: import org.springframework.mock.web.MockHttpServletResponse;
26: import org.springframework.mock.web.MockServletContext;
27: import org.springframework.util.StringUtils;
28: import org.springframework.web.context.support.XmlWebApplicationContext;
29:
30: /**
31: * @author Bram Smeets
32: * @author Joe Walker [joe at getahead dot ltd dot uk]
33: */
34: public class DwrControllerTest //extends AbstractDependencyInjectionSpringContextTests
35: {
36: private DwrController controller;
37:
38: //@Override
39: protected String[] getConfigLocations() {
40: return new String[] { "/org/directwebremoting/spring/spring-configuration.xml" };
41: }
42:
43: //@Override
44: protected void onSetUp() throws Exception {
45: //controller = (DwrController) applicationContext.getBean("dwrController");
46: }
47:
48: /**
49: * Subclasses can invoke this to get a context key for the given location.
50: * This doesn't affect the applicationContext instance variable in this class.
51: * Dependency Injection cannot be applied from such contexts.
52: */
53: //@Override
54: protected ConfigurableApplicationContext loadContextLocations(
55: String[] locations) {
56: log.info("Loading my own config for: "
57: + StringUtils.arrayToCommaDelimitedString(locations));
58:
59: XmlWebApplicationContext ctx = new XmlWebApplicationContext();
60: ctx.setConfigLocations(locations);
61: ctx.setServletContext(new MockServletContext());
62: ctx.refresh();
63: return ctx;
64: }
65:
66: @Ignore
67: @Test
68: public void handleRequestInternal() throws Exception {
69: MockHttpServletRequest request = new MockHttpServletRequest();
70: MockHttpServletResponse response = new MockHttpServletResponse();
71:
72: try {
73: controller.handleRequestInternal(request, response);
74: } catch (Exception e) {
75: // TODO: what is this? SHould not be /WEB-INF/dwr.xml?
76: }
77: }
78:
79: /**
80: * The log stream
81: */
82: private static final Log log = LogFactory
83: .getLog(DwrControllerTest.class);
84: }
|