01: /**
02: * Copyright 2006 Webmedia Group Ltd.
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: **/package org.araneaframework.mock.servlet;
16:
17: import org.araneaframework.http.ServletServiceAdapterComponent;
18: import org.araneaframework.http.core.BaseAraneaDispatcherServlet;
19: import org.springframework.beans.factory.BeanFactory;
20: import org.springframework.beans.factory.xml.XmlBeanFactory;
21: import org.springframework.core.io.ClassPathResource;
22:
23: /**
24: * @author "Toomas Römer" <toomas@webmedia.ee>
25: *
26: */
27: public class MockServlet extends BaseAraneaDispatcherServlet {
28: private String beansFile = "smokeTest.xml";
29: private ServletServiceAdapterComponent builtComponent;
30: private BeanFactory factory;
31:
32: protected ServletServiceAdapterComponent buildRootComponent() {
33: ClassPathResource resource = new ClassPathResource(beansFile);
34: factory = new XmlBeanFactory(resource);
35: ServletServiceAdapterComponent adapter = (ServletServiceAdapterComponent) factory
36: .getBean("servletServiceAdapterComponent");
37: builtComponent = adapter;
38: return adapter;
39: }
40:
41: public BeanFactory getFactory() {
42: return factory;
43: }
44:
45: public void setConfFile(String file) {
46: this .beansFile = file;
47: }
48:
49: public ServletServiceAdapterComponent getBuiltComponent() {
50: return builtComponent;
51: }
52: }
|