#602 - Elastic - Add support for ebean.docstore.generateMapping

This commit is contained in:
Robin Bygrave
2016-03-15 17:10:03 +13:00
parent db9d39ef61
commit cb347ff5fa
2 changed files with 81 additions and 4 deletions
@@ -10,7 +10,7 @@ import static org.junit.Assert.*;
public class DocStoreConfigTest {
@Test
public void testLoadSettings() throws Exception {
public void loadSettings() throws Exception {
DocStoreConfig config = new DocStoreConfig();
@@ -25,9 +25,44 @@ public class DocStoreConfigTest {
config.loadSettings(wrapper);
assertTrue(config.isActive());
assertFalse(config.isGenerateMapping());
assertFalse(config.isDropCreate());
assertEquals("http://foo:9800", config.getUrl());
assertEquals(DocStoreMode.IGNORE, config.getPersist());
assertEquals(99, config.getBulkBatchSize());
}
@Test
public void loadSettings_generateMapping_dropCreate() throws Exception {
DocStoreConfig config = new DocStoreConfig();
Properties properties = new Properties();
properties.setProperty("ebean.docstore.generateMapping", "true");
properties.setProperty("ebean.docstore.dropCreate", "true");
PropertiesWrapper wrapper = new PropertiesWrapper("ebean", null, properties);
config.loadSettings(wrapper);
assertTrue(config.isGenerateMapping());
assertTrue(config.isDropCreate());
assertFalse(config.isCreate());
}
@Test
public void loadSettings_generateMapping_create() throws Exception {
DocStoreConfig config = new DocStoreConfig();
Properties properties = new Properties();
properties.setProperty("ebean.docstore.generateMapping", "true");
properties.setProperty("ebean.docstore.create", "true");
PropertiesWrapper wrapper = new PropertiesWrapper("ebean", null, properties);
config.loadSettings(wrapper);
assertTrue(config.isGenerateMapping());
assertTrue(config.isCreate());
assertFalse(config.isDropCreate());
}
}