package de.superx; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.Map; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.sql.DataSource; import org.junit.Ignore; import org.springframework.context.annotation.Bean; import com.zaxxer.hikari.HikariDataSource; import de.superx.spring.DatabaseUtils; @Ignore public class TestDbManagerPgLocal implements TestDbManager { Map> connections = new HashMap<>(); @Override public void setupTestDbs() { try { connections = DatabaseUtils.getValidConnections(); } catch (Exception e) { e.printStackTrace(); } } @Override public void removeTestDbs() { // Nothing to do here } @Override public DataSource getDataSource(String logicalDbName) { Map eduetlProps = connections.get(logicalDbName); HikariDataSource ds = DatabaseUtils.convertConnection(logicalDbName, eduetlProps, 0, 180000); //ds.setConnectionInitSql("SET standard_conforming_strings TO 'off'; SET datestyle TO 'ISO, DMY';"); return ds; } @Override public Map dbtProfile() { Map attributes = new HashMap<>(); Map con; try { con = DatabaseUtils.getConnection("eduetl"); attributes.put("DBT_HOST", con.get("host")); attributes.put("DBT_PORT", con.get("dbserverport")); attributes.put("DBT_USER", con.get("user")); attributes.put("DBT_ENV_SECRET_PW", con.get("password")); attributes.put("DBT_DB", con.get("database")); return attributes; } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { e.printStackTrace(); } return attributes; } }