GithubHelp home page GithubHelp logo

zapodot / embedded-db-junit Goto Github PK

View Code? Open in Web Editor NEW
59.0 5.0 7.0 919 KB

JUnit Rule for providing an embedded in-memory database for your tests

Home Page: https://embedded-db-junit.zapodot.org

License: Other

Java 100.00%
jdbc java junit sql liquibase testing junit-rule hsqldb flyway h2-database

embedded-db-junit's Introduction

embedded-db-junit

Build Status Coverage status Maven Central Apache V2 License Open Source Helpers Follow me @ Twitter

JUnit Rule that provides a in-memory database (both H2 and HyperSQL are supported). It is compatible with all known JDBC access libraries such as Spring JDBC, RX-JDBC, sql2o, JDBI or plain old JDBC.

Why?

  • because you want to test the SQL code executed by your code without integrating with an actual DB server
  • removes the need of having a database server running and available
  • you are refactoring legacy code where JDBC calls is tightly coupled with your business logic and wants to start by testing the legacy code from the "outside" (as suggested by Michael Feathers)
  • you want to test your database evolutions with either they are maintened using Liquibase or Flyway.

Status

This library is distributed through the Sonatype OSS repo and should thus be widely available.

Version Java version JUnit version H2 version HSQLDB version Branch Status
2.1.X 8.0 4.13/5.X 2.1.X 2.7.0 master active
2.0.X 8.0 4.12/5.X 1.4.200 2.5.0 master maintenance
1.1.X 8.0 4.12 1.4.200 2.4.0 release-1.1.x obsolete
1.0 1.7 4.12 1.4.196 N/A release-1.x obsolete

The versions that is described in this table are minimum versions. Later versions may be used but is currently not tested by the maintainer.

Usage

Add dependency

Maven

For JUnit 5 Jupiter

<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>embedded-db-junit-jupiter</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
</dependency>

For JUnit 4.X

<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>embedded-db-junit</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
</dependency>
Liquibase plugin

If you want to use the Liquibase plugin:

<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>embedded-db-junit-liquibase</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
</dependency>
Flyway plugin

If you want to use the Flyway plugin:

<dependency>
    <groupId>org.zapodot</groupId>
    <artifactId>embedded-db-flyway</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
</dependency>

SBT

libraryDependencies += "org.zapodot" % "embedded-db-junit" % "2.1.0" % "test"

Add to Junit test

Junit 5.X Jupiter

Declarative style using annotations
@EmbeddedDatabaseTest(
        engine = Engine.HSQLDB,
        initialSqls = "CREATE TABLE Customer(id INTEGER PRIMARY KEY, name VARCHAR(512)); "
                    + "INSERT INTO CUSTOMER(id, name) VALUES (1, 'John Doe')"
)
class EmbeddedDatabaseExtensionExtendWithTest {

    @Test
    void testUsingSpringJdbc(final @EmbeddedDatabase DataSource dataSource) {
        final JdbcOperations jdbcOperation = new JdbcTemplate(dataSource);
        final int id = 2;
        final String customerName = "Jane Doe";
    
        final int updatedRows = jdbcOperation.update("INSERT INTO CUSTOMER(id, name) VALUES(?,?)", id, customerName);
    
        assertEquals(1, updatedRows);
        assertEquals(customerName, jdbcOperation.queryForObject("SELECT name from CUSTOMER where id = ?", String.class, id));

    }
    
    void testUsingConnection(final @EmbeddedDatabase Connection connection) {
         try(final Statement statement = connection.createStatement();
             final ResultSet resultSet = statement.executeQuery("SELECT * from CUSTOMER")) {
                assertTrue(resultSet.next());
         }
    } 

}
Fluent style using builder and @RegisterExtension
class EmbeddedDatabaseExtensionRegisterExtensionHSQLDBTest {

    @RegisterExtension
    static EmbeddedDatabaseExtension embeddedDatabaseExtension = EmbeddedDatabaseExtension.Builder.hsqldb()
                                            .withInitialSql("CREATE TABLE Customer(id INTEGER PRIMARY KEY, name VARCHAR(512)); "
                                                          + "INSERT INTO CUSTOMER(id, name) VALUES (1, 'John Doe')")
                                            .build();


