You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2018/04/20 14:38:49 UTC

lucene-solr:master: SOLR-11252: Fix minor compiler and intellij warnings in autoscaling policy framework

Repository: lucene-solr
Updated Branches:
  refs/heads/master 4eead83a8 -> 86b34fe0f


SOLR-11252: Fix minor compiler and intellij warnings in autoscaling policy framework


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/86b34fe0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/86b34fe0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/86b34fe0

Branch: refs/heads/master
Commit: 86b34fe0fd0b1facb203406a4dab63ce76827b75
Parents: 4eead83
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Fri Apr 20 20:08:37 2018 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Fri Apr 20 20:08:37 2018 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../client/solrj/cloud/autoscaling/Clause.java  | 21 ++++++------
 .../autoscaling/DelegatingCloudManager.java     |  2 +-
 .../client/solrj/cloud/autoscaling/Operand.java |  2 +-
 .../client/solrj/cloud/autoscaling/Policy.java  | 34 +++++++++++---------
 .../solrj/cloud/autoscaling/ReplicaCount.java   |  6 ++++
 .../solrj/cloud/autoscaling/Suggestion.java     |  4 +--
 .../solrj/cloud/autoscaling/Violation.java      |  2 +-
 .../solrj/impl/SolrClientNodeStateProvider.java |  4 +--
 .../solrj/cloud/autoscaling/TestPolicy.java     | 22 ++++++-------
 10 files changed, 56 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 516a0d7..f5808ec 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -239,6 +239,8 @@ Other Changes
 
 * SOLR-12142: EmbeddedSolrServer should use req.getContentWriter (noble)
 
+* SOLR-11252: Fix minor compiler and intellij warnings in autoscaling policy framework. (shalin)
+
 ==================  7.3.1 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
index 92854fd..c739588 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
@@ -46,13 +46,17 @@ import static org.apache.solr.common.params.CoreAdminParams.COLLECTION;
 import static org.apache.solr.common.params.CoreAdminParams.REPLICA;
 import static org.apache.solr.common.params.CoreAdminParams.SHARD;
 
-// a set of conditions in a policy
+/**
+ * Represents a set of conditions in the policy
+ */
 public class Clause implements MapWriter, Comparable<Clause> {
+  private static final Set<String> IGNORE_TAGS = new HashSet<>(Arrays.asList(REPLICA, COLLECTION, SHARD, "strict", "type"));
+
   final Map<String, Object> original;
   Condition collection, shard, replica, tag, globalTag;
   final Replica.Type type;
 
-  boolean strict = true;
+  boolean strict;
 
   public Clause(Map<String, Object> m) {
     this.original = Utils.getDeepCopy(m, 10);
@@ -76,7 +80,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
       }
       this.replica = parse(REPLICA, m);
       if (replica.op == WILDCARD) throw new RuntimeException("replica val cannot be null" + Utils.toJSONString(m));
-      m.forEach((s, o) -> parseCondition(s, o));
+      m.forEach(this::parseCondition);
     }
     if (tag == null)
       throw new RuntimeException("Invalid op, must have one and only one tag other than collection, shard,replica " + Utils.toJSONString(m));
@@ -193,7 +197,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
               .opposite(isReplicaZero() && this == tag)
               .delta(Clause.parseDouble(name, this.val), Clause.parseDouble(name, val));
         } else {
-          return 0l;
+          return 0L;
         }
       } else return op
           .opposite(isReplicaZero() && this == tag)
@@ -290,13 +294,14 @@ public class Clause implements MapWriter, Comparable<Clause> {
           if (!shard.isPass(shardName)) break;
           Map<String, ReplicaCount> tagVsCount = collMap.computeIfAbsent(shardName, s -> new HashMap<>());
           Object tagVal = row.getVal(tag.name);
-          tagVsCount.computeIfAbsent(tag.isPass(tagVal) ? String.valueOf(tagVal) : "", s -> new ReplicaCount());
-          if (tag.isPass(tagVal)) {
+          boolean pass = tag.isPass(tagVal);
+          tagVsCount.computeIfAbsent(pass ? String.valueOf(tagVal) : "", s -> new ReplicaCount());
+          if (pass) {
             tagVsCount.get(String.valueOf(tagVal)).increment(shards.getValue());
           }
-          }
         }
       }
+    }
     return collVsShardVsTagVsCount;
   }
 
@@ -318,8 +323,6 @@ public class Clause implements MapWriter, Comparable<Clause> {
     NOT_APPLICABLE, FAIL, PASS
   }
 
