diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 749a096..8c8d89c 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,22 +1,33 @@ + + + + - - - + + - + + - + + - + + - + + + - + + - - + + + + diff --git a/pom.xml b/pom.xml index 9489f37..5c07b00 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,7 @@ - + 4.0.0 de.kreth.vaadin.clubhelper @@ -147,11 +149,24 @@ spring-security-test test + + org.springframework.boot + spring-boot-starter-webflux + test + org.junit.jupiter junit-jupiter-engine test + + + simple-jndi + simple-jndi + 0.11.4.1 + test + + com.h2database h2 @@ -245,13 +260,13 @@ true - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - - + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + + org.apache.tomcat.maven tomcat7-maven-plugin @@ -262,7 +277,7 @@ /vaadin-clubhelper##${project.version} - + org.apache.maven.plugins maven-surefire-plugin diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/VaadinClubhelperApplicationTests.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/VaadinClubhelperApplicationTests.java deleted file mode 100644 index 86ddeec..0000000 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/VaadinClubhelperApplicationTests.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.kreth.vaadin.clubhelper.vaadinclubhelper; - -//@RunWith(SpringRunner.class) -//@SpringBootTest -public class VaadinClubhelperApplicationTests { - -// @Test - public void contextLoads() { - } - -} diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/TestConfiguration.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/TestConfiguration.java new file mode 100644 index 0000000..2abce19 --- /dev/null +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/TestConfiguration.java @@ -0,0 +1,57 @@ +package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.tests; + +import javax.persistence.EntityManager; + +import org.hibernate.SessionFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Adress; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Attendance; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Contact; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.DeletedEntry; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Persongroup; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Relative; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Startpaesse; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.StartpassStartrechte; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Version; + +@Configuration +public class TestConfiguration { + + @Bean + public EntityManager getEntityManager() throws Exception { + + // setup the session factory + org.hibernate.cfg.Configuration configuration = createConfig(); + + SessionFactory sessionFactory = configuration.buildSessionFactory(); + return sessionFactory.openSession(); + + } + + public org.hibernate.cfg.Configuration createConfig() { + org.hibernate.cfg.Configuration configuration = new org.hibernate.cfg.Configuration(); + configuration.addAnnotatedClass(Adress.class); + configuration.addAnnotatedClass(Attendance.class); + configuration.addAnnotatedClass(Contact.class); + configuration.addAnnotatedClass(DeletedEntry.class); + configuration.addAnnotatedClass(GroupDef.class); + configuration.addAnnotatedClass(Person.class); + configuration.addAnnotatedClass(Persongroup.class); + configuration.addAnnotatedClass(Relative.class); + configuration.addAnnotatedClass(Startpaesse.class); + configuration.addAnnotatedClass(StartpassStartrechte.class); + configuration.addAnnotatedClass(Version.class); + configuration.addInputStream(getClass().getResourceAsStream("/schema/ClubEvent.hbm.xml")); + + configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); + configuration.setProperty("hibernate.connection.driver_class", "org.h2.Driver"); + configuration.setProperty("hibernate.connection.url", "jdbc:h2:mem:test"); + configuration.setProperty("hibernate.hbm2ddl.auto", "create"); + return configuration; + } + +} diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java new file mode 100644 index 0000000..7432de4 --- /dev/null +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java @@ -0,0 +1,25 @@ +package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.tests; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.reactive.server.WebTestClient; + +//@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureWebTestClient +//@SpringApplicationConfiguration(classes = VaadinClubhelperApplication.class) +//@WebAppConfiguration +public class VaadinClubhelperApplicationTests { + + @Autowired + private WebTestClient webClient; + + @Test + public void contextLoads() { + + webClient.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class).isEqualTo("Hello World"); + } + +}