    @Test
    void doDatabaseCall() throws SQLException {
        assertEquals("HSQL Database Engine", embeddedDatabaseExtension.getConnection().getMetaData().getDatabaseProductName());
    }

}

Junit 4.X

@Rule
public final EmbeddedDatabaseRule dbRule = EmbeddedDatabaseRule
                                        .builder()
                                        .withMode(CompatibilityMode.Oracle)
                                        .withInitialSql("CREATE TABLE Customer(id INTEGER PRIMARY KEY, name VARCHAR(512)); "
                                                        + "INSERT INTO CUSTOMER(id, name) VALUES (1, 'John Doe')")
                                        .build();

@Test
public void testUsingRxJdbc() throws Exception {
    assertNotNull(dbRule.getConnection());
    final Database database = Database.from(dbRule.getConnection());
    assertNotNull(database.select("SELECT sysdate from DUAL")
                  .getAs(Date.class)
                  .toBlocking()
                  .single());

    assertEquals("John Doe", database.select("select name from customer where id=1")
                                     .getAs(String.class)
                                     .toBlocking()
                                     .single());
}

@Test
public void testUsingSpringJdbc() throws Exception {

    final JdbcOperations jdbcOperation = new JdbcTemplate(dbRule.getDataSource());
    final int id = 2;
    final String customerName = "Jane Doe";

    final int updatedRows = jdbcOperation.update("INSERT INTO CUSTOMER(id, name) VALUES(?,?)", id, customerName);

    assertEquals(1, updatedRows);
    assertEquals(customerName, jdbcOperation.queryForObject("SELECT name from CUSTOMER where id = ?", String.class, id));

}

@Test
public void testUsingConnectionUrl() throws Exception {

    try(final Connection connection = DriverManager.getConnection(embeddedDatabaseRule.getConnectionJdbcUrl())) {
        try(final Statement statement = connection.createStatement();
            final ResultSet resultSet = statement.executeQuery("SELECT * from CUSTOMER")
        ) {
            assertTrue(resultSet.next());
        }
    }

}

Read initial SQL from a file resource (v >= 0.5)

@Rule
public final EmbeddedDatabaseRule embeddedDatabaseRule = 
                                EmbeddedDatabaseRule.builder()
                                                       .withInitialSqlFromResource(
                                                               "classpath:initial.sql")
                                                       .build();

@Test
public void testWithInitialSQL() throws Exception {
    try (final Connection connection = embeddedDatabaseRule.getConnection()) {

        try (final Statement statement = connection.createStatement();
             final ResultSet resultSet = statement.executeQuery("SELECT * from PEOPLE")) {

             assertTrue(resultSet.next());
        }

    }

}

In the example above a "classpath:" URI has been used to specify the location of the SQL file. All URIs that are supported by H2's Pluggable File System is supported.

Use Liquibase changelog to populate the test database (v >= 0.6)

@Rule
public final EmbeddedDatabaseRule embeddedDatabaseRule = EmbeddedDatabaseRule
        .builder()
        .withMode(CompatibilityMode.MSSQLServer)
        .initializedByPlugin(LiquibaseInitializer.builder()
                .withChangelogResource("example-changelog.sql")
                .build())
        .build();

@Test
public void testFindRolesInsertedByLiquibase() throws Exception {
    try(final Connection connection = embeddedDatabaseRule.getConnection()) {
        try(final PreparedStatement statement = connection.prepareStatement("Select * FROM ROLE r INNER JOIN USERROLE ur on r.ID = ur.ROLE_ID INNER JOIN USER u on ur.USER_ID = u.ID where u.NAME = ?")) {
            statement.setString(1, "Ada");
            try(final ResultSet resultSet = statement.executeQuery()) {
                final List<String> roles = new LinkedList<>();
                while(resultSet.next()) {
                    roles.add(resultSet.getString("name"));
                }
                assertEquals(2, roles.size());
            }
        }
    }

}

Use Flyway to populate the test database (v >= 1.0)

@Rule
public final EmbeddedDatabaseRule embeddedDatabaseRule = 
                EmbeddedDatabaseRule.builder()
                                 .initializedByPlugin(
                                   new FlywayInitializer.Builder()
                                           .withLocations(
                                                   "classpath:migrations/")
                                           .build()).build();

