YugabyteDB

Testing

To test against YugabyteDB docker test container set the platform to yugabyte in src/test/resources/application-test.yaml

Refer to docs / testing if application-test.yaml doesn't exist yet.

ebean:
  test:
    platform: yugabyte #, h2, postgres, mysql, oracle, sqlserver
    ddlMode: dropCreate # none | dropCreate | migrations | create
    dbName: test

ebean-yugabyte dependency

We can use the io.ebean:ebean-yugabyte dependency rather than io.ebean:ebean if we want to only bring in the YugabyteDB specific platform code. Depending on io.ebean:ebean will bring in all platforms.

Docker container

We can programmatically start a docker container version of YugabyteDB.

The below uses ebean-test-docker dependency which already comes with ebean-test. If we do not have a dependency on ebean-test then add io.ebean:ebean-test-docker:5.0 as a dependency.

package main;

import io.ebean.docker.commands.YugabyteContainer;

public class Main {

  public static void main(String[] args) {

    YugabyteContainer container = YugabyteContainer.newBuilder("2.11.2.0-b89")
      //.port(6433)
      .dbName("my_app")
      .extensions("pgcrypto")
      .build();

    container.start();
  }
}