Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

Posts: 26
  • 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!
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!