@Test
public void checkMigrationsHasRun() throws Exception {
    try (final Connection connection = embeddedDatabaseRule.getConnection();
         final Statement statement = connection.createStatement();
         final ResultSet resultSet = statement.executeQuery("SELECT * FROM USER")) {
        assertTrue(resultSet.next());
    }
}

Multiple data sources in the same test class

If you need more than one database instance in your test class, you should name them using the "withName" construct. If not set the rule builder will generate the name using the name of the test class

@Rule
public final EmbeddedDatabaseRule embeddedDatabaseMysqlRule =
        EmbeddedDatabaseRule.builder().withName("db1").withMode(CompatibilityMode.MySQL).build();

@Rule
public final EmbeddedDatabaseRule embeddedDatabaseMsSqlServerRule =
        EmbeddedDatabaseRule.builder().withName("db2").withMode(CompatibilityMode.MSSQLServer).build();

Changelog

Please consult the wiki.

Analytics

embedded-db-junit's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar slayful avatar snyk-bot avatar zapodot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

embedded-db-junit's Issues

No SQL error reporting

When the SQL used to seed the database has problems, the errors are swallowed and it is impossible to debug what is wrong.

Support multiple .withInitialSql() / .withInitialSqlFromResource()

We have our sql split in several files - "create_tables.sql", "create_views.sql", "create_indexes.sql".
We cannot load all of them, since each call to .withInitialSqlFromResource() replaces the previous one.

So don't overwrite the previous value of PROP_INIT_SQL
and, optionally, change the signature of .withInitialSqlFromResource to

public Builder withInitialSqlFromResource(final String... resource)

The workaround is of course to set PROP_INIT_SQL manually, but that is less readable

Use mockito 2.x and byte-buddy 1.x

Hi,

I'm not sure it is in your plan to use the latest Mockito (and thus byte-buddy, which is the reason I originally wanted to open this issue), but basically, embedded-db-junit can't be used with Mockito 2.x because of API changes in byte-buddy since 1.x..

[DepShield] (CVSS 7.5) Vulnerability due to usage of org.yaml:snakeyaml:1.25

Vulnerabilities

DepShield reports that this application's usage of org.yaml:snakeyaml:1.25 results in the following vulnerability(s):

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Upgrade Liquibase to 4.4.0

I'd like to upgrade the version of the Liquibase dependency to 4.4.0. I'd like to do this because it seems it's necessary to upgrade Liquibase if I want to use the newest version of the MySQL connector mysql:mysql-connector-java:8.0.25.

I've prepared a PR with an upgrade: #227

DB not reset after the test

When using an EmbeddedDatabaseRule as a @Rule, I would expect to have a fresh empty database for each test of my test class, but apparently, it is the same database used in all of the tests.

I guess the problem is that h2 does keep the database in memory even if you close the connection.

Update byte-buddy

The version of byte-buddy library that is currently used is not compatible with byte-buddy 0.6 + which is used by Mockito 2 and other libs.

embedded-db-junit should be able to use the same version as Mockito to avoid problems in project depending on both.

Move the CompatibilityMode enum to upper level

The CompatibilityMode enum has until now been a public inner enum in the EmbeddedDatabaseRule class. As it is used as part of the external interface it should be moved to the upper level as part of package org.zapodot.junit.db.

Make possible to use with Weld rule

I'm trying to use Weld to get the DataSource resource injected in my bean, utilizing EmbeddedDatabaseRule. It should look something like this (might be typos as I'm trying to strip out unrelated things):

    private final EmbeddedDatabaseRule smsProDbRule = EmbeddedDatabaseRule.builder()
            .withInitialSqlFromResource("classpath:create_tables.sql").build();
    private final WeldInitiator weld = WeldInitiator
       .from(WeldInitiator.createWeld().addBeanClass(MyDbBean.class))
            .bindResource("java:/jdbc/AppDataSource", dbRule.getDataSource())
            .inject(this)
            .build();
    @Rule
    public TestRule chain = RuleChain.outerRule(weld).around(dbRule);
    
    @Inject
    MyDbBean bean;    

The problem here though is that dbRule.getDataSource() will create a DataSource that has a null connection. Is it possible to somehow make this use case work?

Should the Connection given to InitializationPlugin be Closeable?

I understood that InitializationPlugin.getConnection() returned Connection that couldn't be closed for the duration of the test.