-  private static final Set<String> IGNORE_TAGS = new HashSet<>(Arrays.asList(REPLICA, COLLECTION, SHARD, "strict", "type"));
-
   public static String parseString(Object val) {
     return val == null ? null : String.valueOf(val);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DelegatingCloudManager.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DelegatingCloudManager.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DelegatingCloudManager.java
index 22b2a51..8f3b08b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DelegatingCloudManager.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/DelegatingCloudManager.java
@@ -33,7 +33,7 @@ import org.apache.solr.common.util.TimeSource;
  * Base class for overriding some behavior of {@link SolrCloudManager}.
  */
 public class DelegatingCloudManager implements SolrCloudManager {
-  private final SolrCloudManager delegate;
+  protected final SolrCloudManager delegate;
   private ObjectCache objectCache = new ObjectCache();
   private TimeSource timeSource = TimeSource.NANO_TIME;
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Operand.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Operand.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Operand.java
index 33decf0..11df06f 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Operand.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Operand.java
@@ -124,7 +124,7 @@ public enum Operand {
       Long actualL = ((Number) actual).longValue();
       return _delta(expectedL, actualL);
     } else {
-      return 0l;
+      return 0L;
     }
 
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
index 9496b0f..cbdb2a7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
@@ -77,6 +77,12 @@ public class Policy implements MapWriter {
       Arrays.asList(
           new Preference((Map<String, Object>) Utils.fromJSONString("{minimize : cores, precision:1}")),
           new Preference((Map<String, Object>) Utils.fromJSONString("{maximize : freedisk}"))));
+
+  /**
+   * These parameters are always fetched for all nodes regardless of whether they are used in preferences or not
+   */
+  private static final List<String> DEFAULT_PARAMS_OF_INTEREST = Arrays.asList(ImplicitSnitch.DISK, ImplicitSnitch.CORES);
+
   final Map<String, List<Clause>> policies;
   final List<Clause> clusterPolicy;
   final List<Preference> clusterPreferences;
@@ -87,6 +93,7 @@ public class Policy implements MapWriter {
     this(Collections.emptyMap());
   }
 
+  @SuppressWarnings("unchecked")
   public Policy(Map<String, Object> jsonMap) {
     int[] idx = new int[1];
     List<Preference> initialClusterPreferences = ((List<Map<String, Object>>) jsonMap.getOrDefault(CLUSTER_PREFERENCES, emptyList())).stream()
@@ -100,9 +107,7 @@ public class Policy implements MapWriter {
       initialClusterPreferences.addAll(DEFAULT_PREFERENCES);
     }
     this.clusterPreferences = Collections.unmodifiableList(initialClusterPreferences);
-    final SortedSet<String> paramsOfInterest = new TreeSet<>();
-    paramsOfInterest.add(ImplicitSnitch.DISK);//always get freedisk anyway.
-    paramsOfInterest.add(ImplicitSnitch.CORES);//always get cores anyway.
+    final SortedSet<String> paramsOfInterest = new TreeSet<>(DEFAULT_PARAMS_OF_INTEREST);
     clusterPreferences.forEach(preference -> paramsOfInterest.add(preference.name.toString()));
     List<String> newParams = new ArrayList<>(paramsOfInterest);
     clusterPolicy = ((List<Map<String, Object>>) jsonMap.getOrDefault(CLUSTER_POLICY, emptyList())).stream()
@@ -149,9 +154,7 @@ public class Policy implements MapWriter {
       paramsOfInterest.add(p.name.toString());
     });
     List<String> newParams = new ArrayList<>(paramsOfInterest);
-    policy.forEach(c -> {
-      c.addTags(newParams);
-    });
+    policy.forEach(c -> c.addTags(newParams));
     policies.values().forEach(clauses -> clauses.forEach(c -> c.addTags(newParams)));
     return newParams;
   }
@@ -212,8 +215,7 @@ public class Policy implements MapWriter {
 
     if (!getPolicies().equals(policy.getPolicies())) return false;
     if (!getClusterPolicy().equals(policy.getClusterPolicy())) return false;
-    if (!getClusterPreferences().equals(policy.getClusterPreferences())) return false;
-    return true;
+    return getClusterPreferences().equals(policy.getClusterPreferences());
   }
 
   /*This stores the logical state of the system, given a policy and
@@ -332,8 +334,7 @@ public class Policy implements MapWriter {
     @Override
     public void writeMap(EntryWriter ew) throws IOException {
       ew.put("znodeVersion", znodeVersion);
-      for (int i = 0; i < matrix.size(); i++) {
-        Row row = matrix.get(i);
+      for (Row row : matrix) {
         ew.put(row.node, row);
       }
     }
@@ -363,15 +364,16 @@ public class Policy implements MapWriter {
       ArrayList<Row> tmpMatrix = new ArrayList<>(matrix);
       for (Preference p : clusterPreferences) {
         try {
-          Collections.sort(tmpMatrix, (r1, r2) -> p.compare(r1, r2, false));
+          tmpMatrix.sort((r1, r2) -> p.compare(r1, r2, false));
         } catch (Exception e) {
           LOG.error("Exception! prefs = {}, matrix = {}", clusterPreferences, matrix);
           throw e;
         }
         p.setApproxVal(tmpMatrix);
       }
-      //approximate values are set now. Let's do recursive sorting
-      Collections.sort(matrix, (Row r1, Row r2) -> {
+      // the tmpMatrix was needed only to set the approximate values, now we sort the real matrix
+      // recursing through each preference
+      matrix.sort((Row r1, Row r2) -> {
         int result = clusterPreferences.get(0).compare(r1, r2, true);
         if (result == 0) result = clusterPreferences.get(0).compare(r1, r2, false);
         return result;
@@ -465,10 +467,10 @@ public class Policy implements MapWriter {
   private static final Map<CollectionAction, Supplier<Suggester>> ops = new HashMap<>();
 
   static {
-    ops.put(CollectionAction.ADDREPLICA, () -> new AddReplicaSuggester());
+    ops.put(CollectionAction.ADDREPLICA, AddReplicaSuggester::new);
     ops.put(CollectionAction.DELETEREPLICA, () -> new UnsupportedSuggester(CollectionAction.DELETEREPLICA));
-    ops.put(CollectionAction.MOVEREPLICA, () -> new MoveReplicaSuggester());
-    ops.put(CollectionAction.SPLITSHARD, () -> new SplitShardSuggester());
+    ops.put(CollectionAction.MOVEREPLICA, MoveReplicaSuggester::new);
+    ops.put(CollectionAction.SPLITSHARD, SplitShardSuggester::new);
     ops.put(CollectionAction.MERGESHARDS, () -> new UnsupportedSuggester(CollectionAction.MERGESHARDS));
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java
index acb8c68..0fe53f4 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.apache.solr.common.MapWriter;
 import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.util.Utils;
 
 class ReplicaCount extends Number implements MapWriter {
   long nrt, tlog, pull;
@@ -89,4 +90,9 @@ class ReplicaCount extends Number implements MapWriter {
       }
     }
   }
+
+  @Override
+  public String toString() {
+    return Utils.toJSONString(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
index 0c9013e..a4eed4b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
@@ -134,8 +134,8 @@ public class Suggestion {
       @Override
       public int compareViolation(Violation v1, Violation v2) {
         return Long.compare(
-            v1.getViolatingReplicas().stream().mapToLong(v -> v.delta == null? 0 :v.delta).max().orElse(0l),
-            v2.getViolatingReplicas().stream().mapToLong(v3 -> v3.delta == null? 0 : v3.delta).max().orElse(0l));
+            v1.getViolatingReplicas().stream().mapToLong(v -> v.delta == null? 0 :v.delta).max().orElse(0L),
+            v2.getViolatingReplicas().stream().mapToLong(v3 -> v3.delta == null? 0 : v3.delta).max().orElse(0L));
       }
 
       @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Violation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Violation.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Violation.java
index bb5aa6f..76bd7d5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Violation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Violation.java
@@ -81,7 +81,7 @@ public class Violation implements MapWriter {
     @Override
     public void writeMap(EntryWriter ew) throws IOException {
       ew.put("replica", replicaInfo);
-      ew.putIfNotNull("delta",delta );
+      ew.putIfNotNull("delta", delta);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
index 03809a2..5fe9058 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
@@ -135,7 +135,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
           Pair<String, ReplicaInfo> p = keyVsReplica.get(k);
           Suggestion.ConditionType validator = Suggestion.getTagType(p.first());
           if (validator != null) o = validator.convertVal(o);
-          if (p != null) p.second().getVariables().put(p.first(), o);
+          if (p.second() != null) p.second().getVariables().put(p.first(), o);
         });
 
       }
@@ -145,7 +145,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
 
   static void fetchMetrics(String solrNode, ClientSnitchCtx ctx, Map<String, Object> metricsKeyVsTag) {
     ModifiableSolrParams params = new ModifiableSolrParams();
-    params.add("key", metricsKeyVsTag.keySet().toArray(new String[metricsKeyVsTag.size()]));
+    params.add("key", metricsKeyVsTag.keySet().toArray(new String[0]));
     try {
       SimpleSolrResponse rsp = ctx.invoke(solrNode, CommonParams.METRICS_PATH, params);
       metricsKeyVsTag.forEach((key, tag) -> {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/86b34fe0/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
index 2b97b71..a53b60c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
@@ -155,7 +155,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
   public void testValidate() {
     expectError("replica", -1, "must be greater than");
     expectError("replica", "hello", "not a valid number");
-    assertEquals(1l, Clause.validate("replica", "1", true));
+    assertEquals(1L, Clause.validate("replica", "1", true));
     assertEquals("c", Clause.validate("collection", "c", true));
     assertEquals("s", Clause.validate("shard", "s", true));
     assertEquals("overseer", Clause.validate("nodeRole", "overseer", true));
@@ -176,7 +176,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     expectError("ip_1", "-1", "must be greater than");
     expectError("ip_1", -1, "must be greater than");
 
-    assertEquals(1l, Clause.validate("ip_1", "1", true));
+    assertEquals(1L, Clause.validate("ip_1", "1", true));
 
     expectError("heapUsage", "-1", "must be greater than");
     expectError("heapUsage", -1, "must be greater than");
@@ -474,7 +474,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
       public DistribStateManager getDistribStateManager() {
         return new DelegatingDistribStateManager(null) {
           @Override
-          public AutoScalingConfig getAutoScalingConfig() throws InterruptedException, IOException {
+          public AutoScalingConfig getAutoScalingConfig() {
             return asc;
           }
         };
@@ -868,7 +868,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     assertEquals("sysprop.rack", clauses.get(0).tag.getName());
   }
 
-  public void testRules() throws IOException {
+  public void testRules() {
     String rules = "{" +
         "cluster-policy:[" +
         "{nodeRole:'overseer',replica : 0 , strict:false}," +
@@ -1020,7 +1020,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
   private DistribStateManager delegatingDistribStateManager(AutoScalingConfig config) {
     return new DelegatingDistribStateManager(null) {
       @Override
-      public AutoScalingConfig getAutoScalingConfig() throws InterruptedException, IOException {
+      public AutoScalingConfig getAutoScalingConfig() {
         return config;
       }
     };
@@ -1248,7 +1248,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
       }
 
       @Override
-      public void close() throws IOException {
+      public void close() {
 
       }
 
@@ -1291,12 +1291,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
       }
 
       @Override
-      public SolrResponse request(SolrRequest req) throws IOException {
+      public SolrResponse request(SolrRequest req) {
         return null;
       }
 
       @Override
-      public byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String, String> headers, String payload, int timeout, boolean followRedirects) throws IOException {
+      public byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String, String> headers, String payload, int timeout, boolean followRedirects) {
         return new byte[0];
       }
     };
@@ -1505,7 +1505,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     assertFalse(l.isEmpty());
 
     Map m = l.get(0).toMap(new LinkedHashMap<>());
-    assertEquals(1l, Utils.getObjectByPath(m, true, "violation/violation/delta"));
+    assertEquals(1L, Utils.getObjectByPath(m, true, "violation/violation/delta"));
     assertEquals("POST", Utils.getObjectByPath(m, true, "operation/method"));
     assertEquals("/c/mycoll1", Utils.getObjectByPath(m, true, "operation/path"));
     assertNotNull(Utils.getObjectByPath(m, false, "operation/command/move-replica"));
@@ -1579,7 +1579,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
     List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
     assertFalse(violations.isEmpty());
-    assertEquals(2l, violations.get(0).replicaCountDelta.longValue());
+    assertEquals(2L, violations.get(0).replicaCountDelta.longValue());
 
     List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(cfg,
         cloudManagerWithData(dataproviderdata));
@@ -1794,7 +1794,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
           }
 
           @Override
-          public DocCollection getCollection(String name) throws IOException {
+          public DocCollection getCollection(String name) {
             return new DocCollection(name, Collections.emptyMap(), Collections.emptyMap(), DocRouter.DEFAULT) {
               @Override
               public Replica getLeader(String sliceName) {