From cc276589ec33e686cb00a3449d26d693d136f6c0 Mon Sep 17 00:00:00 2001 From: Doha2012 Date: Sun, 9 Apr 2017 20:38:30 +0200 Subject: [PATCH] fix integration test (#1615) * upgrade to spring boot 1.5.2 * add full update to REST API * modify ratings controller * upgrade herold * fix integration test * fix integration test * minor fix * fix integration test * fix integration test * minor cleanup --- spring-boot/src/main/resources/schema.sql | 2 ++ .../org/baeldung/SpringBootApplicationIntegrationTest.java | 2 +- spring-boot/src/test/resources/import.sql | 2 +- .../test/resources/persistence-generic-entity.properties | 6 +++--- .../web/controller/GreetControllerIntegrationTest.java | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spring-boot/src/main/resources/schema.sql b/spring-boot/src/main/resources/schema.sql index 27859c1652..4cd345c762 100644 --- a/spring-boot/src/main/resources/schema.sql +++ b/spring-boot/src/main/resources/schema.sql @@ -1,3 +1,5 @@ +drop table if exists USERS; + create table USERS( ID int not null AUTO_INCREMENT, NAME varchar(100) not null, diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java index 87c59a4662..4ce0678bdd 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java @@ -63,4 +63,4 @@ public class SpringBootApplicationIntegrationTest { mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)) .andExpect(jsonPath("$.id", equalTo(1))); } -} +} \ No newline at end of file diff --git a/spring-boot/src/test/resources/import.sql b/spring-boot/src/test/resources/import.sql index a382410271..9095b9468c 100644 --- a/spring-boot/src/test/resources/import.sql +++ b/spring-boot/src/test/resources/import.sql @@ -1 +1 @@ -Insert into Foo values(1,'Foo_Name'); \ No newline at end of file +--insert into Foo values(1,'Foo_Name'); \ No newline at end of file diff --git a/spring-boot/src/test/resources/persistence-generic-entity.properties b/spring-boot/src/test/resources/persistence-generic-entity.properties index c60e7488b6..b19304cb1f 100644 --- a/spring-boot/src/test/resources/persistence-generic-entity.properties +++ b/spring-boot/src/test/resources/persistence-generic-entity.properties @@ -1,8 +1,8 @@ jdbc.driverClassName=org.h2.Driver jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 -jdbc.username=sa -jdbc.password=sa +jdbc.user=sa +jdbc.pass=sa hibernate.dialect=org.hibernate.dialect.H2Dialect hibernate.show_sql=true -hibernate.hbm2ddl.auto=create-drop \ No newline at end of file +hibernate.hbm2ddl.auto=create-drop diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java index ca8c37175e..b628228b7e 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java @@ -21,10 +21,11 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import com.baeldung.spring.web.config.ApplicationConfig; +import com.baeldung.spring.web.config.WebConfig; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration -@ContextConfiguration(classes = { ApplicationConfig.class }) +@ContextConfiguration(classes = { ApplicationConfig.class, WebConfig.class }) public class GreetControllerIntegrationTest { @Autowired