au.net.causal.maven.plugins.boxdb.db.PostgresFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boxdb-maven-plugin Show documentation
Show all versions of boxdb-maven-plugin Show documentation
Maven plugin to start databases using Docker and VMs
package au.net.causal.maven.plugins.boxdb.db;
public class PostgresFactory extends DockerDatabaseFactory
{
public PostgresFactory()
{
super("postgres");
}
@Override
protected void initializeDefaults(BoxConfiguration boxConfiguration)
{
if (boxConfiguration.getAdminUser() == null)
boxConfiguration.setAdminUser("postgres");
if (boxConfiguration.getAdminPassword() == null)
boxConfiguration.setAdminPassword("postgresbox");
if (boxConfiguration.getDatabaseName() == null)
boxConfiguration.setDatabaseName("app");
if (boxConfiguration.getDatabaseVersion() == null)
boxConfiguration.setDatabaseVersion("9.5");
if (boxConfiguration.getDatabasePort() <= 0)
boxConfiguration.setDatabasePort(5433);
if (boxConfiguration.getDatabaseUser() == null)
boxConfiguration.setDatabaseUser(boxConfiguration.getDatabaseName());
if (boxConfiguration.getDatabasePassword() == null)
boxConfiguration.setDatabasePassword(boxConfiguration.getDatabaseUser());
if (!boxConfiguration.getConfiguration().containsKey("collation"))
boxConfiguration.getConfiguration().put("collation", "C");
super.initializeDefaults(boxConfiguration);
}
@Override
protected PostgresDatabase createDockerDatabase(BoxConfiguration boxConfiguration, ProjectConfiguration projectConfiguration, BoxContext context)
throws BoxDatabaseException
{
return new PostgresDatabase(boxConfiguration, projectConfiguration, context);
}
}