diff --git a/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/config/EsConfig.java b/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/config/EsConfig.java index ae6ffb4af29795dc3ed5e85fa849b35351dcaf1e..dae5f3f5c4c239bb43f138c439f89d2f534a55d1 100644 --- a/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/config/EsConfig.java +++ b/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/config/EsConfig.java @@ -32,6 +32,8 @@ public class EsConfig { } public enum IndexInitMode { - auto, forced, manual + AUTO, + FORCED, + MANUAL } } diff --git a/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/storage/IndexCreator.java b/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/storage/IndexCreator.java index 973ea1ee0526f28e28dc57addab529d4434ba29b..562ee0bdf11a82598a7dcd0c9788cc2158f3fafd 100644 --- a/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/storage/IndexCreator.java +++ b/skywalking-collector/skywalking-collector-worker/src/main/java/com/a/eye/skywalking/collector/worker/storage/IndexCreator.java @@ -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 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(); } diff --git a/skywalking-collector/skywalking-collector-worker/src/test/java/com/a/eye/skywalking/collector/worker/storage/IndexCreatorTestCase.java b/skywalking-collector/skywalking-collector-worker/src/test/java/com/a/eye/skywalking/collector/worker/storage/IndexCreatorTestCase.java index 52eaf2c1cbf3b2b194918c1edb4cdb5b916a30c7..cd17746c15e77f008b9776ceac9f1932888180a5 100644 --- a/skywalking-collector/skywalking-collector-worker/src/test/java/com/a/eye/skywalking/collector/worker/storage/IndexCreatorTestCase.java +++ b/skywalking-collector/skywalking-collector-worker/src/test/java/com/a/eye/skywalking/collector/worker/storage/IndexCreatorTestCase.java @@ -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();