So use arquillian or applicationcomposer. You use EJBContainer i think which is a standalone solution and not a test one. That said you can exclude the resource configuring mvn jar plugin Le 3 nov. 2013 09:41, "Matthias Wessendorf" <mat...@apache.org> a écrit :
> Hrm, > > for me using a "src/main/resources/META-INF/test.persistence.xml" feels a > bit wrong, especially since test-ware should be stored w/in "src/test", > like src/test/resources/META-INF/persistence.xml; > > -Matthias > > > On Sun, Nov 3, 2013 at 9:17 AM, Romain Manni-Bucau <rmannibu...@gmail.com > >wrote: > > > Hi > > > > Both are in the classpath for different ejbmodule so that s ok. > > > > Maybe have a look to altdd to use test.persistence.xml in > > src/main/resources > > Le 3 nov. 2013 00:00, "Matthias Wessendorf" <mat...@apache.org> a écrit > : > > > > > Hi, > > > > > > > > > when running unit tests - where I have a > > > src/test/resources/META-INF/persistence.xml file - I am wondering why > the > > > one in src/main is also included. > > > > > > Wouldn't the one in test be the 'right' one ? > > > > > > See also [1] > > > > > > -Matthias > > > > > > > > > [1] > > > > > > > > > https://github.com/matzew/tomee/blob/trunk/examples/jpa-hibernate/src/test/resources/META-INF/persistence.xml > > > > > > > > > From the LOG (note the 'PersistenceUnit(name=movie-unit-TEST' and the > > > 'PersistenceUnit(name=movie-unit'): > > > > > > > > > > > > > > > INFO - Configuring PersistenceUnit(name=movie-unit-TEST, > > > provider=org.hibernate.ejb.HibernatePersistence) > > > INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type > > > 'DataSource for 'movie-unit-TEST'. > > > INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, > > > provider-id=movieDatabase) > > > INFO - Creating Resource(id=movieDatabaseNonJta) > > > INFO - Adjusting PersistenceUnit movie-unit-TEST <non-jta-data-source> > to > > > Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged' > > > INFO - Configuring PersistenceUnit(name=movie-unit, > > > provider=org.hibernate.ejb.HibernatePersistence) > > > INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to > > > Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged' > > > INFO - Enterprise application > > > "/Users/matzew/TEMP/TomEEFix/examples/jpa-hibernate" loaded. > > > INFO - Assembling app: > /Users/matzew/TEMP/TomEEFix/examples/jpa-hibernate > > > INFO - HV000001: Hibernate Validator 4.3.0.Final > > > INFO - HV000002: Ignoring XML configuration. > > > INFO - HV000002: Ignoring XML configuration. > > > INFO - HCANN000001: Hibernate Commons Annotations {4.0.1.Final} > > > INFO - HHH000412: Hibernate Core {4.1.8.Final} > > > INFO - HHH000206: hibernate.properties not found > > > INFO - HHH000021: Bytecode provider name : javassist > > > INFO - HHH000204: Processing PersistenceUnitInfo [ > > > name: movie-unit-TEST > > > ...] > > > INFO - HHH000130: Instantiating explicit connection provider: > > > org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider > > > INFO - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect > > > INFO - HHH000268: Transaction strategy: > > > org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory > > > INFO - HHH000397: Using ASTQueryTranslatorFactory > > > INFO - HHH000227: Running hbm2ddl schema export > > > INFO - HHH000230: Schema export complete > > > INFO - PersistenceUnit(name=movie-unit-TEST, > > > provider=org.hibernate.ejb.HibernatePersistence) - provider time 2143ms > > > INFO - HHH000204: Processing PersistenceUnitInfo [ > > > name: movie-unit > > > ...] > > > INFO - HHH000130: Instantiating explicit connection provider: > > > org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider > > > INFO - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect > > > INFO - HHH000268: Transaction strategy: > > > org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory > > > INFO - HHH000397: Using ASTQueryTranslatorFactory > > > INFO - HHH000227: Running hbm2ddl schema export > > > INFO - HHH000230: Schema export complete > > > INFO - PersistenceUnit(name=movie-unit, > > > provider=org.hibernate.ejb.HibernatePersistence) - provider time 673ms > > > > > > > > > -- > > > Matthias Wessendorf > > > > > > blog: http://matthiaswessendorf.wordpress.com/ > > > sessions: http://www.slideshare.net/mwessendorf > > > twitter: http://twitter.com/mwessendorf > > > > > > > > > -- > Matthias Wessendorf > > blog: http://matthiaswessendorf.wordpress.com/ > sessions: http://www.slideshare.net/mwessendorf > twitter: http://twitter.com/mwessendorf >