|
|
|
@ -24,6 +24,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; |
|
|
|
import de.kreth.clubhelperbackend.google.calendar.CalendarAdapter; |
|
|
|
import de.kreth.clubhelperbackend.google.calendar.CalendarAdapter; |
|
|
|
import de.kreth.vaadin.clubhelper.HibernateHolder; |
|
|
|
import de.kreth.vaadin.clubhelper.HibernateHolder; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.AbstractDatabaseTest; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.AbstractDatabaseTest; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.ClubEventDao; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.ClubEventDaoImpl; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.ClubEventDaoImpl; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
|
|
|
@ -38,17 +39,17 @@ class EventBusinessTest { |
|
|
|
private DatabaseHelper helper; |
|
|
|
private DatabaseHelper helper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
protected EntityManager entityManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private EventBusiness business; |
|
|
|
private EventBusiness business; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private EntityManager entityManager; |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
public static class MyConfig { |
|
|
|
public static class InnerConfig { |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
public EntityManager getEntityManager() throws Exception { |
|
|
|
public EntityManager getEntityManager() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
// setup the session factory
|
|
|
|
|
|
|
|
org.hibernate.cfg.Configuration configuration = HibernateHolder.configuration(); |
|
|
|
org.hibernate.cfg.Configuration configuration = HibernateHolder.configuration(); |
|
|
|
|
|
|
|
|
|
|
|
SessionFactory sessionFactory = configuration.buildSessionFactory(); |
|
|
|
SessionFactory sessionFactory = configuration.buildSessionFactory(); |
|
|
|
@ -56,11 +57,21 @@ class EventBusinessTest { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
public ClubEventDao getClubEventDao() { |
|
|
|
|
|
|
|
return new ClubEventDaoImpl(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
public CalendarAdapter getCalendarAdapter() throws GeneralSecurityException, IOException { |
|
|
|
public CalendarAdapter getCalendarAdapter() throws GeneralSecurityException, IOException { |
|
|
|
return new CalendarAdapter(); |
|
|
|
return new CalendarAdapter(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
public EventBusiness getEventBusiness() { |
|
|
|
|
|
|
|
return new EventBusiness(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
@BeforeEach |
|
|
|
@ -68,11 +79,6 @@ class EventBusinessTest { |
|
|
|
helper = new DatabaseHelper(entityManager); |
|
|
|
helper = new DatabaseHelper(entityManager); |
|
|
|
helper.cleanH2Database(); |
|
|
|
helper.cleanH2Database(); |
|
|
|
|
|
|
|
|
|
|
|
ClubEventDaoImpl dao = new ClubEventDaoImpl(); |
|
|
|
|
|
|
|
dao.setEntityManager(entityManager); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
business = new EventBusiness(); |
|
|
|
|
|
|
|
business.dao = dao; |
|
|
|
|
|
|
|
insertTestData(); |
|
|
|
insertTestData(); |
|
|
|
business.setSelected(event); |
|
|
|
business.setSelected(event); |
|
|
|
} |
|
|
|
} |
|
|
|
|