2017-03-14 3 views
0

테스트 실행 중에 내 프로필 'dev'를 사용하고 싶습니다. 그러나 테스트를 실행할 때 H2 db를 찾을 수 없습니다. 추상 테스트 클래스 :테스트 실행 중에 H2 db를 찾을 수 없습니다.

@RunWith(SpringRunner.class) 
@SpringBootTest(classes = MyServiceStarter.class) 
@ActiveProfiles("dev") 
public abstract class AbstractModulIntegrationTest { ... } 

속성 : 파일 시스템 : I 출력에서 ​​테스트를 실행하면

flyway.locations=filesystem:./database/h2 
flyway.enabled=true 
# hsqldb 
spring.datasource.platform=h2 
spring.jpa.hibernate.ddl-auto=validate 
spring.h2.console.enabled=true 
spring.datasource.url=jdbc:h2:./db/gcrs;AUTO_SERVER=TRUE 
spring.datasource.driver-class-name=org.h2.Driver 
spring.datasource.password= 
spring.datasource.username=sa 

spring.jpa.database=h2 
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 

이 위치를 확인할 수 없습니다 을 인쇄합니다 ./ 데이터베이스/H2

2017-03-14 18:05:24.500 INFO 7460 --- [   main] o.f.core.internal.util.VersionPrinter : Flyway 4.0.3 by Boxfuse 
2017-03-14 18:05:24.500 INFO 7460 --- [   main] com.zaxxer.hikari.HikariDataSource  : HikariPool-1 - Started. 
2017-03-14 18:05:25.002 INFO 7460 --- [   main] o.f.c.i.dbsupport.DbSupportFactory  : Database: jdbc:h2:./db/gcrs (H2 1.4) 
2017-03-14 18:05:25.018 WARN 7460 --- [   main] o.f.c.i.u.s.f.FileSystemScanner   : Unable to resolve location filesystem:./database/h2 
2017-03-14 18:05:25.049 WARN 7460 --- [   main] o.f.c.i.u.s.f.FileSystemScanner   : Unable to resolve location filesystem:./database/h2 
2017-03-14 18:05:25.049 WARN 7460 --- [   main] o.f.c.i.u.s.f.FileSystemScanner   : Unable to resolve location filesystem:./database/h2 
2017-03-14 18:05:25.049 INFO 7460 --- [   main] o.f.core.internal.command.DbValidate  : Successfully validated 0 migrations (execution time 00:00.006s) 
2017-03-14 18:05:25.064 INFO 7460 --- [   main] o.f.core.internal.command.DbMigrate  : Current version of schema "PUBLIC": << Empty Schema >> 
2017-03-14 18:05:25.064 INFO 7460 --- [   main] o.f.core.internal.command.DbMigrate  : Schema "PUBLIC" is up to date. No migration necessary. 
2017-03-14 18:05:25.205 INFO 7460 --- [   main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 
2017-03-14 18:05:25.220 INFO 7460 --- [   main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ 
    name: default 
    ...] 

스프링 부트 대 on : 1.5.1.RELEASE

답변

0

동료가 해결책을 찾았습니다. 문제는 잘못된 경로에있었습니다. 이 문제가 해결되었습니다.

@SpringBootTest(classes = MyServiceStarter.class, properties = {"flyway.locations=filesystem:../database/h2"}) 
관련 문제