http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DynamicDataSourceTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DynamicDataSourceTest.java b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DynamicDataSourceTest.java index f4f8efe..8b03d45 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DynamicDataSourceTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DynamicDataSourceTest.java @@ -1,329 +1,329 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.resource.jdbc; - -import org.apache.openejb.OpenEJB; -import org.apache.openejb.assembler.classic.Assembler; -import org.apache.openejb.assembler.classic.ProxyFactoryInfo; -import org.apache.openejb.assembler.classic.ResourceInfo; -import org.apache.openejb.assembler.classic.SecurityServiceInfo; -import org.apache.openejb.assembler.classic.StatelessSessionContainerInfo; -import org.apache.openejb.assembler.classic.TransactionServiceInfo; -import org.apache.openejb.config.AppModule; -import org.apache.openejb.config.ConfigurationFactory; -import org.apache.openejb.config.EjbModule; -import org.apache.openejb.config.PersistenceModule; -import org.apache.openejb.config.sys.Resource; -import org.apache.openejb.core.LocalInitialContextFactory; -import org.apache.openejb.jee.EjbJar; -import org.apache.openejb.jee.StatelessBean; -import org.apache.openejb.jee.jpa.unit.Persistence; -import org.apache.openejb.jee.jpa.unit.PersistenceUnit; -import org.apache.openejb.jee.jpa.unit.TransactionType; -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.resource.jdbc.router.Router; -import org.apache.openejb.spi.ContainerSystem; -import org.junit.After; -import org.junit.Test; - -import javax.ejb.Local; -import javax.ejb.Stateless; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.persistence.Entity; -import javax.persistence.EntityManager; -import javax.persistence.Id; -import javax.persistence.PersistenceContext; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; - -import static org.junit.Assert.assertEquals; - -public class DynamicDataSourceTest { - - @After - public void tearDown() throws Exception { - OpenEJB.destroy(); - } - - @Test - public void route() throws Exception { - System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName()); - - final ConfigurationFactory config = new ConfigurationFactory(); - - final Assembler assembler = new Assembler(); - assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class)); - assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class)); - assembler.createSecurityService(config.configureService(SecurityServiceInfo.class)); - - // resources - for (int i = 1; i <= 3; i++) { - final String dbName = "database" + i; - final Resource resourceDs = new Resource(dbName, "DataSource"); - final Properties p = resourceDs.getProperties(); - p.put("JdbcDriver", "org.hsqldb.jdbcDriver"); - p.put("JdbcUrl", "jdbc:hsqldb:mem:db" + i); - p.put("UserName", "sa"); - p.put("Password", ""); - p.put("JtaManaged", "true"); - assembler.createResource(config.configureService(resourceDs, ResourceInfo.class)); - } - final Resource resourceRouter = new Resource("My Router", "org.apache.openejb.router.test.DynamicDataSourceTest$DeterminedRouter", "org.router:DeterminedRouter"); - resourceRouter.getProperties().setProperty("DatasourceNames", "database1 database2 database3"); - resourceRouter.getProperties().setProperty("DefaultDataSourceName", "database1"); - assembler.createResource(config.configureService(resourceRouter, ResourceInfo.class)); - - final Resource resourceRoutedDs = new Resource("Routed Datasource", "org.apache.openejb.resource.jdbc.Router", "RoutedDataSource"); - resourceRoutedDs.getProperties().setProperty("Router", "My Router"); - assembler.createResource(config.configureService(resourceRoutedDs, ResourceInfo.class)); - - // containers - final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class); - assembler.createContainer(statelessContainerInfo); - - final EjbJar ejbJar = new EjbJar(); - ejbJar.addEnterpriseBean(new StatelessBean(RoutedEJBBean.class)); - ejbJar.addEnterpriseBean(new StatelessBean(UtilityBean.class)); - - final EjbModule ejbModule = new EjbModule(ejbJar); - - // Create an "ear" - final AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-dynamic-data-source"); - appModule.getEjbModules().add(ejbModule); - - // Create a persistence-units - final PersistenceUnit unit = new PersistenceUnit("router"); - unit.addClass(Person.class); - unit.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema"); - unit.setTransactionType(TransactionType.JTA); - unit.setJtaDataSource("Routed Datasource"); - appModule.addPersistenceModule(new PersistenceModule("root", new Persistence(unit))); - for (int i = 1; i <= 3; i++) { - final PersistenceUnit u = new PersistenceUnit("db" + i); - u.addClass(Person.class); - u.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema"); - u.setTransactionType(TransactionType.JTA); - u.setJtaDataSource("database" + i); - appModule.addPersistenceModule(new PersistenceModule("root", new Persistence(u))); - } - - assembler.createApplication(config.configureApplication(appModule)); - - // context - final Context ctx = new InitialContext(); - - // running persist on all "routed" databases - final List<String> databases = new ArrayList<String>(); - databases.add("database1"); - databases.add("database2"); - databases.add("database3"); - - // convinient bean to create tables for each persistence unit - final Utility utility = (Utility) ctx.lookup("UtilityBeanLocal"); - utility.initDatabase(); - - final RoutedEJB ejb = (RoutedEJB) ctx.lookup("RoutedEJBBeanLocal"); - for (int i = 0; i < 18; i++) { - final String name = "record " + i; - final String db = databases.get(i % 3); - ejb.persist(i, name, db); - } - - // assert database records number using jdbc - for (int i = 1; i <= 3; i++) { - final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:db" + i, "sa", ""); - final Statement st = connection.createStatement(); - final ResultSet rs = st.executeQuery("select count(*) from \"DynamicDataSourceTest$Person\""); - rs.next(); - assertEquals(6, rs.getInt(1)); - st.close(); - connection.close(); - } - } - - @Stateless - @Local(RoutedEJB.class) - public static class RoutedEJBBean implements RoutedEJB { - @PersistenceContext(unitName = "router") - private EntityManager em; - - @javax.annotation.Resource(name = "My Router", type = DeterminedRouter.class) - private DeterminedRouter router; - - public void persist(final int id, final String name, final String ds) { - router.setDataSource(ds); - em.persist(new Person(id, name)); - } - - } - - @Stateless - @Local(Utility.class) - public static class UtilityBean implements Utility { - - @PersistenceContext(unitName = "db1") - private EntityManager em1; - @PersistenceContext(unitName = "db2") - private EntityManager em2; - @PersistenceContext(unitName = "db3") - private EntityManager em3; - - @TransactionAttribute(TransactionAttributeType.SUPPORTS) - public void initDatabase() { - em1.find(Person.class, 0); - em2.find(Person.class, 0); - em3.find(Person.class, 0); - } - } - - public static interface RoutedEJB { - void persist(int id, String name, String ds); - } - - public static interface Utility { - void initDatabase(); - } - - @Entity - public static class Person { - @Id - private long id; - private String name; - - public Person() { - // no-op - } - - public Person(final int i, final String n) { - id = i; - name = n; - } - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - } - - public static class DeterminedRouter implements Router { - private String dataSourceNames; - private String defaultDataSourceName; - private Map<String, DataSource> dataSources = null; - private final ThreadLocal<DataSource> currentDataSource = new ThreadLocal<DataSource>(); - - /** - * @param datasourceList datasource resource name, separator is a space - */ - public void setDataSourceNames(final String datasourceList) { - dataSourceNames = datasourceList; - } - - /** - * lookup datasource in openejb resources - */ - private void init() { - dataSources = new ConcurrentHashMap<String, DataSource>(); - for (final String ds : dataSourceNames.split(" ")) { - final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); - - Object o = null; - final Context ctx = containerSystem.getJNDIContext(); - try { - o = ctx.lookup("openejb:Resource/" + ds); - if (o instanceof DataSource) { - dataSources.put(ds, (DataSource) o); - } - } catch (final NamingException e) { - } - } - } - - /** - * @return the user selected data source if it is set - * or the default one - * @throws IllegalArgumentException if the data source is not found - */ - public DataSource getDataSource() { - // lazy init of routed datasources - if (dataSources == null) { - init(); - } - - // if no datasource is selected use the default one - if (currentDataSource.get() == null) { - if (dataSources.containsKey(defaultDataSourceName)) { - return dataSources.get(defaultDataSourceName); - - } else { - throw new IllegalArgumentException("you have to specify at least one datasource"); - } - } - - // the developper set the datasource to use - return currentDataSource.get(); - } - - /** - * @param datasourceName data source name - */ - public void setDataSource(final String datasourceName) { - if (dataSources == null) { - init(); - } - if (!dataSources.containsKey(datasourceName)) { - throw new IllegalArgumentException("data source called " + datasourceName + " can't be found."); - } - final DataSource ds = dataSources.get(datasourceName); - currentDataSource.set(ds); - } - - /** - * reset the data source - */ - public void clear() { - currentDataSource.remove(); - } - - public void setDefaultDataSourceName(final String name) { - this.defaultDataSourceName = name; - } - } -} +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.resource.jdbc; + +import org.apache.openejb.OpenEJB; +import org.apache.openejb.assembler.classic.Assembler; +import org.apache.openejb.assembler.classic.ProxyFactoryInfo; +import org.apache.openejb.assembler.classic.ResourceInfo; +import org.apache.openejb.assembler.classic.SecurityServiceInfo; +import org.apache.openejb.assembler.classic.StatelessSessionContainerInfo; +import org.apache.openejb.assembler.classic.TransactionServiceInfo; +import org.apache.openejb.config.AppModule; +import org.apache.openejb.config.ConfigurationFactory; +import org.apache.openejb.config.EjbModule; +import org.apache.openejb.config.PersistenceModule; +import org.apache.openejb.config.sys.Resource; +import org.apache.openejb.core.LocalInitialContextFactory; +import org.apache.openejb.jee.EjbJar; +import org.apache.openejb.jee.StatelessBean; +import org.apache.openejb.jee.jpa.unit.Persistence; +import org.apache.openejb.jee.jpa.unit.PersistenceUnit; +import org.apache.openejb.jee.jpa.unit.TransactionType; +import org.apache.openejb.loader.SystemInstance; +import org.apache.openejb.resource.jdbc.router.Router; +import org.apache.openejb.spi.ContainerSystem; +import org.junit.After; +import org.junit.Test; + +import javax.ejb.Local; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.PersistenceContext; +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; + +import static org.junit.Assert.assertEquals; + +public class DynamicDataSourceTest { + + @After + public void tearDown() throws Exception { + OpenEJB.destroy(); + } + + @Test + public void route() throws Exception { + System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName()); + + final ConfigurationFactory config = new ConfigurationFactory(); + + final Assembler assembler = new Assembler(); + assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class)); + assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class)); + assembler.createSecurityService(config.configureService(SecurityServiceInfo.class)); + + // resources + for (int i = 1; i <= 3; i++) { + final String dbName = "database" + i; + final Resource resourceDs = new Resource(dbName, "DataSource"); + final Properties p = resourceDs.getProperties(); + p.put("JdbcDriver", "org.hsqldb.jdbcDriver"); + p.put("JdbcUrl", "jdbc:hsqldb:mem:db" + i); + p.put("UserName", "sa"); + p.put("Password", ""); + p.put("JtaManaged", "true"); + assembler.createResource(config.configureService(resourceDs, ResourceInfo.class)); + } + final Resource resourceRouter = new Resource("My Router", "org.apache.openejb.router.test.DynamicDataSourceTest$DeterminedRouter", "org.router:DeterminedRouter"); + resourceRouter.getProperties().setProperty("DatasourceNames", "database1 database2 database3"); + resourceRouter.getProperties().setProperty("DefaultDataSourceName", "database1"); + assembler.createResource(config.configureService(resourceRouter, ResourceInfo.class)); + + final Resource resourceRoutedDs = new Resource("Routed Datasource", "org.apache.openejb.resource.jdbc.Router", "RoutedDataSource"); + resourceRoutedDs.getProperties().setProperty("Router", "My Router"); + assembler.createResource(config.configureService(resourceRoutedDs, ResourceInfo.class)); + + // containers + final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class); + assembler.createContainer(statelessContainerInfo); + + final EjbJar ejbJar = new EjbJar(); + ejbJar.addEnterpriseBean(new StatelessBean(RoutedEJBBean.class)); + ejbJar.addEnterpriseBean(new StatelessBean(UtilityBean.class)); + + final EjbModule ejbModule = new EjbModule(ejbJar); + + // Create an "ear" + final AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-dynamic-data-source"); + appModule.getEjbModules().add(ejbModule); + + // Create a persistence-units + final PersistenceUnit unit = new PersistenceUnit("router"); + unit.addClass(Person.class); + unit.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema"); + unit.setTransactionType(TransactionType.JTA); + unit.setJtaDataSource("Routed Datasource"); + appModule.addPersistenceModule(new PersistenceModule("root", new Persistence(unit))); + for (int i = 1; i <= 3; i++) { + final PersistenceUnit u = new PersistenceUnit("db" + i); + u.addClass(Person.class); + u.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema"); + u.setTransactionType(TransactionType.JTA); + u.setJtaDataSource("database" + i); + appModule.addPersistenceModule(new PersistenceModule("root", new Persistence(u))); + } + + assembler.createApplication(config.configureApplication(appModule)); + + // context + final Context ctx = new InitialContext(); + + // running persist on all "routed" databases + final List<String> databases = new ArrayList<String>(); + databases.add("database1"); + databases.add("database2"); + databases.add("database3"); + + // convinient bean to create tables for each persistence unit + final Utility utility = (Utility) ctx.lookup("UtilityBeanLocal"); + utility.initDatabase(); + + final RoutedEJB ejb = (RoutedEJB) ctx.lookup("RoutedEJBBeanLocal"); + for (int i = 0; i < 18; i++) { + final String name = "record " + i; + final String db = databases.get(i % 3); + ejb.persist(i, name, db); + } + + // assert database records number using jdbc + for (int i = 1; i <= 3; i++) { + final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:db" + i, "sa", ""); + final Statement st = connection.createStatement(); + final ResultSet rs = st.executeQuery("select count(*) from \"DynamicDataSourceTest$Person\""); + rs.next(); + assertEquals(6, rs.getInt(1)); + st.close(); + connection.close(); + } + } + + @Stateless + @Local(RoutedEJB.class) + public static class RoutedEJBBean implements RoutedEJB { + @PersistenceContext(unitName = "router") + private EntityManager em; + + @javax.annotation.Resource(name = "My Router", type = DeterminedRouter.class) + private DeterminedRouter router; + + public void persist(final int id, final String name, final String ds) { + router.setDataSource(ds); + em.persist(new Person(id, name)); + } + + } + + @Stateless + @Local(Utility.class) + public static class UtilityBean implements Utility { + + @PersistenceContext(unitName = "db1") + private EntityManager em1; + @PersistenceContext(unitName = "db2") + private EntityManager em2; + @PersistenceContext(unitName = "db3") + private EntityManager em3; + + @TransactionAttribute(TransactionAttributeType.SUPPORTS) + public void initDatabase() { + em1.find(Person.class, 0); + em2.find(Person.class, 0); + em3.find(Person.class, 0); + } + } + + public static interface RoutedEJB { + void persist(int id, String name, String ds); + } + + public static interface Utility { + void initDatabase(); + } + + @Entity + public static class Person { + @Id + private long id; + private String name; + + public Person() { + // no-op + } + + public Person(final int i, final String n) { + id = i; + name = n; + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + } + + public static class DeterminedRouter implements Router { + private String dataSourceNames; + private String defaultDataSourceName; + private Map<String, DataSource> dataSources = null; + private final ThreadLocal<DataSource> currentDataSource = new ThreadLocal<DataSource>(); + + /** + * @param datasourceList datasource resource name, separator is a space + */ + public void setDataSourceNames(final String datasourceList) { + dataSourceNames = datasourceList; + } + + /** + * lookup datasource in openejb resources + */ + private void init() { + dataSources = new ConcurrentHashMap<String, DataSource>(); + for (final String ds : dataSourceNames.split(" ")) { + final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); + + Object o = null; + final Context ctx = containerSystem.getJNDIContext(); + try { + o = ctx.lookup("openejb:Resource/" + ds); + if (o instanceof DataSource) { + dataSources.put(ds, (DataSource) o); + } + } catch (final NamingException e) { + } + } + } + + /** + * @return the user selected data source if it is set + * or the default one + * @throws IllegalArgumentException if the data source is not found + */ + public DataSource getDataSource() { + // lazy init of routed datasources + if (dataSources == null) { + init(); + } + + // if no datasource is selected use the default one + if (currentDataSource.get() == null) { + if (dataSources.containsKey(defaultDataSourceName)) { + return dataSources.get(defaultDataSourceName); + + } else { + throw new IllegalArgumentException("you have to specify at least one datasource"); + } + } + + // the developper set the datasource to use + return currentDataSource.get(); + } + + /** + * @param datasourceName data source name + */ + public void setDataSource(final String datasourceName) { + if (dataSources == null) { + init(); + } + if (!dataSources.containsKey(datasourceName)) { + throw new IllegalArgumentException("data source called " + datasourceName + " can't be found."); + } + final DataSource ds = dataSources.get(datasourceName); + currentDataSource.set(ds); + } + + /** + * reset the data source + */ + public void clear() { + currentDataSource.remove(); + } + + public void setDefaultDataSourceName(final String name) { + this.defaultDataSourceName = name; + } + } +}
http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/driver/AlternateDriverJarTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/driver/AlternateDriverJarTest.java b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/driver/AlternateDriverJarTest.java index ae7015e..caee9e5 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/driver/AlternateDriverJarTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/driver/AlternateDriverJarTest.java @@ -1,132 +1,132 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.resource.jdbc.driver; - -import org.apache.openejb.jee.EjbJar; -import org.apache.openejb.jee.SingletonBean; -import org.apache.openejb.junit.ApplicationComposer; -import org.apache.openejb.testing.Configuration; -import org.apache.openejb.testing.Module; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -import javax.annotation.Resource; -import javax.ejb.EJB; -import javax.ejb.LocalBean; -import javax.ejb.Singleton; -import javax.sql.DataSource; -import java.io.File; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Properties; - -import static org.apache.openejb.loader.JarLocation.jarLocation; - -@RunWith(ApplicationComposer.class) -public class AlternateDriverJarTest { - - private static final String USER = "SA"; - private static final String PASSWORD = ""; - - @Configuration - public Properties config() { - - final File drivers = new File(jarLocation(AlternateDriverJarTest.class).getParentFile(), "drivers").getAbsoluteFile(); - - final Properties p = new Properties(); - p.put("openejb.jdbc.datasource-creator", "dbcp-alternative"); - - File file = new File(drivers, "derby-10.10.1.1.jar"); - Assert.assertTrue("Failed to find: " + file, file.exists()); - - p.put("JdbcOne", "new://Resource?type=DataSource&classpath=" - + file.getAbsolutePath().replace("\\", "/")); - p.put("JdbcOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("JdbcOne.JdbcUrl", "jdbc:derby:memory:JdbcOne;create=true"); - p.put("JdbcOne.UserName", USER); - p.put("JdbcOne.Password", PASSWORD); - p.put("JdbcOne.JtaManaged", "false"); - - file = new File(drivers, "derby-10.9.1.0.jar"); - Assert.assertTrue("Failed to find: " + file, file.exists()); - - p.put("JdbcTwo", "new://Resource?type=DataSource&classpath=" - + file.getAbsolutePath().replace("\\", "/")); - p.put("JdbcTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("JdbcTwo.JdbcUrl", "jdbc:derby:memory:JdbcTwo;create=true"); - p.put("JdbcTwo.UserName", USER); - p.put("JdbcTwo.Password", PASSWORD); - p.put("JdbcTwo.JtaManaged", "false"); - return p; - } - - @Module - public EjbJar app() throws Exception { - return new EjbJar() - .enterpriseBean(new SingletonBean(JdbcOne.class).localBean()) - .enterpriseBean(new SingletonBean(JdbcTwo.class).localBean()); - } - - @EJB - private JdbcOne one; - - @EJB - private JdbcTwo two; - - @Test - public void testBoth() throws Exception { - - final String oneDriverVersion = one.getDriverVersion(); - System.out.println("oneDriverVersion = " + oneDriverVersion); - Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", oneDriverVersion); - - final String twoDriverVersion = two.getDriverVersion(); - System.out.println("twoDriverVersion = " + twoDriverVersion); - Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", twoDriverVersion); - } - - @LocalBean - @Singleton - public static class JdbcOne { - - @Resource(name = "JdbcOne") - private DataSource ds; - - public String getDriverVersion() throws Exception { - - final Connection con = ds.getConnection(); - final DatabaseMetaData md = con.getMetaData(); - return md.getDriverVersion(); - } - } - - @LocalBean - @Singleton - public static class JdbcTwo { - - @Resource(name = "JdbcTwo") - private DataSource ds; - - public String getDriverVersion() throws Exception { - - final Connection con = ds.getConnection(); - final DatabaseMetaData md = con.getMetaData(); - return md.getDriverVersion(); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.resource.jdbc.driver; + +import org.apache.openejb.jee.EjbJar; +import org.apache.openejb.jee.SingletonBean; +import org.apache.openejb.junit.ApplicationComposer; +import org.apache.openejb.testing.Configuration; +import org.apache.openejb.testing.Module; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.LocalBean; +import javax.ejb.Singleton; +import javax.sql.DataSource; +import java.io.File; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.util.Properties; + +import static org.apache.openejb.loader.JarLocation.jarLocation; + +@RunWith(ApplicationComposer.class) +public class AlternateDriverJarTest { + + private static final String USER = "SA"; + private static final String PASSWORD = ""; + + @Configuration + public Properties config() { + + final File drivers = new File(jarLocation(AlternateDriverJarTest.class).getParentFile(), "drivers").getAbsoluteFile(); + + final Properties p = new Properties(); + p.put("openejb.jdbc.datasource-creator", "dbcp-alternative"); + + File file = new File(drivers, "derby-10.10.1.1.jar"); + Assert.assertTrue("Failed to find: " + file, file.exists()); + + p.put("JdbcOne", "new://Resource?type=DataSource&classpath=" + + file.getAbsolutePath().replace("\\", "/")); + p.put("JdbcOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); + p.put("JdbcOne.JdbcUrl", "jdbc:derby:memory:JdbcOne;create=true"); + p.put("JdbcOne.UserName", USER); + p.put("JdbcOne.Password", PASSWORD); + p.put("JdbcOne.JtaManaged", "false"); + + file = new File(drivers, "derby-10.9.1.0.jar"); + Assert.assertTrue("Failed to find: " + file, file.exists()); + + p.put("JdbcTwo", "new://Resource?type=DataSource&classpath=" + + file.getAbsolutePath().replace("\\", "/")); + p.put("JdbcTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); + p.put("JdbcTwo.JdbcUrl", "jdbc:derby:memory:JdbcTwo;create=true"); + p.put("JdbcTwo.UserName", USER); + p.put("JdbcTwo.Password", PASSWORD); + p.put("JdbcTwo.JtaManaged", "false"); + return p; + } + + @Module + public EjbJar app() throws Exception { + return new EjbJar() + .enterpriseBean(new SingletonBean(JdbcOne.class).localBean()) + .enterpriseBean(new SingletonBean(JdbcTwo.class).localBean()); + } + + @EJB + private JdbcOne one; + + @EJB + private JdbcTwo two; + + @Test + public void testBoth() throws Exception { + + final String oneDriverVersion = one.getDriverVersion(); + System.out.println("oneDriverVersion = " + oneDriverVersion); + Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", oneDriverVersion); + + final String twoDriverVersion = two.getDriverVersion(); + System.out.println("twoDriverVersion = " + twoDriverVersion); + Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", twoDriverVersion); + } + + @LocalBean + @Singleton + public static class JdbcOne { + + @Resource(name = "JdbcOne") + private DataSource ds; + + public String getDriverVersion() throws Exception { + + final Connection con = ds.getConnection(); + final DatabaseMetaData md = con.getMetaData(); + return md.getDriverVersion(); + } + } + + @LocalBean + @Singleton + public static class JdbcTwo { + + @Resource(name = "JdbcTwo") + private DataSource ds; + + public String getDriverVersion() throws Exception { + + final Connection con = ds.getConnection(); + final DatabaseMetaData md = con.getMetaData(); + return md.getDriverVersion(); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Green.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Green.java b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Green.java index 7e22c15..9333805 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Green.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Green.java @@ -1,33 +1,33 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.test.annotated; - -import javax.ejb.Stateful; -import javax.interceptor.AroundInvoke; -import javax.jws.WebService; - - -@Stateful(description = "test") -@WebService -public class Green { - - // need to add this @AroundInvoke to cause validation to fail. Validation does not - // fail on warnings, which causes this framework to not work properly - @AroundInvoke - public void sayCheese() { - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.test.annotated; + +import javax.ejb.Stateful; +import javax.interceptor.AroundInvoke; +import javax.jws.WebService; + + +@Stateful(description = "test") +@WebService +public class Green { + + // need to add this @AroundInvoke to cause validation to fail. Validation does not + // fail on warnings, which causes this framework to not work properly + @AroundInvoke + public void sayCheese() { + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Red.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Red.java b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Red.java index 5cff367..69632ec 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Red.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Red.java @@ -1,32 +1,32 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.test.annotated; - -import javax.annotation.ManagedBean; -import javax.interceptor.AroundInvoke; -import javax.jws.WebService; - -@ManagedBean -@WebService -public class Red { - - // need to add this @AroundInvoke to cause validation to fail. Validation does not - // fail on warnings, which causes this framework to not work properly - @AroundInvoke - public void sayCheese() { - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.test.annotated; + +import javax.annotation.ManagedBean; +import javax.interceptor.AroundInvoke; +import javax.jws.WebService; + +@ManagedBean +@WebService +public class Red { + + // need to add this @AroundInvoke to cause validation to fail. Validation does not + // fail on warnings, which causes this framework to not work properly + @AroundInvoke + public void sayCheese() { + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Yellow.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Yellow.java b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Yellow.java index f8774ff..d16c274 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Yellow.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/test/annotated/Yellow.java @@ -1,40 +1,40 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.test.annotated; - -import javax.ejb.MessageDriven; -import javax.interceptor.AroundInvoke; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jws.WebService; - - -@MessageDriven -@WebService -public class Yellow implements MessageListener { - - // need to add this @AroundInvoke to cause validation to fail. Validation does not - // fail on warnings, which causes this framework to not work properly - @AroundInvoke - public void sayCheese() { - } - - @Override - public void onMessage(final Message message) { - //To change body of implemented methods use File | Settings | File Templates. - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.test.annotated; + +import javax.ejb.MessageDriven; +import javax.interceptor.AroundInvoke; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jws.WebService; + + +@MessageDriven +@WebService +public class Yellow implements MessageListener { + + // need to add this @AroundInvoke to cause validation to fail. Validation does not + // fail on warnings, which causes this framework to not work properly + @AroundInvoke + public void sayCheese() { + } + + @Override + public void onMessage(final Message message) { + //To change body of implemented methods use File | Settings | File Templates. + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/util/BeanTypeComparisonTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/BeanTypeComparisonTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/BeanTypeComparisonTest.java index 67aa55f..7bc1d27 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/util/BeanTypeComparisonTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/util/BeanTypeComparisonTest.java @@ -1,35 +1,35 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.util; - -import org.apache.openejb.BeanType; -import org.apache.openejb.jee.SessionType; -import org.junit.Test; - -import static org.junit.Assert.assertFalse; - -public class BeanTypeComparisonTest { - - @Test - public void testEqualsMethodForDifferentClassTypes() { - final BeanType beanType = BeanType.STATELESS; - final SessionType sessionType = SessionType.STATELESS; - assertFalse(beanType.equals(sessionType)); - } - - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.util; + +import org.apache.openejb.BeanType; +import org.apache.openejb.jee.SessionType; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; + +public class BeanTypeComparisonTest { + + @Test + public void testEqualsMethodForDifferentClassTypes() { + final BeanType beanType = BeanType.STATELESS; + final SessionType sessionType = SessionType.STATELESS; + assertFalse(beanType.equals(sessionType)); + } + + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/util/CollectionsUtilTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/util/CollectionsUtilTest.java b/container/openejb-core/src/test/java/org/apache/openejb/util/CollectionsUtilTest.java index 7eca925..fe7373d 100644 --- a/container/openejb-core/src/test/java/org/apache/openejb/util/CollectionsUtilTest.java +++ b/container/openejb-core/src/test/java/org/apache/openejb/util/CollectionsUtilTest.java @@ -1,34 +1,34 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.util; - -import org.junit.Test; - -import java.util.List; - -public class CollectionsUtilTest { - - @Test - public void safeIterationForNullList() { - final List<String> stringList = null; - for (final String string : CollectionsUtil.safe(stringList)) { - } - - //PASS: No NPE thrown - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.util; + +import org.junit.Test; + +import java.util.List; + +public class CollectionsUtilTest { + + @Test + public void safeIterationForNullList() { + final List<String> stringList = null; + for (final String string : CollectionsUtil.safe(stringList)) { + } + + //PASS: No NPE thrown + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/resources/META-INF/jpa-test-mappings.xml ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/resources/META-INF/jpa-test-mappings.xml b/container/openejb-core/src/test/resources/META-INF/jpa-test-mappings.xml index a644fac..fe6eae5 100644 --- a/container/openejb-core/src/test/resources/META-INF/jpa-test-mappings.xml +++ b/container/openejb-core/src/test/resources/META-INF/jpa-test-mappings.xml @@ -1,24 +1,24 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- $Rev$ $Date$ --> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- $Rev$ $Date$ --> + <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" version="1.0"> <mapped-superclass class="org.apache.openejb.test.entity.cmp.BasicCmpBean"> <attributes> http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/resources/META-INF/org.acme/service-jar.xml ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/resources/META-INF/org.acme/service-jar.xml b/container/openejb-core/src/test/resources/META-INF/org.acme/service-jar.xml index c9bceb1..147189f 100644 --- a/container/openejb-core/src/test/resources/META-INF/org.acme/service-jar.xml +++ b/container/openejb-core/src/test/resources/META-INF/org.acme/service-jar.xml @@ -1,24 +1,24 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- $Rev$ $Date$ --> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- $Rev$ $Date$ --> + <ServiceJar> <ServiceProvider id="CheddarContainer" service="Container" class-name="org.acme.SuperContainer"> http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/resources/META-INF/org.router/service-jar.xml ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/resources/META-INF/org.router/service-jar.xml b/container/openejb-core/src/test/resources/META-INF/org.router/service-jar.xml index cb86297..e409d7d 100644 --- a/container/openejb-core/src/test/resources/META-INF/org.router/service-jar.xml +++ b/container/openejb-core/src/test/resources/META-INF/org.router/service-jar.xml @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- $Rev$ --> -<ServiceJar> - <ServiceProvider id="DeterminedRouter" service="Resource" - type="org.apache.openejb.resource.jdbc.router.Router" - class-name="org.apache.openejb.resource.jdbc.DynamicDataSourceTest$DeterminedRouter"> - DataSourceNames - DefaultDataSourceName - </ServiceProvider> -</ServiceJar> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- $Rev$ --> +<ServiceJar> + <ServiceProvider id="DeterminedRouter" service="Resource" + type="org.apache.openejb.resource.jdbc.router.Router" + class-name="org.apache.openejb.resource.jdbc.DynamicDataSourceTest$DeterminedRouter"> + DataSourceNames + DefaultDataSourceName + </ServiceProvider> +</ServiceJar> http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-openejb-jar.xml ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-openejb-jar.xml b/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-openejb-jar.xml index 9ea2e3d..e2017c0 100644 --- a/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-openejb-jar.xml +++ b/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-openejb-jar.xml @@ -1,23 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- $Rev$ $Date$ --> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- $Rev$ $Date$ --> + <openejb-jar xmlns="http://tomee.apache.org/xml/ns/openejb-jar-2.2" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-pojo-openejb-jar.xml ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-pojo-openejb-jar.xml b/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-pojo-openejb-jar.xml index cd8fbb3..229900c 100644 --- a/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-pojo-openejb-jar.xml +++ b/container/openejb-core/src/test/resources/convert/oej2/cmp/itest-2.2/itest-2.2-pojo-openejb-jar.xml @@ -1,234 +1,234 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- $Rev$ $Date$ --> - -<openejb-jar xmlns="http://tomee.apache.org/xml/ns/openejb-jar-2.2" - xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" - xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> - <!--xmlns:pkgen="http://tomee.apache.org/xml/ns/pkgen-2.1"--> - - <environment> - <moduleId> - <groupId>org.apache.openejb</groupId> - <artifactId>openejb-itests-core</artifactId> - <version>${openejbVersion}</version> - <type>car</type> - </moduleId> - - <dependencies> - <dependency> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>j2ee-corba-yoko</artifactId> - <version>${version}</version> - <type>car</type> - </dependency> - <dependency> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <type>car</type> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - </environment> - - <cmp-connection-factory> - <resource-link>SystemDatasource</resource-link> - </cmp-connection-factory> - - <enterprise-beans> - <session> - <ejb-name>BasicStatelessBean</ejb-name> - <jndi-name>client/tests/stateless/BasicStatelessHome</jndi-name> - <resource-ref> - <ref-name>stateless/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>BasicBMTStatelessBean</ejb-name> - <jndi-name>client/tests/stateless/BeanManagedBasicStatelessHome</jndi-name> - <resource-ref> - <ref-name>stateless/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>DatabaseBean</ejb-name> - <jndi-name>client/tools/DatabaseHome</jndi-name> - <resource-ref> - <ref-name>database</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>BMTStatelessBean</ejb-name> - <jndi-name>client/tests/stateless/BeanManagedTransactionTests/EJBHome</jndi-name> - <resource-ref> - <ref-name>database</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>EncStatelessBean</ejb-name> - <jndi-name>client/tests/stateless/EncBean</jndi-name> - <resource-ref> - <ref-name>datasource</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>StatelessRMIIIOPBean</ejb-name> - <jndi-name>client/tests/stateless/RMI-over-IIOP/EJBHome</jndi-name> - </session> - <session> - <ejb-name>BasicStatelessBean</ejb-name> - <jndi-name>client/tests/stateless/BasicStatelessHome</jndi-name> - <resource-ref> - <ref-name>stateless/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>SessionFacadeBean</ejb-name> - <jndi-name>client/tests/entity/cmp/SessionFacadeBean</jndi-name> - </session> - <session> - <ejb-name>BasicStatefulBean</ejb-name> - <jndi-name>client/tests/stateful/BasicStatefulHome</jndi-name> - <resource-ref> - <ref-name>stateful/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>BasicBMTStatefulBean</ejb-name> - <jndi-name>client/tests/stateful/BeanManagedBasicStatefulHome</jndi-name> - <resource-ref> - <ref-name>stateful/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>BMTStatefulBean</ejb-name> - <jndi-name>client/tests/stateful/BeanManagedTransactionTests/EJBHome</jndi-name> - <resource-ref> - <ref-name>datasource</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>EncStatefulBean</ejb-name> - <jndi-name>client/tests/stateful/EncBean</jndi-name> - <resource-ref> - <ref-name>datasource</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </session> - <session> - <ejb-name>StatefulRMIIIOPBean</ejb-name> - <jndi-name>client/tests/stateful/RMI-over-IIOP/EJBHome</jndi-name> - </session> - <entity> - <ejb-name>BasicBmpBean</ejb-name> - <jndi-name>client/tests/entity/bmp/BasicBmpHome</jndi-name> - <resource-ref> - <ref-name>jdbc/basic/entityDatabase</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </entity> - <entity> - <ejb-name>AOBasicBmpBean</ejb-name> - <jndi-name>client/tests/entity/bmp/allowed_operations/EntityHome</jndi-name> - <resource-ref> - <ref-name>jdbc/basic/entityDatabase</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - <resource-ref> - <ref-name>entity/references/Resource_manager_access</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- $Rev$ $Date$ --> + +<openejb-jar xmlns="http://tomee.apache.org/xml/ns/openejb-jar-2.2" + xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" + xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> + <!--xmlns:pkgen="http://tomee.apache.org/xml/ns/pkgen-2.1"--> + + <environment> + <moduleId> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-itests-core</artifactId> + <version>${openejbVersion}</version> + <type>car</type> + </moduleId> + + <dependencies> + <dependency> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>j2ee-corba-yoko</artifactId> + <version>${version}</version> + <type>car</type> + </dependency> + <dependency> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <type>car</type> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + </dependencies> + </environment> + + <cmp-connection-factory> + <resource-link>SystemDatasource</resource-link> + </cmp-connection-factory> + + <enterprise-beans> + <session> + <ejb-name>BasicStatelessBean</ejb-name> + <jndi-name>client/tests/stateless/BasicStatelessHome</jndi-name> + <resource-ref> + <ref-name>stateless/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>BasicBMTStatelessBean</ejb-name> + <jndi-name>client/tests/stateless/BeanManagedBasicStatelessHome</jndi-name> + <resource-ref> + <ref-name>stateless/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>DatabaseBean</ejb-name> + <jndi-name>client/tools/DatabaseHome</jndi-name> + <resource-ref> + <ref-name>database</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>BMTStatelessBean</ejb-name> + <jndi-name>client/tests/stateless/BeanManagedTransactionTests/EJBHome</jndi-name> + <resource-ref> + <ref-name>database</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>EncStatelessBean</ejb-name> + <jndi-name>client/tests/stateless/EncBean</jndi-name> + <resource-ref> + <ref-name>datasource</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>StatelessRMIIIOPBean</ejb-name> + <jndi-name>client/tests/stateless/RMI-over-IIOP/EJBHome</jndi-name> + </session> + <session> + <ejb-name>BasicStatelessBean</ejb-name> + <jndi-name>client/tests/stateless/BasicStatelessHome</jndi-name> + <resource-ref> + <ref-name>stateless/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>SessionFacadeBean</ejb-name> + <jndi-name>client/tests/entity/cmp/SessionFacadeBean</jndi-name> + </session> + <session> + <ejb-name>BasicStatefulBean</ejb-name> + <jndi-name>client/tests/stateful/BasicStatefulHome</jndi-name> + <resource-ref> + <ref-name>stateful/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>BasicBMTStatefulBean</ejb-name> + <jndi-name>client/tests/stateful/BeanManagedBasicStatefulHome</jndi-name> + <resource-ref> + <ref-name>stateful/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>BMTStatefulBean</ejb-name> + <jndi-name>client/tests/stateful/BeanManagedTransactionTests/EJBHome</jndi-name> + <resource-ref> + <ref-name>datasource</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>EncStatefulBean</ejb-name> + <jndi-name>client/tests/stateful/EncBean</jndi-name> + <resource-ref> + <ref-name>datasource</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </session> + <session> + <ejb-name>StatefulRMIIIOPBean</ejb-name> + <jndi-name>client/tests/stateful/RMI-over-IIOP/EJBHome</jndi-name> + </session> + <entity> + <ejb-name>BasicBmpBean</ejb-name> + <jndi-name>client/tests/entity/bmp/BasicBmpHome</jndi-name> + <resource-ref> + <ref-name>jdbc/basic/entityDatabase</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </entity> + <entity> + <ejb-name>AOBasicBmpBean</ejb-name> + <jndi-name>client/tests/entity/bmp/allowed_operations/EntityHome</jndi-name> + <resource-ref> + <ref-name>jdbc/basic/entityDatabase</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + <resource-ref> + <ref-name>entity/references/Resource_manager_access</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> <name>SystemDatasource</name> </pattern> </resource-ref> @@ -291,38 +291,38 @@ </pattern> </resource-ref> </entity> - <entity> - <ejb-name>BasicCmp2PojoBean</ejb-name> - <jndi-name>client/tests/entity/cmp2/BasicCmpPojoHome</jndi-name> - <table-name>entity</table-name> - <cmp-field-mapping> - <cmp-field-name>id</cmp-field-name> - <table-column>id</table-column> - </cmp-field-mapping> - <cmp-field-mapping> - <cmp-field-name>firstName</cmp-field-name> - <table-column>first_name</table-column> - </cmp-field-mapping> - <cmp-field-mapping> - <cmp-field-name>lastName</cmp-field-name> - <table-column>last_name</table-column> - </cmp-field-mapping> - <key-generator> - <auto-increment-table> - <sql>INSERT INTO entity (first_name) VALUES ('AUTO_GENERATED')</sql> - <return-type>java.lang.Integer</return-type> - </auto-increment-table> - </key-generator> - <resource-ref> - <ref-name>jdbc/basic/entityDatabase</ref-name> - <pattern> - <groupId>org.apache.geronimo.configs</groupId> - <artifactId>system-database</artifactId> - <version>${version}</version> - <name>SystemDatasource</name> - </pattern> - </resource-ref> - </entity> + <entity> + <ejb-name>BasicCmp2PojoBean</ejb-name> + <jndi-name>client/tests/entity/cmp2/BasicCmpPojoHome</jndi-name> + <table-name>entity</table-name> + <cmp-field-mapping> + <cmp-field-name>id</cmp-field-name> + <table-column>id</table-column> + </cmp-field-mapping> + <cmp-field-mapping> + <cmp-field-name>firstName</cmp-field-name> + <table-column>first_name</table-column> + </cmp-field-mapping> + <cmp-field-mapping> + <cmp-field-name>lastName</cmp-field-name> + <table-column>last_name</table-column> + </cmp-field-mapping> + <key-generator> + <auto-increment-table> + <sql>INSERT INTO entity (first_name) VALUES ('AUTO_GENERATED')</sql> + <return-type>java.lang.Integer</return-type> + </auto-increment-table> + </key-generator> + <resource-ref> + <ref-name>jdbc/basic/entityDatabase</ref-name> + <pattern> + <groupId>org.apache.geronimo.configs</groupId> + <artifactId>system-database</artifactId> + <version>${version}</version> + <name>SystemDatasource</name> + </pattern> + </resource-ref> + </entity> <entity> <ejb-name>AOBasicCmp2Bean</ejb-name> <jndi-name>client/tests/entity/cmp2/allowed_operations/EntityHome</jndi-name> @@ -821,4 +821,4 @@ <gbean name="ORBConfigAdapter" class="org.apache.openejb.yoko.ORBConfigAdapterGBean"/> </openejb-jar> - +