| Anonymous | Login | Signup for a new account | 06-10-2026 01:05 PDT |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0004163 | [Resin] | feature | always | 08-04-10 16:24 | 10-04-11 10:38 | ||||
| Reporter | reza | View Status | public | ||||||
| Assigned To | ferg | ||||||||
| Priority | normal | Resolution | no change required | ||||||
| Status | closed | Product Version | 4.0.10 | ||||||
| Summary | 0004163: Add the ability to specify alternative persistence.xml in ResinBeanContainerRunner | ||||||||
| Description |
It should be possible to specify alternative persistence.xml files per unit test like this: @RunWith(ResinBeanContainerRunner.class) @ResinBeanConfiguration(beansXml = { "classpath:META-INF/beans.xml", "classpath:beans-test.xml" } persistenceXml = { "classpath:META-INF/persistence-test.xml" }) public class AccountServiceTest { @Inject private AccountService accountService; @Test public void testAddAccount() { Account account = new Account(); account.setNumber("1111"); account.setCustomer("NRahman"); account.setBalance(1000.00); accountService.addAccount(account); } @Test public void testGetAccount() { Account account = accountService.getAccount("NRahman"); assertNotNull(account); } @Test public void testUpdateAccount() { Account account = accountService.getAccount("NRahman"); account.setBalance(1001.50); accountService.updateAccount(account); } @Test public void testDeleteAccount() { Account account = accountService.getAccount("NRahman"); accountService.deleteAccount(account); } @Test public void testTransfer() { accountService.transfer("MegaBank", "3434", "AcmeBank", "1111", 100.00); } } The alternative persistence.xml would enable different data sources, logging levels, provider configuration and so on. This could be an example alternative persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" [^] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xsi:schemaLocation="http://java.sun.com/xml/ns/persistence [^] http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> [^] <persistence-unit name="acme-bank-db" transaction-type="JTA"> <jta-data-source>jdbc/AcmeBankTestDB</jta-data-source> <validation-mode>AUTO</validation-mode> <properties> <property name="eclipselink.ddl-generation" value="drop-create-tables" /> <property name="eclipselink.logging.level" value="FINEST" /> </properties> </persistence-unit> </persistence> While the production version would look like this: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" [^] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xsi:schemaLocation="http://java.sun.com/xml/ns/persistence [^] http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> [^] <persistence-unit name="acme-bank-db" transaction-type="JTA"> <jta-data-source>jdbc/AcmeBankDB</jta-data-source> <validation-mode>AUTO</validation-mode> <properties> <property name="eclipselink.logging.level" value="WARNING" /> </properties> </persistence-unit> </persistence> |
||||||||
| Additional Information | |||||||||
| Attached Files | |||||||||
|
|
|||||||||
| There are no notes attached to this issue. |
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed. 25 unique queries executed. |