Commit 7807b5f6 authored by Samuel Dudík's avatar Samuel Dudík
Browse files

Fix UserTests and ProductReviewTests

parent 8191dc45
......@@ -6,6 +6,18 @@
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>cz.muni.fi.pa165.winery.persistence.entities.EntityBase</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.Grape</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.Harvest</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.Order</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.OrderItem</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.ProductReview</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.User</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.UserRole</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.WineBottle</class>
<class>cz.muni.fi.pa165.winery.persistence.entities.WineType</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:derby:memory:testdb" />
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver" />
......
......@@ -36,7 +36,9 @@ public class UserTests {
@After
public void teardown() {
if (em1 != null) {
em1.getTransaction().begin();
em1.createQuery("DELETE FROM User").executeUpdate();
em1.getTransaction().commit();
em1.close();
}
if (em2 != null) {
......@@ -56,6 +58,7 @@ public class UserTests {
user.setEmail("test@test.com");
user.setPasswordHash("123");
em1.persist(user);
em1.getTransaction().commit();
em2.getTransaction().begin();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment