DbUnit SQL

SQL dataset support for "DbUnit" and "spring-test-dbunit"

Лицензия

Лицензия

Группа

Группа

fr.pinguet62
Идентификатор

Идентификатор

dbunit-sql
Последняя версия

Последняя версия

2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

DbUnit SQL
SQL dataset support for "DbUnit" and "spring-test-dbunit"
Ссылка на сайт

Ссылка на сайт

https://github.com/pinguet62/dbunit-sql
Система контроля версий

Система контроля версий

https://github.com/pinguet62/dbunit-sql

Скачать dbunit-sql

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/fr.pinguet62/dbunit-sql/ -->
<dependency>
    <groupId>fr.pinguet62</groupId>
    <artifactId>dbunit-sql</artifactId>
    <version>2.0</version>
</dependency>
// https://jarcasting.com/artifacts/fr.pinguet62/dbunit-sql/
implementation 'fr.pinguet62:dbunit-sql:2.0'
// https://jarcasting.com/artifacts/fr.pinguet62/dbunit-sql/
implementation ("fr.pinguet62:dbunit-sql:2.0")
'fr.pinguet62:dbunit-sql:jar:2.0'
<dependency org="fr.pinguet62" name="dbunit-sql" rev="2.0">
  <artifact name="dbunit-sql" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.pinguet62', module='dbunit-sql', version='2.0')
)
libraryDependencies += "fr.pinguet62" % "dbunit-sql" % "2.0"
[fr.pinguet62/dbunit-sql "2.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
commons-io : commons-io jar 2.8.0
com.github.jsqlparser : jsqlparser jar 3.2

provided (3)

Идентификатор библиотеки Тип Версия
org.dbunit : dbunit jar 2.7.0
com.github.springtestdbunit : spring-test-dbunit jar 1.3.0
org.springframework : spring-beans jar 5.3.1

test (3)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-test jar 2.4.0
org.springframework.boot : spring-boot-starter-jdbc jar 2.4.0
org.hsqldb : hsqldb jar 2.5.1

Модули Проекта

Данный проект не имеет модулей.

DbUnit SQL

Maintained

Libraries.io dependency status for GitHub repo Snyk Vulnerabilities for GitHub Repo

Codacy Badge codecov

GitHub Actions

Maven Central Javadocs

SQL dataset support for DbUnit and spring-test-dbunit extension for Spring test.

Description

Are equivalents:

  • SQL dataset:

     insert into profile (id, key) values ('1st', 'first');
     insert into user (id, email, profile_id) values (1, 'first@domain.org', '1st');
  • XML dataset:

     <dataset>
     	<profile id="1st" key="first">
     	<user id="1" email="first@domain.org" profile_id="1st">
     </dataset>

Dependencies

To use SQL support, add this dependency to your pom.xml:

<dependency>
	<groupId>fr.pinguet62</groupId>
	<artifactId>dbunit-sql</artifactId>
	<version>...</version>
</dependency>

It's necessary to add DbUnit and/or spring-test-dbunit dependencies, because this project use provided scope.

Usage

DbUnit (native)

From Getting Started:

// [...]
import fr.pinguet62.dbunit.sql.ext.SqlDataSet;

public class SqlTest extends DBTestCase {
	// [...]

	@Override
	protected IDataSet getDataSet() throws Exception {
		return new SqlDataSet(getClass().getResourceAsStream("/dataset.sql"));
		// return new SqlDataSet(getClass().getResourceAsStream("insert into profile (id, key) values ('1st', 'first');"));
	}
}

spring-test-dbunit (extension)

// [...]
import fr.pinguet62.dbunit.sql.springtest.SqlDataSetLoader;

// [...]
@TestExecutionListeners({ /*...,*/ TransactionDbUnitTestExecutionListener.class })
@DbUnitConfiguration(dataSetLoader = SqlDataSetLoader.class)
@DatabaseSetup("/dataset.sql")
public class SqlTest {
	// [...]
}

Версии библиотеки

Версия
2.0
1.1
1.0