Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

How to Populate a H2 database using SQL scripts in a specific folder  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing cucumber tests in my Spring Boot project, I need to create a H2 (in-memory database) first. Then, the cucumber step definitions will use data from the database to validate if my application is working.

The problem that I am having is that the H2 database is not being created in the first place.

Here is the database section of my application.yml:



My cucumber tests are stored in src/integTest/acceptTests.

I have a couple of SQL files to create & populate the H2 database: schema.sql & data.sql. These are stored in src/integTest/resources

I think, by default Spring looks for these files in src/main/resources, but I need to somehow point them to the integTest/resources via my application.yml

Does anyone have any suggestions on what changes I need to make in order to do this?

I can post further code if it is required.

Thanks in advance for any feedback!
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!