diff --git a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/config/AbstractConfigService.java b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/config/AbstractConfigService.java index 3cd6978cf4c..8db6756aca5 100644 --- a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/config/AbstractConfigService.java +++ b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/config/AbstractConfigService.java @@ -122,11 +122,11 @@ public List calcConfigurationChanges( for (String newKey : newKeys) { changes.add(new ConfigurationChange(newKey, latestReleaseConfigurations.get(newKey), - ConfigurationChangeType.ADDED)); + "ADDED")); } for (String removedKey : removedKeys) { - changes.add(new ConfigurationChange(removedKey, null, ConfigurationChangeType.DELETED)); + changes.add(new ConfigurationChange(removedKey, null,"DELETED")); } for (String commonKey : commonKeys) { @@ -136,7 +136,7 @@ public List calcConfigurationChanges( continue; } changes.add( - new ConfigurationChange(commonKey, currentValue, ConfigurationChangeType.MODIFIED)); + new ConfigurationChange(commonKey, currentValue,"MODIFIED")); } return changes; diff --git a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigControllerTest.java b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigControllerTest.java index a4129d6765f..6d787337d25 100644 --- a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigControllerTest.java +++ b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigControllerTest.java @@ -516,7 +516,7 @@ public void testQueryConfigWithIncrementalSync() throws Exception { when(anotherRelease.getConfigurations()).thenReturn(anotherConfigurations); List configurationChanges=new ArrayList<>(); - configurationChanges.add(new ConfigurationChange("apollo.public.bar", "bar", ConfigurationChangeType.ADDED)); + configurationChanges.add(new ConfigurationChange("apollo.public.bar", "bar", "ADDED")); when(configService.calcConfigurationChanges(gson.fromJson(anotherConfigurations, configurationTypeReference), gson.fromJson(someConfigurations, configurationTypeReference))) .thenReturn(configurationChanges); @@ -602,9 +602,9 @@ public void testQueryConfigWithIncrementalSyncPublicNamespaceAndAppOverride() th String mergeServerSideConfigurations = "{\"apollo.public.bar\": \"bar\",\"apollo.public.foo\": \"foo-override\"}"; String mergeClientSideConfigurations = "{\"apollo.public.foo.client\": \"foo.override\"}"; List configurationChanges=new ArrayList<>(); - configurationChanges.add(new ConfigurationChange("apollo.public.bar", "bar", ConfigurationChangeType.ADDED)); - configurationChanges.add(new ConfigurationChange("apollo.public.foo", "foo-override", ConfigurationChangeType.ADDED)); - configurationChanges.add(new ConfigurationChange("apollo.public.foo.client", null, ConfigurationChangeType.DELETED)); + configurationChanges.add(new ConfigurationChange("apollo.public.bar", "bar", "ADDED")); + configurationChanges.add(new ConfigurationChange("apollo.public.foo", "foo-override", "ADDED")); + configurationChanges.add(new ConfigurationChange("apollo.public.foo.client", null, "DELETED")); when(configService.calcConfigurationChanges(gson.fromJson(mergeServerSideConfigurations, configurationTypeReference), gson.fromJson(mergeClientSideConfigurations, configurationTypeReference))) .thenReturn(configurationChanges); diff --git a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithChangeCacheTest.java b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithChangeCacheTest.java index da14988090f..e0bf3150d03 100644 --- a/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithChangeCacheTest.java +++ b/apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithChangeCacheTest.java @@ -103,7 +103,7 @@ public void testChangeConfigurationsWithAdd() { assertEquals(1, result.size()); assertEquals(key2, result.get(0).getKey()); assertEquals(value2, result.get(0).getNewValue()); - assertEquals(ConfigurationChangeType.ADDED, result.get(0).getConfigurationChangeType()); + assertEquals("ADDED", result.get(0).getConfigurationChangeType()); } @Test public void testChangeConfigurationsWithLatestConfigIsNULL() { @@ -119,7 +119,7 @@ public void testChangeConfigurationsWithLatestConfigIsNULL() { assertEquals(1, result.size()); assertEquals(key1, result.get(0).getKey()); assertEquals(null, result.get(0).getNewValue()); - assertEquals(ConfigurationChangeType.DELETED, result.get(0).getConfigurationChangeType()); + assertEquals("DELETED", result.get(0).getConfigurationChangeType()); } @Test public void testChangeConfigurationsWithHistoryConfigIsNULL() { @@ -134,7 +134,7 @@ public void testChangeConfigurationsWithHistoryConfigIsNULL() { assertEquals(1, result.size()); assertEquals(key1, result.get(0).getKey()); assertEquals(value1, result.get(0).getNewValue()); - assertEquals(ConfigurationChangeType.ADDED, result.get(0).getConfigurationChangeType()); + assertEquals("ADDED", result.get(0).getConfigurationChangeType()); } @Test public void testChangeConfigurationsWithUpdate() { @@ -152,7 +152,7 @@ public void testChangeConfigurationsWithUpdate() { assertEquals(1, result.size()); assertEquals(key1, result.get(0).getKey()); assertEquals(anotherValue1, result.get(0).getNewValue()); - assertEquals(ConfigurationChangeType.MODIFIED, result.get(0).getConfigurationChangeType()); + assertEquals("MODIFIED", result.get(0).getConfigurationChangeType()); } @Test public void testChangeConfigurationsWithDelete() { @@ -168,7 +168,7 @@ public void testChangeConfigurationsWithDelete() { assertEquals(1, result.size()); assertEquals(key1, result.get(0).getKey()); assertEquals(null, result.get(0).getNewValue()); - assertEquals(ConfigurationChangeType.DELETED, result.get(0).getConfigurationChangeType()); + assertEquals("DELETED", result.get(0).getConfigurationChangeType()); } @Test