Advertisement
Guest User

Untitled

a guest
Jun 8th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. @RunWith(SpringJUnit4ClassRunner.class)
  2. @ContextConfiguration({ "classpath:applicationContext-service.xml", "classpath:applicationContext-persist.xml",
  3. "classpath:applicationContext-data-test.xml" })
  4. @Transactional
  5. public class InvoiceServiceImplTest {
  6.  
  7. @Autowired
  8. private InvoicingServiceImpl service;
  9.  
  10. @Before
  11. public void init() {
  12. createInvoiceData();
  13. }
  14.  
  15. @Test
  16. public void testSendInvoice() throws InvoicingFault {
  17. InvoicingRequest req = createRequest();
  18.  
  19. InvoicingResponse res = service.sendInvoice(req);
  20. TestCase.assertEquals(true, res.getInvoiceId() != null);
  21. }
  22. }
  23.  
  24. if (BaseDAO.invoiceDAO().getOwner(applicationId) == null) {
  25. throw new ...
  26. }
  27.  
  28. <?xml version="1.0" encoding="UTF-8"?>
  29. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  30. xmlns:aop="http://www.springframework.org/schema/aop"
  31. xmlns:tx="http://www.springframework.org/schema/tx"
  32. xmlns="http://www.springframework.org/schema/beans"
  33. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  34. xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  35. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  36. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  37. http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd">
  38.  
  39. <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  40. <property name="dataSource" ref="dataSource" />
  41. <property name="configLocation" value="classpath:hibernate.cfg.xml" />
  42. <property name="mappingResources">
  43. <list>
  44. <value>mapping/InvoiceData.hbm.xml</value>
  45. <value>mapping/InvoiceOwner.hbm.xml</value>
  46. ...
  47. </list>
  48. </property>
  49. <property name="hibernateProperties">
  50. <props>
  51. <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
  52. <prop key="hibernate.show_sql">true</prop>
  53. <prop key="hibernate.format_sql">true</prop>
  54. <prop key="hibernate.connection.pool_size">30</prop>
  55. <prop key="hibernate.hbm2ddl.auto">create</prop>
  56. </props>
  57. </property>
  58. </bean>
  59.  
  60. <jdbc:embedded-database id="dataSource" type="HSQL"></jdbc:embedded-database>
  61. </beans>
  62.  
  63. 6324 DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'transactionManager'
  64. 6324 DEBUG HibernateTransactionManager - Found thread-bound Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for Hibernate transaction
  65. 6324 DEBUG HibernateTransactionManager - Suspending current transaction, creating new transaction with name [fi.om.common.invoicing.service.InvoiceServiceImpl.sendInvoice]
  66. 6324 DEBUG HibernateTransactionManager - Opened new Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])] for Hibernate transaction
  67. 6324 DEBUG HibernateTransactionManager - Preparing JDBC Connection of Hibernate Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=ExecutableList{size=0} updates=ExecutableList{size=0} deletions=ExecutableList{size=0} orphanRemovals=ExecutableList{size=0} collectionCreations=ExecutableList{size=0} collectionRemovals=ExecutableList{size=0} collectionUpdates=ExecutableList{size=0} collectionQueuedOps=ExecutableList{size=0} unresolvedInsertDependencies=null])]
  68. 6324 DEBUG SimpleDriverDataSource - Creating new JDBC Driver Connection to [jdbc:hsqldb:mem:dataSource]
  69. 6324 DEBUG TransactionImpl - begin
  70. 6324 DEBUG HibernateTransactionManager - Exposing Hibernate transaction as JDBC transaction [org.hsqldb.jdbc.JDBCConnection@57ac2910]
  71. 8606 DEBUG SQL -
  72. select
  73. this_.ID as ID1_7_0_,
  74. this_.APPLICATION_ID as APPLICAT2_7_0_,
  75. this_.LAST_REQUEST as LAST_REQ3_7_0_,
  76. this_.APPLICATION_NAME as APPLICAT4_7_0_
  77. from
  78. INVOICE_OWNER this_
  79. where
  80. this_.APPLICATION_ID=?
  81. Hibernate:
  82. select
  83. this_.ID as ID1_7_0_,
  84. this_.APPLICATION_ID as APPLICAT2_7_0_,
  85. this_.LAST_REQUEST as LAST_REQ3_7_0_,
  86. this_.APPLICATION_NAME as APPLICAT4_7_0_
  87. from
  88. INVOICE_OWNER this_
  89. where
  90. this_.APPLICATION_ID=?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement