testing-mysql-server-root

Embedded MySQL server for use in tests

License

License

Categories

Categories

MySQL Data Databases
GroupId

GroupId

com.facebook.presto
ArtifactId

ArtifactId

testing-mysql-server-root
Last Version

Last Version

0.6
Release Date

Release Date

Type

Type

pom
Description

Description

testing-mysql-server-root
Embedded MySQL server for use in tests
Project URL

Project URL

https://github.com/prestodb/testing-mysql-server
Source Code Management

Source Code Management

https://github.com/prestodb/testing-mysql-server

Download testing-mysql-server-root

How to add to project

<!-- https://jarcasting.com/artifacts/com.facebook.presto/testing-mysql-server-root/ -->
<dependency>
    <groupId>com.facebook.presto</groupId>
    <artifactId>testing-mysql-server-root</artifactId>
    <version>0.6</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.facebook.presto/testing-mysql-server-root/
implementation 'com.facebook.presto:testing-mysql-server-root:0.6'
// https://jarcasting.com/artifacts/com.facebook.presto/testing-mysql-server-root/
implementation ("com.facebook.presto:testing-mysql-server-root:0.6")
'com.facebook.presto:testing-mysql-server-root:pom:0.6'
<dependency org="com.facebook.presto" name="testing-mysql-server-root" rev="0.6">
  <artifact name="testing-mysql-server-root" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.facebook.presto', module='testing-mysql-server-root', version='0.6')
)
libraryDependencies += "com.facebook.presto" % "testing-mysql-server-root" % "0.6"
[com.facebook.presto/testing-mysql-server-root "0.6"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • testing-mysql-server-base
  • testing-mysql-server-5
  • testing-mysql-server-8

Testing MySQL Server

Maven Central Build Status

Embedded MySQL server for use in tests. It allows testing your Java or other JVM based application against a real MySQL server with no external dependencies to deploy or manage.

Usage

Add the library as a test dependency:

<dependency>
    <groupId>com.facebook.presto</groupId>
    <artifactId>testing-mysql-server</artifactId>
    <version>0.1</version>
    <scope>test</scope>
</dependency>

Use it in your tests:

@Test
public void testDatabase()
        throws Exception
{
    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "testdb");
            Connection connection = DriverManager.getConnection(server.getJdbcUrl("testdb"));
            Statement statement = connection.createStatement()) {
        statement.execute("CREATE TABLE test_table (id bigint PRIMARY KEY)");
        statement.execute("INSERT INTO test_table (id) VALUES (123)");
    }
}

The server takes a few seconds to startup, so you will likely want to leave it running between tests. Make sure the server is always shutdown (by calling the close() method or using try-with-resources), otherwise the mysqld process will stay running after the JVM exits.

License

The code in this project is licensed under the Apache License, Version 2.0. The bundled MySQL server is licensed under the GNU General Public License (GPL), Version 2.0.

com.facebook.presto

Presto

Distributed SQL query engine for big data

Versions

Version
0.6
0.4
0.3
0.2
0.1