提交 438949de 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge pull request #137 from ascrutae/zhangxin/enum-not-found

fix start error issue
......@@ -32,6 +32,8 @@ public class EsConfig {
}
public enum IndexInitMode {
auto, forced, manual
AUTO,
FORCED,
MANUAL
}
}
......@@ -17,12 +17,12 @@ public enum IndexCreator {
private Logger logger = LogManager.getFormatterLogger(IndexCreator.class);
public void create() {
if (!EsConfig.IndexInitMode.manual.equals(EsConfig.Es.Index.Initialize.mode)) {
if (!EsConfig.IndexInitMode.MANUAL.equals(EsConfig.Es.Index.Initialize.mode)) {
Set<AbstractIndex> indexSet = loadIndex();
for (AbstractIndex index : indexSet) {
boolean isExists = index.isExists();
if (isExists) {
if (EsConfig.IndexInitMode.forced.equals(EsConfig.Es.Index.Initialize.mode)) {
if (EsConfig.IndexInitMode.FORCED.equals(EsConfig.Es.Index.Initialize.mode)) {
index.deleteIndex();
index.createIndex();
}
......
......@@ -65,7 +65,7 @@ public class IndexCreatorTestCase {
@Test
public void testCreateOptionManual() throws Exception {
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.manual;
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.MANUAL;
indexCreator.create();
Mockito.verify(testIndex, Mockito.never()).createIndex();
Mockito.verify(testIndex, Mockito.never()).deleteIndex();
......@@ -73,7 +73,7 @@ public class IndexCreatorTestCase {
@Test
public void testCreateOptionForcedIndexIsExists() throws Exception {
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.forced;
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.FORCED;
when(testIndex.isExists()).thenReturn(true);
indexCreator.create();
Mockito.verify(testIndex).createIndex();
......@@ -82,7 +82,7 @@ public class IndexCreatorTestCase {
@Test
public void testCreateOptionForcedIndexNotExists() throws Exception {
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.forced;
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.FORCED;
when(testIndex.isExists()).thenReturn(false);
indexCreator.create();
Mockito.verify(testIndex).createIndex();
......@@ -91,7 +91,7 @@ public class IndexCreatorTestCase {
@Test
public void testCreateOptionAutoIndexNotExists() throws Exception {
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.auto;
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.AUTO;
when(testIndex.isExists()).thenReturn(false);
indexCreator.create();
Mockito.verify(testIndex).createIndex();
......@@ -100,7 +100,7 @@ public class IndexCreatorTestCase {
@Test
public void testCreateOptionAutoIndexExists() throws Exception {
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.auto;
EsConfig.Es.Index.Initialize.mode = EsConfig.IndexInitMode.AUTO;
when(testIndex.isExists()).thenReturn(true);
indexCreator.create();
Mockito.verify(testIndex, Mockito.never()).createIndex();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册