But I noticed that when implementing InitializationPlugin.connectionMade, the Connection that was passed to it could be closed.

Is that on purpose? Could it be the reason behind #7?

Add support for JUnit 5

As the extension API has changed a lot between JUnit 4 and JUnit 5 we need to reimplent the functionality using the JUnit 5 extension API

[DepShield] (CVSS 5.5) Vulnerability due to usage of junit:junit:4.13.1

Vulnerabilities

DepShield reports that this application's usage of junit:junit:4.13.1 results in the following vulnerability(s):


Occurrences

junit:junit:4.13.1 is a transitive dependency introduced by the following direct dependency(s):

junit:junit:4.13.1

org.zapodot:embedded-db-junit:2.0.1-SNAPSHOT
        └─ junit:junit:4.13.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Support for alternative DB drivers

Hello. First of all, thank you for your awesome plugin, it's of great help when it comes to DAO layer integration testing (as you described in the use cases).

However a shortcoming of the H2 database system is its limited support for RDBMS specific syntaxes like MySQL's INSERT ... ON DUPLICATE KEY UPDATE, so it is not possible to use these useful features in applications if H2 is used to test it. Alternative in-memory databases such as HSQLDB are better off in that regard.

As such, it might be desirable to provide a way for developers to use a different DB driver to power the test rule. Do you think this would be feasible, or would this be out of scope for this project?

[DepShield] (CVSS 5.5) Vulnerability due to usage of junit:junit:4.13

Vulnerabilities

DepShield reports that this application's usage of junit:junit:4.13 results in the following vulnerability(s):


Occurrences

junit:junit:4.13 is a transitive dependency introduced by the following direct dependency(s):

junit:junit:4.13

org.zapodot:embedded-db-junit:2.0.1-SNAPSHOT
        └─ junit:junit:4.13

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 8.8) Vulnerability due to usage of com.h2database:h2:1.4.197

Vulnerabilities

DepShield reports that this application's usage of com.h2database:h2:1.4.197 results in the following vulnerability(s):


Occurrences

com.h2database:h2:1.4.197 is a transitive dependency introduced by the following direct dependency(s):

com.h2database:h2:1.4.197

org.zapodot:embedded-db-junit:1.1.2-SNAPSHOT
        └─ com.h2database:h2:1.4.197

org.zapodot:embedded-db-junit:1.1.2-SNAPSHOT
        └─ com.h2database:h2:1.4.197

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

DepShield encountered errors while building your project

The project could not be analyzed because of build errors. Please review the error messages here. Another build will be scheduled when a change to a manifest file* occurs. If the build is successful this issue will be closed, otherwise the error message will be updated.

This is an automated GitHub Issue created by Sonatype DepShield. GitHub Apps, including DepShield, can be managed from the Developer settings of the repository administrators.

* Supported manifest files are: pom.xml, package.json, package-lock.json, npm-shrinkwrap.json, Cargo.lock, Cargo.toml, main.rs, lib.rs, build.gradle, build.gradle.kts, settings.gradle, settings.gradle.kts, gradle.properties, gradle-wrapper.properties, go.mod, go.sum

@EmbeddedDatabase does not work during maven build

TestIssue.java

package test;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.zapodot.junit.db.EmbeddedDatabaseExtension;
import org.zapodot.junit.db.annotations.EmbeddedDatabase;
import org.zapodot.junit.db.annotations.EmbeddedDatabaseTest;
import org.zapodot.junit.db.common.CompatibilityMode;
import org.zapodot.junit.db.common.Engine;

@EmbeddedDatabaseTest(
    engine = Engine.H2,
    compatibilityMode = CompatibilityMode.MySQL,
    initialSqls = "CREATE TABLE Customer(id INTEGER PRIMARY KEY, name VARCHAR(512)); "
        + "INSERT INTO CUSTOMER(id, name) VALUES (1, 'John Doe')"
)
@ExtendWith(EmbeddedDatabaseExtension.class)
public class TestIssue {

    @EmbeddedDatabase
    public Connection connection;

    @Test
    public void testUsingConnection() throws SQLException {
        try (final Statement statement = connection.createStatement();
            final ResultSet resultSet = statement.executeQuery("SELECT * from CUSTOMER")) {
            assertTrue(resultSet.next());
        }
    }
}

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.6.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.zapodot</groupId>
      <artifactId>embedded-db-junit-jupiter</artifactId>
      <version>2.0.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.symphonia</groupId>
      <artifactId>lambda-logging</artifactId>
      <version>1.0.3</version>
    </dependency>
  </dependencies>
