01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.test;
17:
18: import java.util.Properties;
19:
20: import javax.naming.Context;
21: import javax.naming.InitialContext;
22:
23: /**
24: * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
25: * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
26: *
27: * @version $Rev: 557180 $ $Date: 2007-07-18 00:15:31 -0700 $
28: */
29: public class IvmTestServer implements TestServer {
30:
31: private Properties properties;
32:
33: public void init(Properties props) {
34:
35: properties = props;
36:
37: try {
38: props
39: .put(Context.INITIAL_CONTEXT_FACTORY,
40: "org.apache.openejb.client.LocalInitialContextFactory");
41: Properties p = new Properties();
42: p.putAll(props);
43: p.put("openejb.loader", "embed");
44: new InitialContext(p); // initialize openejb via constructing jndi tree
45:
46: //OpenEJB.init(properties);
47: } catch (Exception oe) {
48: System.out.println("=========================");
49: System.out.println("" + oe.getMessage());
50: System.out.println("=========================");
51: oe.printStackTrace();
52: throw new RuntimeException("OpenEJB could not be initiated");
53: }
54: }
55:
56: public void destroy() {
57: }
58:
59: public void start() {
60: }
61:
62: public void stop() {
63:
64: }
65:
66: public Properties getContextEnvironment() {
67: return (Properties) properties.clone();
68: }
69:
70: }
|