KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > runtime > jca > TestJCAEmulation


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * 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  */

18 package org.objectweb.speedo.runtime.jca;
19
20 import org.objectweb.speedo.SpeedoTestHelper;
21 import org.objectweb.speedo.api.SpeedoProperties;
22 import org.objectweb.util.monolog.api.BasicLevel;
23
24 import java.util.Properties JavaDoc;
25
26 import javax.naming.InitialContext JavaDoc;
27
28 /**
29  *
30  * @author S.Chassande-Barrioz
31  */

32 public class TestJCAEmulation extends SpeedoTestHelper {
33
34     static {
35         System.setProperty("java.naming.factory.initial",
36                 SimpleNamingManager.class.getName());
37     }
38
39     public TestJCAEmulation(String JavaDoc s) {
40         super(s);
41     }
42
43     protected String JavaDoc getLoggerName() {
44         return LOG_NAME + ".rt.jca.TestJCAEmulation";
45     }
46
47     public Properties getPMFProperties() {
48         Properties p = super.getPMFProperties();
49         String JavaDoc driver = getConnectionDriverNameProperty(p);
50         String JavaDoc user = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME);
51         String JavaDoc password = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD);
52         String JavaDoc url = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_URL);
53         
54         final String JavaDoc JNDI_NAME="cf";
55         try {
56             InitialContext JavaDoc ictx = new InitialContext JavaDoc();
57             ictx.rebind(JNDI_NAME, new SimpleDataSource(driver, url, user, password));
58         } catch (Exception JavaDoc e) {
59             System.err.println("Error during the JNDI initialization: " + e.getMessage());
60             e.printStackTrace(System.err);
61         }
62         p.setProperty(SpeedoProperties.MANAGED, Boolean.TRUE.toString());
63         p.setProperty(SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME, JNDI_NAME);
64         return p;
65     }
66
67     public void testEmpty() {
68         assertTrue(true);
69     }
70 }
71
Popular Tags