01: /**
02: * Copyright (C) 2001-2004 France Telecom R&D
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package org.objectweb.speedo.runtime.jca;
18:
19: import org.objectweb.speedo.SpeedoTestHelper;
20: import org.objectweb.speedo.api.SpeedoProperties;
21: import org.objectweb.util.monolog.api.BasicLevel;
22:
23: import java.util.Properties;
24:
25: import javax.naming.InitialContext;
26:
27: /**
28: *
29: * @author S.Chassande-Barrioz
30: */
31: public class TestJCAEmulation extends SpeedoTestHelper {
32:
33: static {
34: System.setProperty("java.naming.factory.initial",
35: SimpleNamingManager.class.getName());
36: }
37:
38: public TestJCAEmulation(String s) {
39: super (s);
40: }
41:
42: protected String getLoggerName() {
43: return LOG_NAME + ".rt.jca.TestJCAEmulation";
44: }
45:
46: public Properties getPMFProperties() {
47: Properties p = super .getPMFProperties();
48: String driver = getConnectionDriverNameProperty(p);
49: String user = p
50: .getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME);
51: String password = p
52: .getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD);
53: String url = p
54: .getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_URL);
55:
56: final String JNDI_NAME = "cf";
57: try {
58: InitialContext ictx = new InitialContext();
59: ictx.rebind(JNDI_NAME, new SimpleDataSource(driver, url,
60: user, password));
61: } catch (Exception e) {
62: System.err.println("Error during the JNDI initialization: "
63: + e.getMessage());
64: e.printStackTrace(System.err);
65: }
66: p
67: .setProperty(SpeedoProperties.MANAGED, Boolean.TRUE
68: .toString());
69: p.setProperty(
70: SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME,
71: JNDI_NAME);
72: return p;
73: }
74:
75: public void testEmpty() {
76: assertTrue(true);
77: }
78: }
|