diff --git a/gradle.properties b/gradle.properties index 07ff209..4303068 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ modelVersion=4.0.0 groupId=org.springframework.samples.service.service artifactId=microservice-demo -version=1.1.0.RELEASE +version=1.2.0.RELEASE packaging=jar -springBootVersion=1.4.0.RELEASE -springDataCommonsVersion=1.12.2.RELEASE -hsqldbVersion=2.3.4 -springCloudStarterVersion=1.1.2.RELEASE -springCloudStarterEurekaServerVersion=1.1.6.RELEASE +springBootVersion=1.5.2.RELEASE +springDataCommonsVersion=1.13.1.RELEASE +hsqldbVersion=2.3.3 +springCloudStarterVersion=1.2.0.RELEASE +springCloudStarterEurekaServerVersion=1.3.0.RELEASE diff --git a/pom.xml b/pom.xml index 80c5c4c..05dd369 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,20 @@ + 4.0.0 org.springframework.samples.service.service microservice-demo - 1.1.0.RELEASE + 1.2.0.RELEASE jar org.springframework.cloud spring-cloud-starter-parent - Brixton.RELEASE + Dalston.RELEASE + 1.8 io.pivotal.microservices.services.Main diff --git a/src/main/java/io/pivotal/microservices/accounts/AccountsConfiguration.java b/src/main/java/io/pivotal/microservices/accounts/AccountsConfiguration.java index a97a81d..4138e52 100644 --- a/src/main/java/io/pivotal/microservices/accounts/AccountsConfiguration.java +++ b/src/main/java/io/pivotal/microservices/accounts/AccountsConfiguration.java @@ -8,8 +8,7 @@ import javax.sql.DataSource; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.orm.jpa.EntityScan; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -44,7 +43,7 @@ public AccountsConfiguration() { public DataSource dataSource() { logger.info("dataSource() invoked"); - // Create an in-memory H2 relational database containing some demo + // Create an in-memory HSQLDB relational database containing some demo // accounts. DataSource dataSource = (new EmbeddedDatabaseBuilder()).addScript("classpath:testdb/schema.sql") .addScript("classpath:testdb/data.sql").build(); diff --git a/src/main/resources/db-config.properties b/src/main/resources/db-config.properties index a6791b1..0768478 100644 --- a/src/main/resources/db-config.properties +++ b/src/main/resources/db-config.properties @@ -7,5 +7,5 @@ # schema.sql. Instead check the tables match their JPA mapped classes spring.jpa.hibernate.ddl-auto: validate spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy -spring.jpa.database: H2 +spring.jpa.database: HSQL spring.jpa.show-sql: true diff --git a/src/main/resources/testdb/schema.sql b/src/main/resources/testdb/schema.sql index 0d84e5e..e15d51b 100644 --- a/src/main/resources/testdb/schema.sql +++ b/src/main/resources/testdb/schema.sql @@ -1,6 +1,6 @@ drop table T_ACCOUNT if exists; create table T_ACCOUNT (ID bigint identity primary key, NUMBER varchar(9), - NAME varchar(50) not null, BALANCE decimal(8,2), unique(NUMBER)); + NAME varchar(50) not null, BALANCE numeric(19,2), unique(NUMBER)); ALTER TABLE T_ACCOUNT ALTER COLUMN BALANCE SET DEFAULT 0.0; diff --git a/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java b/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java index e461ef2..a52ea58 100644 --- a/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java +++ b/src/test/java/io/pivotal/microservices/accounts/AccountsControllerIntegrationTests.java @@ -3,9 +3,10 @@ import org.junit.runner.RunWith; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.web.WebAppConfiguration; import io.pivotal.microservices.services.accounts.AccountsServer; @@ -17,6 +18,7 @@ * @author Paul Chapman * */ + @SpringBootApplication @Import(AccountsConfiguration.class) class AccountsMain { @@ -35,8 +37,9 @@ public static void main(String[] args) { * * @author Paul Chapman */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = AccountsMain.class) +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AccountsMain.class) +@WebAppConfiguration public class AccountsControllerIntegrationTests extends AbstractAccountControllerTests { }