From 8e2f1deacc94cbe4c12ce8dd59e0b8e1b934090e Mon Sep 17 00:00:00 2001 From: Michael McLawhorn Date: Tue, 3 Jan 2017 11:31:05 -0600 Subject: [PATCH] Whitespace and deprecation tweaks --- .../data/config/metric/makers/MetricMaker.java | 5 +---- .../config/metric/makers/MetricMakerSpec.groovy | 13 ++++--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/metric/makers/MetricMaker.java b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/metric/makers/MetricMaker.java index 5a4fd5f0c8..115f4aa296 100644 --- a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/metric/makers/MetricMaker.java +++ b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/metric/makers/MetricMaker.java @@ -243,6 +243,7 @@ protected static PostAggregation getNumericField(MetricField field) { * * @deprecated use the static version {@link #getSketchField(MetricField)} by preference */ + @Deprecated protected PostAggregation getSketchField(String fieldName) { // Get the field return getSketchField(metrics.get(fieldName).getMetricField()); @@ -277,10 +278,6 @@ protected static PostAggregation getSketchField(MetricField field) { return ((ThetaSketchEstimatePostAggregation) field).getField(); } - if (field instanceof ThetaSketchEstimatePostAggregation) { - return ((ThetaSketchEstimatePostAggregation) field).getField(); - } - // Check for sketches, since we require them after this point if (!field.isSketch()) { String message = String.format("Field must be a sketch: %s but is: %s", field.getName(), field); diff --git a/fili-core/src/test/groovy/com/yahoo/bard/webservice/data/config/metric/makers/MetricMakerSpec.groovy b/fili-core/src/test/groovy/com/yahoo/bard/webservice/data/config/metric/makers/MetricMakerSpec.groovy index f8734cde95..e659868bab 100644 --- a/fili-core/src/test/groovy/com/yahoo/bard/webservice/data/config/metric/makers/MetricMakerSpec.groovy +++ b/fili-core/src/test/groovy/com/yahoo/bard/webservice/data/config/metric/makers/MetricMakerSpec.groovy @@ -24,6 +24,7 @@ import com.yahoo.bard.webservice.druid.util.ThetaSketchFieldConverter import spock.lang.Specification import spock.lang.Unroll + /** * Tests the code implemented by MetricMaker, using a stub for code that is meant to be implemented by the children. * Primarily tests the sad paths. The specifications of the children of MetricMaker test the various happy paths. @@ -107,9 +108,6 @@ class MetricMakerSpec extends Specification { FieldConverterSupplier.sketchConverter = originalConverter } - def setup(){ - } - private static final LogicalMetric DEFAULT_METRIC = new LogicalMetric( new TemplateDruidQuery([] as Set, [] as Set), new NoOpResultSetMapper(), @@ -162,7 +160,7 @@ class MetricMakerSpec extends Specification { def "When a metric has too few dependent metrics, an exception is thrown."(){ given: "One fewer dependent metrics than this metric depends on" - List dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS-1) + List dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS - 1) dictionary.putAll(makeEmptyMetrics(dependentMetricNames)) when: @@ -174,7 +172,7 @@ class MetricMakerSpec extends Specification { def "When a claimed dependent metric does not exist in the maker's dictionary, an exception is thrown"(){ given: "A list of dependent metrics, one of which doesn't exist" - List dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS-1) + List dependentMetricNames = buildDependentMetricNames(DEPENDENT_METRICS - 1) dictionary.putAll(makeEmptyMetrics(dependentMetricNames)) dependentMetricNames.add("I don't exist!") @@ -186,7 +184,7 @@ class MetricMakerSpec extends Specification { } def "When a metric has too many dependent metrics, an exception is thrown"(){ given: "One more than the number of dependent metrics this maker depends on." - List dependentMetricNames = buildDependentMetricNames(maker.getDependentMetricsRequired()+1) + List dependentMetricNames = buildDependentMetricNames(maker.getDependentMetricsRequired() + 1) maker.metrics.putAll(makeEmptyMetrics(dependentMetricNames)) when: @@ -198,7 +196,6 @@ class MetricMakerSpec extends Specification { @Unroll def "getNumericField returns a numeric metric #expected.type for metric named: #fromMetric.name "() { - setup: expect: MetricMaker.getNumericField(fromMetric.metricField) == expected @@ -215,7 +212,6 @@ class MetricMakerSpec extends Specification { @Unroll def "getSketchField returns a sketch aggregation of type #expected.type for metric named: #fromMetric.name "() { - setup: expect: MetricMaker.getSketchField(fromMetric.metricField) == expected @@ -229,7 +225,6 @@ class MetricMakerSpec extends Specification { @Unroll def "getSketchField throws error when given a non sketch based field #fromMetric.name "() { - setup: when: MetricMaker.getSketchField(fromMetric.metricField)