mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#885 - DbMigrationConfig.loadSettings config has wrong
This commit is contained in:
@@ -2,12 +2,14 @@ package com.avaje.ebean.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
public class DbMigrationConfigTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testLoad() {
|
||||
|
||||
@@ -20,4 +22,52 @@ public class DbMigrationConfigTest {
|
||||
|
||||
assertThat(migrationConfig.getMigrationPath()).isEqualTo("dbmigration/myapp");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadProperties_migration() {
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("ebean.migration.dbusername", "banana");
|
||||
properties.setProperty("ebean.migration.dbpassword", "apple");
|
||||
|
||||
PropertiesWrapper wrapper = new PropertiesWrapper("ebean", "db", properties);
|
||||
|
||||
DbMigrationConfig migrationConfig = new DbMigrationConfig();
|
||||
migrationConfig.loadSettings(wrapper, "db");
|
||||
|
||||
assertEquals(migrationConfig.getDbUsername(),"banana");
|
||||
assertEquals(migrationConfig.getDbPassword(),"apple");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadProperties_datasource() {
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("datasource.db.username", "banana");
|
||||
properties.setProperty("datasource.db.password", "apple");
|
||||
|
||||
PropertiesWrapper wrapper = new PropertiesWrapper("ebean", "db", properties);
|
||||
|
||||
DbMigrationConfig migrationConfig = new DbMigrationConfig();
|
||||
migrationConfig.loadSettings(wrapper, "db");
|
||||
|
||||
assertEquals(migrationConfig.getDbUsername(),"banana");
|
||||
assertEquals(migrationConfig.getDbPassword(),"apple");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadProperties_datasource_adminusername() {
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("datasource.db.adminusername", "banana");
|
||||
properties.setProperty("datasource.db.adminpassword", "apple");
|
||||
|
||||
PropertiesWrapper wrapper = new PropertiesWrapper("ebean", "db", properties);
|
||||
|
||||
DbMigrationConfig migrationConfig = new DbMigrationConfig();
|
||||
migrationConfig.loadSettings(wrapper, "db");
|
||||
|
||||
assertEquals(migrationConfig.getDbUsername(),"banana");
|
||||
assertEquals(migrationConfig.getDbPassword(),"apple");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user