</project>

... clean verify
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------------< test:test >------------------------------
[INFO] Building test 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO] Deleting C:\WS\Test\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\WS\Test\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\WS\Test\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\WS\Test\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] Surefire report directory: C:\WS\Test\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running test.TestIssue
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec <<< FAILURE!
test.TestIssue.testUsingConnection()  Time elapsed: 0.006 sec  <<< FAILURE!
java.lang.NullPointerException
	at test.TestIssue.testUsingConnection(TestIssue.java:31)


Results :

Failed tests:   test.TestIssue.testUsingConnection()

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.217 s
[INFO] Finished at: 2020-04-19T18:28:29+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project test: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\WS\Test\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I can execute it successfull with IntelliJ Ide but if I run it with maven (clean verify) the connection is null.
I tried also without @ExtendWith but same result
When I give #testUsingConnection the Connection as Parameter maven does not execute the test.

Incoherence of behaviour between getConnection and getConnectionJdbcUrl with liquibase plugin?

Sorry, this is maybe just a question and not a bug, but I simply can't make embedded-db-junit with dropwizard database subsystem.

Basically, in my test I have the following:

public class UserSessionTest {

    public static final User ADMIN = new User("admin", "Administrator", null);

    public static class App extends CockpitApplication<CockpitConfiguration> {
        // only needed because of generics
    }

    @ClassRule
    public static final EmbeddedDatabaseRule dbRule = EmbeddedDatabaseRule.builder()
            .initializedByPlugin(LiquibaseInitializer.builder().withChangelogResource("migrations.xml").build())
            .initializedByPlugin(new InitializationPlugin() {
                @Override
                public void connectionMade(@Nullable String name, @Nullable Connection connection) {
                    try (DSLContext using = DSL.using(connection, SQLDialect.H2)) {
                        using.insertInto(Tables.USERS).set(new UsersRecord(ADMIN.username,
                                new BCryptPasswordEncoder().encode(ADMIN.username), ADMIN.name, ADMIN.lastWorkspace))
                                .execute();
                    }
                }
            }).build();

    @Rule
    public final DropwizardAppRule<CockpitConfiguration> appRule = new DropwizardAppRule<>(App.class,
            ResourceHelpers.resourceFilePath("user-session-tests.yml"),
            ConfigOverride.config("database.url", () -> dbRule.getConnectionJdbcUrl()));

    ....
}

And while the initialisation of the database with the two plugins works nicely, the SQL query made from dropwizard (I am using dropwizard-jooq with dropwizard-db, which setups a JDBC pool) returns no row.

For example, I even tried putting the following in my dropwizard Application.run() method (the configuration, I verified, is correctly referring to the embedded database JDBC URL):

        System.out.println(DSL.using(jooqConf).selectFrom(Tables.USERS).fetch());

And it says there is zero rows, while if I put the same thing in the test method itself, then it shows me the rows inserted by the plugin…

Either I am doing something wrong, or there is maybe a problem with the connections or maybe a transaction not committed or I don't know what… The only specific thing I can think of is that everything executed directly from the test class itself is done with the connections built by embedded-db-junit and not built directly from the JDBC URL string…

Hope it's ok to ask that here :)

[DepShield] (CVSS 9.1) Vulnerability due to usage of com.h2database:h2:1.4.200

Depshield will be deprecated soon

Please install our new product, Sonatype Lift with advanced features


Vulnerabilities

DepShield reports that this application's usage of com.h2database:h2:1.4.200 results in the following vulnerability(s):


Occurrences

com.h2database:h2:1.4.200 is a transitive dependency introduced by the following direct dependency(s):

com.h2database:h2:1.4.200

com.h2database:h2:1.4.200

org.zapodot:embedded-db-core:2.0.3-SNAPSHOT
        └─ com.h2database:h2:1.4.200

org.zapodot:embedded-db-junit:2.0.3-SNAPSHOT
        └─ com.h2database:h2:1.4.200

org.zapodot:embedded-db-core:2.0.3-SNAPSHOT
        └─ com.h2database:h2:1.4.200

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.