Skip to content
Snippets Groups Projects
Commit 779f67b1 authored by Zhibin Mai's avatar Zhibin Mai
Browse files

Turn on the feature flag by default for shape decimation

parent e8a23c6b
No related branches found
No related tags found
1 merge request!486Enable the feature flag for geo-shape decimation by default
......@@ -51,14 +51,13 @@ public class GeoShapeDecimationSetting {
if (cache != null && cache.containsKey(cacheKey))
return cache.get(cacheKey);
boolean decimationEnabled = false;
boolean decimationEnabled = true;
try {
PartitionInfo partitionInfo = getPartitionInfo(dataPartitionId);
decimationEnabled = getDecimationSetting(partitionInfo);
} catch (Exception e) {
this.logger.error(String.format("PartitionService: Error getting %s for dataPartition with Id: %s", PROPERTY_NAME, dataPartitionId), e);
this.logger.error(String.format("PartitionService: Error getting %s for dataPartition with Id: %s. Turn on the feature flag by default.", PROPERTY_NAME, dataPartitionId), e);
}
this.cache.put(cacheKey, decimationEnabled);
return decimationEnabled;
}
......@@ -78,12 +77,12 @@ public class GeoShapeDecimationSetting {
private boolean getDecimationSetting(PartitionInfo partitionInfo) {
if(partitionInfo == null || partitionInfo.getProperties() == null)
return false;
return true;
if(partitionInfo.getProperties().containsKey(PROPERTY_NAME)) {
Property property = partitionInfo.getProperties().get(PROPERTY_NAME);
return Boolean.parseBoolean((String)property.getValue());
}
return false;
return true;
}
}
......@@ -91,18 +91,20 @@ public class GeoShapeDecimationSettingTest {
}
@Test
public void isDecimationEnabled_return_false_when_property_does_not_exist() throws PartitionException {
public void isDecimationEnabled_return_true_when_property_does_not_exist() throws PartitionException {
// The feature flag is enabled by default
PartitionInfo partitionInfo = new PartitionInfo();
when(this.partitionProvider.get(anyString())).thenReturn(partitionInfo);
boolean enabled = sut.isDecimationEnabled();
Assert.assertFalse(enabled);
Assert.assertTrue(enabled);
}
@Test
public void isDecimationEnabled_return_false_when_partitionProvider_throws_exception() throws PartitionException {
public void isDecimationEnabled_return_true_when_partitionProvider_throws_exception() throws PartitionException {
// The feature flag is enabled by default
when(this.partitionProvider.get(anyString())).thenThrow(PartitionException.class);
boolean enabled = sut.isDecimationEnabled();
Assert.assertFalse(enabled);
Assert.assertTrue(enabled);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment