All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.arquillian.ape.rdbms.flyway.FlywayPopulatorService Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha.7
Show newest version
package org.arquillian.ape.rdbms.flyway;

import java.net.URI;
import java.util.List;
import java.util.Map;
import org.arquillian.ape.rdbms.core.RdbmsPopulatorService;

class FlywayPopulatorService implements RdbmsPopulatorService {

    private org.flywaydb.core.Flyway flyway = new org.flywaydb.core.Flyway();

    @Override
    public void connect(URI jdbc, String username, String password, Class driver, Map customOptions) {
        this.flyway.setDataSource(jdbc.toString(),username, password);
        final FlywayOptions flywayOptions = new FlywayOptions(customOptions);
        flywayOptions.configure(this.flyway);
    }

    @Override
    public void disconnect() {
    }

    @Override
    public void execute(List resources) {
        this.flyway.setLocations(resources.toArray(new String[resources.size()]));
        this.flyway.migrate();
    }

    @Override
    public void clean(List resources) {
        flyway.clean();
    }

    @Override
    public Class getPopulatorAnnotation() {
        return Flyway.class;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy