All Questions

Tagged with
Filter by
Sorted by
Tagged with
40votes
9answers
50kviews

Starting an H2 Database Server from Maven?

Suppose I want to create and use an H2 database for my integration tests. Maven has a command to run tests: mvn test. Is there a way to tell maven to start an H2 database server for the tests and ...
user avatar
  • 17.7k
10votes
2answers
8kviews

Load CSV file located in the classpath for H2 Database

For tests purposes, I want to create and fill some tables using SQL scripts as well as CSV files. So I created a SQL script like this one: CREATE TABLE T_FOO ( ... ) as select * from CSVREAD('...
user avatar
7votes
1answer
14kviews

H2 and MySQL compatibility issues

i am using H2 for my integration tests with Liquibase and it seems that there are compatibility issues. A simple change column function does not pass on H2 where it works perfectly on MySQL ...
user avatar
  • 9,895
6votes
2answers
15kviews

How do I get liquibase to skip table creation if it already exists with liquibase formatted sql?

This is what I have --preconditions onFail:CONTINUE --preconditions not tableExists tableName:QRTZ_CALENDARS schemaName:dbo CREATE TABLE dbo.QRTZ_CALENDARS ( SCHED_NAME VARCHAR (120) NOT NULL , ...
user avatar
  • 3,659
6votes
2answers
4kviews

h2 database test maven

Testing java application using H2 database 1.3.169 I'm testing my app in two different ways. In-memory database is created in a separate process from the application. I start H2 console and create ...
user avatar
  • 515
6votes
1answer
2kviews

Spring is setting mysql dialect when using h2 dialect for test

I'm doing some tests in Spring and I saw a strange thing. When I set datasource in application.properties like this spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false spring....
user avatar
5votes
2answers
3kviews

How can I get H2 to work with Spring?

I am writing a test which extends Spring's AbstractTransactionalJUnit4SpringContextTests. In my application code I have a method which I call inside the test annotated by the following: @...
user avatar
  • 18.4k
5votes
2answers
3kviews

Bazel run vs test

What's the difference between bazel test vs bazel run on the the java test rule? When I run the bazel run command, my test passes just fine, while with bazel test I get an error. If needed, I can ...
user avatar
  • 534
4votes
2answers
17kviews

SpringBoot - Testing with Flyway and H2 database

I'm coding acceptance tests with Cucumber, and I want to use a H2 database for the tests. The application-test.properties looks like: server.port:8090 spring.jpa.database=H2 spring.database....
user avatar
  • 1,437
3votes
2answers
6kviews

H2 database and functions in separate schemas

I'm trying to create a test database (with H2 database). I'm using Oracle in production, and it seems nice to have oracle compatibility mode in h2. However I've got a problem with translating oracle ...
user avatar
  • 2,030
2votes
3answers
1kviews

Play2 and Scala, How should I configure my integration tests to run with proper DB

I'm trying to figure out how to write my db integration tests in my Play2 app. In my conf file I have specified two databases, xxx_test for regular use and h2 db for testing: db.xxx_test.driver=com....
user avatar
  • 5,993
2votes
1answer
829views

Mysql SQL query DATEDIFF failed in H2 where mode was MYSQL

Background: In one of my projects I am doing component testing on Spring Batch using JUnit. Here application DB is MYSQL. In Junit test execution I let the data-source switch between MYSQL and ...
user avatar
  • 4,416
2votes
1answer
3kviews

Spring: "NoSuchBeanDefinitionException: No bean named 'dataSource' is defined" when testing

I have been trying to test the DAO layer of an application, however I keep getting this error. Here is the Test class RegionDAOTest.java import static org.junit.Assert.assertEquals; import static ...
user avatar
  • 21
2votes
1answer
110views

Unable to get table autocreated in spring module integration test

I have a parameters module in my project which other modules are dependent on. I'd like to write instegration tests for this module in separate manner. This module is a spring based one and has some ...
user avatar
  • 4,683
2votes
1answer
390views

Rollback transactions after each Cucumber scenarios with Spring Boot

I'm using the BDD testing framework Cucumber with Spring Boot 2.5. I want to rollback transactions or reset my database after each Cucumber scenarios. I'm using an H2 database, populate by dynamically ...
user avatar
  • 23

15 30 50 per page
1
2 3 4 5