You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/10/16 22:53:59 UTC

[44/50] [abbrv] lucene-solr:jira/http2: SOLR-12792: extract test data into separate files in autoscaling tests

SOLR-12792: extract test data into separate files in autoscaling tests


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

Branch: refs/heads/jira/http2
Commit: f1a30bfb00cc3f72ee30a3356c153aee3a402433
Parents: aa0a528
Author: Noble Paul <no...@apache.org>
Authored: Tue Oct 16 19:11:08 2018 +1100
Committer: Noble Paul <no...@apache.org>
Committed: Tue Oct 16 19:11:08 2018 +1100

----------------------------------------------------------------------
 ...tAutoscalingPreferencesUsedWithNoPolicy.json |  53 ++
 .../testComputePlanAfterNodeAdded.json          |  16 +
 .../solr/autoscaling/testCoresSuggestions.json  |  17 +
 .../solr/autoscaling/testDiskSpaceHint.json     |  16 +
 .../solr/autoscaling/testEqualOnNonNode.json    |  83 +++
 .../autoscaling/testFreeDiskSuggestions.json    |  27 +
 .../autoscaling/testFreediskPercentage.json     |  25 +
 .../autoscaling/testMoveReplicaSuggester.json   |  15 +
 .../solrj/solr/autoscaling/testPolicy.json      |  41 ++
 .../solr/autoscaling/testPortSuggestions.json   |  22 +
 .../testReplicaCountSuggestions.json            |  15 +
 .../solr/autoscaling/testReplicaPercentage.json |  46 ++
 .../autoscaling/testReplicaZonesPercentage.json |  15 +
 .../autoscaling/testSyspropSuggestions1.json    |  24 +
 .../solr/autoscaling/testViolationOutput.json   |  22 +
 .../solr/autoscaling/testWithCollection.json    |  21 +
 .../testWithCollectionMoveReplica.json          |  28 +
 .../testWithCollectionMoveVsAddSuggestions.json |  49 ++
 .../testWithCollectionSuggestions.json          |  21 +
 .../solrj/cloud/autoscaling/TestPolicy.java     | 722 ++-----------------
 .../solrj/cloud/autoscaling/TestPolicy2.java    |  98 +--
 21 files changed, 630 insertions(+), 746 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoscalingPreferencesUsedWithNoPolicy.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoscalingPreferencesUsedWithNoPolicy.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoscalingPreferencesUsedWithNoPolicy.json
new file mode 100644
index 0000000..a4c39d4
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testAutoscalingPreferencesUsedWithNoPolicy.json
@@ -0,0 +1,53 @@
+{
+  "liveNodes":["node1:8983",
+    "node2:8984",
+    "node3:8985"],
+  "replicaInfo":{"node1:8983":{"c1":{
+    "s1":[{"r1":{
+      "type":"NRT",
+      "INDEX.sizeInGB":"1100"}},
+      {"r2":{"type":"NRT"}}],
+    "s2":[{"r1":{
+      "type":"NRT",
+      "INDEX.sizeInGB":"1100"}},
+      {"r2":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "node1:8983":{
+      "cores":4,
+      "freedisk":300,
+      "totaldisk":4700,
+      "port":8983},
+    "node2:8984":{
+      "cores":0,
+      "freedisk":1000,
+      "totaldisk":1200,
+      "port":8984},
+    "node3:8985":{
+      "cores":0,
+      "freedisk":1651,
+      "totaldisk":1700,
+      "port":8985}},
+"clusterstate":{"c1":{
+  "router":{"name":"compositeId"},
+  "maxShardsPerNode":-1,
+  "shards":{
+    "s1":{"replicas":{
+      "r1":{
+        "type":"NRT",
+        "node_name":"node1:8983",
+        "state":"active",
+        "leader":"true"},
+      "r2":{
+        "type":"NRT",
+        "node_name":"node1:8983",
+        "state":"active"}}},
+    "s2":{"replicas":{
+      "r1":{
+        "type":"NRT",
+        "node_name":"node1:8983",
+        "state":"active",
+        "leader":"true"},
+      "r2":{
+        "type":"NRT",
+        "node_name":"node1:8983",
+        "state":"active"}}}}}}}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testComputePlanAfterNodeAdded.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testComputePlanAfterNodeAdded.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testComputePlanAfterNodeAdded.json
new file mode 100644
index 0000000..2171c38
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testComputePlanAfterNodeAdded.json
@@ -0,0 +1,16 @@
+{
+  "liveNodes":["127.0.0.1:51078_solr",
+    "127.0.0.1:51147_solr"],
+  "replicaInfo":{
+    "127.0.0.1:51147_solr":{},
+    "127.0.0.1:51078_solr":{"testNodeAdded":{"shard1":[{"core_node3":{"type":"NRT"}},
+      {"core_node4":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "127.0.0.1:51147_solr":{
+      "node":"127.0.0.1:51147_solr",
+      "cores":0,
+      "freedisk":880.5428657531738},
+    "127.0.0.1:51078_solr":{
+      "node":"127.0.0.1:51078_solr",
+      "cores":2,
+      "freedisk":880.5428695678711}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testCoresSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testCoresSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testCoresSuggestions.json
new file mode 100644
index 0000000..a6901db
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testCoresSuggestions.json
@@ -0,0 +1,17 @@
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{
+      "shard1":[{"core_node1":{"type":"NRT"}}],
+      "shard2":[{"core_node2":{"type":"NRT"}}],
+      "shard3":[{"core_node3":{"type":"NRT"}}],
+      "shard4":[{"core_node4":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":4}}}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testDiskSpaceHint.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testDiskSpaceHint.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testDiskSpaceHint.json
new file mode 100644
index 0000000..edfcf7f
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testDiskSpaceHint.json
@@ -0,0 +1,16 @@
+{
+  "liveNodes":["127.0.0.1:51078_solr",
+    "127.0.0.1:51147_solr"],
+  "replicaInfo":{
+    "127.0.0.1:51147_solr":{},
+    "127.0.0.1:51078_solr":{"testNodeAdded":{"shard1":[{"core_node3":{"type":"NRT"}},
+      {"core_node4":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "127.0.0.1:51147_solr":{
+      "node":"127.0.0.1:51147_solr",
+      "cores":0,
+      "freedisk":100},
+    "127.0.0.1:51078_solr":{
+      "node":"127.0.0.1:51078_solr",
+      "cores":2,
+      "freedisk":200}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testEqualOnNonNode.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testEqualOnNonNode.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testEqualOnNonNode.json
new file mode 100644
index 0000000..c2dc13d
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testEqualOnNonNode.json
@@ -0,0 +1,83 @@
+[{"coll1":{
+  "router":{"name":"compositeId"},
+  "shards":{
+    "shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{//east
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active"},
+        "r2":{//west
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"}}},
+    "shard2":{
+      "range":"0-7fffffff",
+      "replicas":{
+        "r3":{//east
+          "core":"r3",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active"},
+        "r4":{//west
+          "core":"r4",
+          "base_url":"http://10.0.0.4:8987/solr",
+          "node_name":"node4",
+          "state":"active"},
+        "r6":{//east
+          "core":"r6",
+          "base_url":"http://10.0.0.4:8989/solr",
+          "node_name":"node3",
+          "state":"active"},
+        "r5":{//east
+          "core":"r5",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active"}}}}}},
+  {"nodeValues":{
+    "node1":{
+      "cores":3,
+      "freedisk":700,
+      "totaldisk":1000,
+      "sysprop.zone":"east"},
+    "node2":{
+      "cores":1,
+      "freedisk":900,
+      "totaldisk":1000,
+      "sysprop.zone":"west"},
+    "node3":{
+      "cores":1,
+      "freedisk":900,
+      "totaldisk":1000,
+      "sysprop.zone":"east"},
+    "node4":{
+      "cores":1,
+      "freedisk":900,
+      "totaldisk":1000,
+      "sysprop.zone":"west"},
+    "node5":{
+      "cores":0,
+      "freedisk":1000,
+      "totaldisk":1000,
+      "sysprop.zone":"west"}},
+  "replicaValues":[{
+    "INDEX.sizeInGB":100,
+    "core":"r1"},
+    {
+      "INDEX.sizeInGB":100,
+      "core":"r2"},
+    {
+      "INDEX.sizeInGB":100,
+      "core":"r3"},
+    {
+      "INDEX.sizeInGB":100,
+      "core":"r4"},
+    {
+      "INDEX.sizeInGB":100,
+      "core":"r5"},
+    {
+      "INDEX.sizeInGB":100,
+      "core":"r6"}]}]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreeDiskSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreeDiskSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreeDiskSuggestions.json
new file mode 100644
index 0000000..2b8897b
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreeDiskSuggestions.json
@@ -0,0 +1,27 @@
+{
+  "liveNodes":["node1",
+    "node2"],
+  "replicaInfo":{
+    "node1":{},
+    "node2":{"mycoll1":{
+      "shard1":[{"r1":{
+        "type":"NRT",
+        "INDEX.sizeInGB":900}}],
+      "shard2":[{"r2":{
+        "type":"NRT",
+        "INDEX.sizeInGB":300}}],
+      "shard3":[{"r3":{
+        "type":"NRT",
+        "INDEX.sizeInGB":200}}],
+      "shard4":[{"r4":{
+        "type":"NRT",
+        "INDEX.sizeInGB":100}}]}}},
+  "nodeValues":{
+    "node1":{
+      "node":"node1",
+      "cores":0,
+      "freedisk":2000},
+    "node2":{
+      "node":"node2",
+      "cores":4,
+      "freedisk":500}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreediskPercentage.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreediskPercentage.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreediskPercentage.json
new file mode 100644
index 0000000..174f862
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testFreediskPercentage.json
@@ -0,0 +1,25 @@
+{
+  "liveNodes":["node1:8983",
+    "node2:8984",
+    "node3:8985"],
+  "replicaInfo":{"node1:8983":{"c1":{
+    "s1":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}],
+    "s2":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "node1:8983":{
+      "cores":4,
+      "freedisk":230,
+      "totaldisk":800,
+      "port":8983},
+    "node2:8984":{
+      "cores":0,
+      "freedisk":1000,
+      "totaldisk":1200,
+      "port":8984},
+    "node3:8985":{
+      "cores":0,
+      "freedisk":1500,
+      "totaldisk":1700,
+      "port":8985}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testMoveReplicaSuggester.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testMoveReplicaSuggester.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testMoveReplicaSuggester.json
new file mode 100644
index 0000000..e45c87f
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testMoveReplicaSuggester.json
@@ -0,0 +1,15 @@
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{
+      "shard2":[{"core_node2":{"type":"NRT"}}],
+      "shard1":[{"core_node1":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":2}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testPolicy.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testPolicy.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testPolicy.json
new file mode 100644
index 0000000..373607e
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testPolicy.json
@@ -0,0 +1,41 @@
+{"gettingstarted":{
+  "router":{"name":"compositeId"},
+  "shards":{
+    "shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"}}},
+    "shard2":{
+      "range":"0-7fffffff",
+      "replicas":{
+        "r3":{
+          "core":"r3",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r4":{
+          "core":"r4",
+          "base_url":"http://10.0.0.4:8987/solr",
+          "node_name":"node4",
+          "state":"active"},
+        "r6":{
+          "core":"r6",
+          "base_url":"http://10.0.0.4:8989/solr",
+          "node_name":"node3",
+          "state":"active"},
+        "r5":{
+          "core":"r5",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active"}}}}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testPortSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testPortSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testPortSuggestions.json
new file mode 100644
index 0000000..f518de1
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testPortSuggestions.json
@@ -0,0 +1,22 @@
+{
+  "liveNodes":["node1:8983",
+    "node2:8984",
+    "node3:8985"],
+  "replicaInfo":{"node1:8983":{"c1":{
+    "s1":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}],
+    "s2":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "node1:8983":{
+      "cores":4,
+      "freedisk":334,
+      "port":8983},
+    "node2:8984":{
+      "cores":0,
+      "freedisk":1000,
+      "port":8984},
+    "node3:8985":{
+      "cores":0,
+      "freedisk":1500,
+      "port":8985}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaCountSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaCountSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaCountSuggestions.json
new file mode 100644
index 0000000..e45c87f
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaCountSuggestions.json
@@ -0,0 +1,15 @@
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{
+      "shard2":[{"core_node2":{"type":"NRT"}}],
+      "shard1":[{"core_node1":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":2}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaPercentage.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaPercentage.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaPercentage.json
new file mode 100644
index 0000000..a6b3801
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaPercentage.json
@@ -0,0 +1,46 @@
+[{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{"shard1":[{"core_node1":{"type":"NRT"}},
+      {"core_node2":{"type":"NRT"}},
+      {"core_node3":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":3}}},
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{
+      "shard2":[{"core_node2":{"type":"NRT"}}],
+      "shard1":[{"core_node1":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":2}}},
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{"mycoll1":{
+      "shard1":[{"core_node3":{"type":"PULL"}}],
+      "shard3":[{"core_node2":{"type":"TLOG"}}],
+      "shard2":[{"core_node1":{"type":"TLOG"}}]}}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":2}}}]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaZonesPercentage.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaZonesPercentage.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaZonesPercentage.json
new file mode 100644
index 0000000..eb4e3a8
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testReplicaZonesPercentage.json
@@ -0,0 +1,15 @@
+{
+  "liveNodes":["10.0.0.6:7574_solr",
+    "10.0.0.6:8983_solr"],
+  "replicaInfo":{
+    "10.0.0.6:7574_solr":{},
+    "10.0.0.6:8983_solr":{}},
+  "nodeValues":{
+    "10.0.0.6:7574_solr":{
+      "node":"10.0.0.6:7574_solr",
+      "cores":0,
+      "sysprop.az":"west"},
+    "10.0.0.6:8983_solr":{
+      "node":"10.0.0.6:8983_solr",
+      "cores":0,
+      "sysprop.az":"east"}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testSyspropSuggestions1.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testSyspropSuggestions1.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSyspropSuggestions1.json
new file mode 100644
index 0000000..085fe60
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testSyspropSuggestions1.json
@@ -0,0 +1,24 @@
+{
+  "liveNodes":["node1",
+    "node2",
+    "node3"],
+  "replicaInfo":{"node1":{"c1":{
+    "s1":[{
+      "r1":{"type":"NRT"},
+      "r2":{"type":"NRT"}}],
+    "s2":[{
+      "r1":{"type":"NRT"},
+      "r2":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "node1":{
+      "cores":2,
+      "freedisk":334,
+      "sysprop.fs":"slowdisk"},
+    "node2":{
+      "cores":2,
+      "freedisk":749,
+      "sysprop.fs":"slowdisk"},
+    "node3":{
+      "cores":0,
+      "freedisk":262,
+      "sysprop.fs":"ssd"}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testViolationOutput.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testViolationOutput.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testViolationOutput.json
new file mode 100644
index 0000000..f518de1
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testViolationOutput.json
@@ -0,0 +1,22 @@
+{
+  "liveNodes":["node1:8983",
+    "node2:8984",
+    "node3:8985"],
+  "replicaInfo":{"node1:8983":{"c1":{
+    "s1":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}],
+    "s2":[{"r1":{"type":"NRT"}},
+      {"r2":{"type":"NRT"}}]}}},
+  "nodeValues":{
+    "node1:8983":{
+      "cores":4,
+      "freedisk":334,
+      "port":8983},
+    "node2:8984":{
+      "cores":0,
+      "freedisk":1000,
+      "port":8984},
+    "node3:8985":{
+      "cores":0,
+      "freedisk":1500,
+      "port":8985}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollection.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollection.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollection.json
new file mode 100644
index 0000000..d171998
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollection.json
@@ -0,0 +1,21 @@
+{
+  "comments_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{},
+    "withCollection":"articles_coll"},
+  "articles_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"}}}}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveReplica.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveReplica.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveReplica.json
new file mode 100644
index 0000000..469eef1
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveReplica.json
@@ -0,0 +1,28 @@
+{
+  "comments_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{"r1":{
+        "core":"r1",
+        "base_url":"http://10.0.0.4:8983/solr",
+        "node_name":"node1",
+        "state":"active",
+        "leader":"true"}}}},
+    "withCollection":"articles_coll"},
+  "articles_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"}}}}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveVsAddSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveVsAddSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveVsAddSuggestions.json
new file mode 100644
index 0000000..0d99d4a
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionMoveVsAddSuggestions.json
@@ -0,0 +1,49 @@
+{
+  "articles_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"},
+        "r3":{
+          "core":"r3",
+          "base_url":"http://10.0.0.4:7579/solr",
+          "node_name":"node6",
+          "state":"active"}}}}},
+  "comments_coll":{
+    "withCollection":"articles_coll",
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:7576/solr",
+          "node_name":"node3",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7577/solr",
+          "node_name":"node4",
+          "state":"active"},
+        "r3":{
+          "core":"r3",
+          "base_url":"http://10.0.0.4:7578/solr",
+          "node_name":"node5",
+          "state":"active"},
+        "r4":{
+          "core":"r4",
+          "base_url":"http://10.0.0.4:7579/solr",
+          "node_name":"node6",
+          "state":"active"}}}}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionSuggestions.json
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionSuggestions.json b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionSuggestions.json
new file mode 100644
index 0000000..c4a29db
--- /dev/null
+++ b/solr/solrj/src/test-files/solrj/solr/autoscaling/testWithCollectionSuggestions.json
@@ -0,0 +1,21 @@
+{
+  "articles_coll":{
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{}}},
+  "comments_coll":{
+    "withCollection":"articles_coll",
+    "router":{"name":"compositeId"},
+    "shards":{"shard1":{
+      "range":"80000000-ffffffff",
+      "replicas":{
+        "r1":{
+          "core":"r1",
+          "base_url":"http://10.0.0.4:8983/solr",
+          "node_name":"node1",
+          "state":"active",
+          "leader":"true"},
+        "r2":{
+          "core":"r2",
+          "base_url":"http://10.0.0.4:7574/solr",
+          "node_name":"node2",
+          "state":"active"}}}}}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/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 fc0806b..64ba357 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
@@ -21,7 +21,6 @@ package org.apache.solr.client.solrj.cloud.autoscaling;
 import java.io.IOException;
 import java.io.StringWriter;
 import java.lang.invoke.MethodHandles;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -77,9 +76,11 @@ import org.slf4j.LoggerFactory;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.solr.client.solrj.cloud.autoscaling.Policy.CLUSTER_PREFERENCES;
+import static org.apache.solr.client.solrj.cloud.autoscaling.TestPolicy2.loadFromResource;
 import static org.apache.solr.client.solrj.cloud.autoscaling.Variable.Type.CORES;
 import static org.apache.solr.client.solrj.cloud.autoscaling.Variable.Type.FREEDISK;
 import static org.apache.solr.client.solrj.cloud.autoscaling.Variable.Type.REPLICA;
+import static org.apache.solr.common.cloud.ZkStateReader.CLUSTER_STATE;
 import static org.apache.solr.common.params.CollectionParams.CollectionAction.ADDREPLICA;
 import static org.apache.solr.common.params.CollectionParams.CollectionAction.MOVEREPLICA;
 
@@ -107,47 +108,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     return cloudManagerWithData(jsonObj);
   }
 
-  public static String clusterState = "{'gettingstarted':{" +
-      "    'router':{'name':'compositeId'}," +
-      "    'shards':{" +
-      "      'shard1':{" +
-      "        'range':'80000000-ffffffff'," +
-      "        'replicas':{" +
-      "          'r1':{" +
-      "            'core':r1," +
-      "            'base_url':'http://10.0.0.4:8983/solr'," +
-      "            'node_name':'node1'," +
-      "            'state':'active'," +
-      "            'leader':'true'}," +
-      "          'r2':{" +
-      "            'core':r2," +
-      "            'base_url':'http://10.0.0.4:7574/solr'," +
-      "            'node_name':'node2'," +
-      "            'state':'active'}}}," +
-      "      'shard2':{" +
-      "        'range':'0-7fffffff'," +
-      "        'replicas':{" +
-      "          'r3':{" +
-      "            'core':r3," +
-      "            'base_url':'http://10.0.0.4:8983/solr'," +
-      "            'node_name':'node1'," +
-      "            'state':'active'," +
-      "            'leader':'true'}," +
-      "          'r4':{" +
-      "            'core':r4," +
-      "            'base_url':'http://10.0.0.4:8987/solr'," +
-      "            'node_name':'node4'," +
-      "            'state':'active'}," +
-      "          'r6':{" +
-      "            'core':r6," +
-      "            'base_url':'http://10.0.0.4:8989/solr'," +
-      "            'node_name':'node3'," +
-      "            'state':'active'}," +
-      "          'r5':{" +
-      "            'core':r5," +
-      "            'base_url':'http://10.0.0.4:8983/solr'," +
-      "            'node_name':'node1'," +
-      "            'state':'active'}}}}}}";
+  public static String clusterState = Utils.toJSONString(loadFromResource("testPolicy.json"));
 
   public static Map<String, Map<String, List<ReplicaInfo>>> getReplicaDetails(String node, Map clusterState) {
     ValidatingJsonMap m = ValidatingJsonMap
@@ -174,42 +135,9 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
 
   public void testWithCollection() {
-    String clusterStateStr = "{" +
-        "  'comments_coll':{" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards':{}," +
-        "    'withCollection' :'articles_coll'" +
-        "  }," +
-        "  'articles_coll': {" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }," +
-        "          'r2': {" +
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7574/solr'," +
-        "            'node_name': 'node2'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }" +
-        "}";
-    ClusterState clusterState = ClusterState.load(1, clusterStateStr.getBytes(UTF_8),
-        ImmutableSet.of("node1", "node2", "node3", "node4", "node5"));
+    ClusterState clusterState = ClusterState.load(1,
+        (Map) loadFromResource("testWithCollection.json"),
+        ImmutableSet.of("node1", "node2", "node3", "node4", "node5"), CLUSTER_STATE);
     DelegatingClusterStateProvider clusterStateProvider = new DelegatingClusterStateProvider(null) {
       @Override
       public ClusterState getClusterState() throws IOException {
@@ -298,42 +226,10 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testWithCollectionSuggestions() {
-    String clusterStateStr = "{" +
-        "  'articles_coll':{" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards':{'shard1':{}}," +
-        "  }," +
-        "  'comments_coll': {" +
-        "    'withCollection' :'articles_coll'," +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }," +
-        "          'r2': {" +
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7574/solr'," +
-        "            'node_name': 'node2'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }" +
-        "}";
-    ClusterState clusterState = ClusterState.load(1, clusterStateStr.getBytes(UTF_8),
-        ImmutableSet.of("node1", "node2", "node3", "node4", "node5"));
+    ClusterState clusterState =
+        ClusterState.load(1,
+            (Map) loadFromResource("testWithCollectionSuggestions.json"),
+            ImmutableSet.of("node1", "node2", "node3", "node4", "node5"), CLUSTER_STATE);
     DelegatingClusterStateProvider clusterStateProvider = new DelegatingClusterStateProvider(null) {
       @Override
       public ClusterState getClusterState() throws IOException {
@@ -421,83 +317,15 @@ public class TestPolicy extends SolrTestCaseJ4 {
     assertTrue(nodes.contains("node2"));
   }
 
-  public void testWithCollectionMoveVsAddSuggestions() {
-    String clusterStateStr = "{" +
-        "  'articles_coll':{" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }," +
-        "          'r2': {" +
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7574/solr'," +
-        "            'node_name': 'node2'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r3': {" +
-        "            'core': 'r3'," +
-        "            'base_url': 'http://10.0.0.4:7579/solr'," +
-        "            'node_name': 'node6'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }," +
-        "  'comments_coll': {" +
-        "    'withCollection' :'articles_coll'," +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:7576/solr'," +
-        "            'node_name': 'node3'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }," +
-        "          'r2': {" +
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7577/solr'," +
-        "            'node_name': 'node4'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r3': {" +
-        "            'core': 'r3'," +
-        "            'base_url': 'http://10.0.0.4:7578/solr'," +
-        "            'node_name': 'node5'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r4': {" +
-        "            'core': 'r4'," +
-        "            'base_url': 'http://10.0.0.4:7579/solr'," +
-        "            'node_name': 'node6'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }" +
-        "}";
-    ClusterState clusterState = ClusterState.load(1, clusterStateStr.getBytes(UTF_8),
-        ImmutableSet.of("node1", "node2", "node3", "node4", "node5", "node6"));
+  public void testWithCollectionMoveVsAddSuggestions() throws IOException {
+    ClusterState clusterState = ClusterState.load(1,
+        (Map) loadFromResource("testWithCollectionMoveVsAddSuggestions.json"),
+        ImmutableSet.of("node1", "node2", "node3", "node4", "node5", "node6"),
+        CLUSTER_STATE
+    );
     DelegatingClusterStateProvider clusterStateProvider = new DelegatingClusterStateProvider(null) {
       @Override
-      public ClusterState getClusterState() throws IOException {
+      public ClusterState getClusterState() {
         return clusterState;
       }
 
@@ -598,55 +426,9 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testWithCollectionMoveReplica() {
-    String clusterStateStr = "{" +
-        "  'comments_coll':{" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards':{" +
-        "       'shard1' : {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }" +
-        "         }" +
-        "       }" +
-        "     }," +
-        "    'withCollection' :'articles_coll'" +
-        "  }," +
-        "  'articles_coll': {" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'," +
-        "            'leader': 'true'" +
-        "          }," +
-        "          'r2': {" +
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7574/solr'," +
-        "            'node_name': 'node2'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }" +
-        "}";
-    ClusterState clusterState = ClusterState.load(1, clusterStateStr.getBytes(UTF_8),
-        ImmutableSet.of("node2", "node3", "node4", "node5"));
+    ClusterState clusterState = ClusterState.load(1,
+        (Map) loadFromResource("testWithCollectionMoveReplica.json"),
+        ImmutableSet.of("node2", "node3", "node4", "node5"), CLUSTER_STATE);
     DelegatingClusterStateProvider clusterStateProvider = new DelegatingClusterStateProvider(null) {
       @Override
       public ClusterState getClusterState() throws IOException {
@@ -1342,7 +1124,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
         return new DelegatingClusterStateProvider(null) {
           @Override
           public ClusterState getClusterState() throws IOException {
-            return ClusterState.load(0,new HashMap<>(), getLiveNodes(),"/clusterstate.json");
+            return ClusterState.load(0, new HashMap<>(), getLiveNodes(), CLUSTER_STATE);
           }
 
           @Override
@@ -1444,7 +1226,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "}");
     Policy policy = new Policy(new HashMap<>());
     Suggester suggester = policy.createSession(getSolrCloudManager(nodeValues,
-        (Map<String, Object>) TestPolicy2.loadFromResource("testMoveReplicasInMultipleCollections.json")))
+        (Map<String, Object>) loadFromResource("testMoveReplicasInMultipleCollections.json")))
         .getSuggester(MOVEREPLICA)
         .hint(Hint.COLL, "collection1")
         .hint(Hint.COLL, "collection2")
@@ -2189,29 +1971,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testMoveReplicaSuggester() {
-    String dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard2':[{'core_node2':{'type':'NRT'}}]," +
-        "        'shard1':[{'core_node1':{'type':'NRT'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':2}}}";
     String autoScalingjson = "  '{cluster-policy':[" +
         "    {      'cores':'<10',      'node':'#ANY'}," +
         "    {      'replica':'<2',      'shard':'#EACH',      'node':'#ANY'}," +
         "    {      'nodeRole':'overseer','replica':0}]," +
         "  'cluster-preferences':[{'minimize':'cores'}]}";
     Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    Policy.Session session = policy.createSession(cloudManagerWithData(dataproviderdata));
+    Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testMoveReplicaSuggester.json")));
     Suggester suggester = session.getSuggester(MOVEREPLICA).hint(Hint.TARGET_NODE, "10.0.0.6:7574_solr");
     SolrRequest op = suggester.getSuggestion();
     assertNotNull(op);
@@ -2221,26 +1987,6 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testComputePlanAfterNodeAdded() {
-
-    String dataproviderdata = "{" +
-        "     liveNodes:[" +
-        "       '127.0.0.1:51078_solr'," +
-        "       '127.0.0.1:51147_solr']," +
-        "     replicaInfo:{" +
-        "       '127.0.0.1:51147_solr':{}," +
-        "       '127.0.0.1:51078_solr':{testNodeAdded:{shard1:[" +
-        "             { core_node3 : { type : NRT}}," +
-        "             { core_node4 : { type : NRT}}]}}}," +
-        "     nodeValues:{" +
-        "       '127.0.0.1:51147_solr':{" +
-        "         node:'127.0.0.1:51147_solr'," +
-        "         cores:0," +
-        "         freedisk : 880.5428657531738}," +
-        "       '127.0.0.1:51078_solr':{" +
-        "         node:'127.0.0.1:51078_solr'," +
-        "         cores:2," +
-        "         freedisk:880.5428695678711}}}";
-
     String autoScalingjson = "cluster-preferences:[" +
         "       {minimize : cores}," +
         "       {'maximize':freedisk , precision:100}],    " +
@@ -2248,7 +1994,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "       {replica:'<2', shard:'#EACH',node:'#ANY'}," +
         "       { nodeRole:overseer,replica:0}]}";
     Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    Policy.Session session = policy.createSession(cloudManagerWithData(dataproviderdata));
+    Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testComputePlanAfterNodeAdded.json")));
     Suggester suggester = session.getSuggester(CollectionParams.CollectionAction.MOVEREPLICA)
         .hint(Hint.TARGET_NODE, "127.0.0.1:51147_solr");
     SolrRequest op = suggester.getSuggestion();
@@ -2257,29 +2003,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testReplicaCountSuggestions() {
-    String dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard2':[{'core_node2':{'type':'NRT'}}]," +
-        "        'shard1':[{'core_node1':{'type':'NRT'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':2}}}";
     String autoScalingjson = "  { cluster-policy:[" +
         "    { cores :'<10', node :'#ANY'}," +
         "    { replica :'<2',  node:'#ANY'}," +
         "    { nodeRole : overseer, replica :0}]," +
         "  cluster-preferences :[{ minimize : cores }]}";
     List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson)),
-        cloudManagerWithData(dataproviderdata));
+        cloudManagerWithData((Map) loadFromResource("testReplicaCountSuggestions.json")));
     assertFalse(l.isEmpty());
 
     assertEquals(1.0d, l.get(0)._get( "violation/violation/delta",null));
@@ -2292,28 +2022,14 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
 
   public void testReplicaPercentage() {
-    String dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard1':[{'core_node1':{'type':'NRT'}},{'core_node2':{'type':'NRT'}},{'core_node3':{'type':'NRT'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':3}}}";
+    List<Map> l = (List<Map>) loadFromResource("testReplicaPercentage.json");
     String autoScalingjson = "  { cluster-policy:[" +
         "    { replica :'51%', shard:'#EACH', node:'#ANY'}]," +
         "  cluster-preferences :[{ minimize : cores }]}";
 
 
     AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    Policy.Session session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(dataproviderdata));
+    Policy.Session session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(l.get(0)));
     List<Violation> violations = session.getViolations();
     assertEquals(2, violations.size());
     for (Violation violation : violations) {
@@ -2327,82 +2043,27 @@ public class TestPolicy extends SolrTestCaseJ4 {
     }
 
 
-    dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard2':[{'core_node2':{'type':'NRT'}}]," +
-        "        'shard1':[{'core_node1':{'type':'NRT'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':2}}}";
-
-    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(dataproviderdata));
+    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(Utils.getDeepCopy(l.get(1), 6)));
     violations = session.getViolations();
     assertEquals(0, violations.size());
     autoScalingjson = "  { cluster-policy:[" +
         "    { replica :'51%', shard: '#EACH' , node:'#ANY'}]," +
         "  cluster-preferences :[{ minimize : cores }]}";
     autoScalingConfig = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(dataproviderdata));
+    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(l.get(1)));
     violations = session.getViolations();
     assertEquals(0, violations.size());
-
-    dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard1':[{'core_node4':{'type':'PULL'}}]," +
-        "        'shard1':[{'core_node3':{'type':'PULL'}}]," +
-        "        'shard3':[{'core_node2':{'type':'TLOG'}}]," +
-        "        'shard2':[{'core_node1':{'type':'TLOG'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':2}}}";
     autoScalingjson = "  { cluster-policy:[" +
         "    { replica :'50%',node:'#ANY' , type: TLOG } ,{ replica :'50%',node:'#ANY' , type: PULL } ]," +
         "  cluster-preferences :[{ minimize : cores }]}";
     autoScalingConfig = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(dataproviderdata));
+    session = autoScalingConfig.getPolicy().createSession(cloudManagerWithData(l.get(2)));
     violations = session.getViolations();
     assertEquals(2, violations.size());
 
   }
 
   public void testReplicaZonesPercentage() {
-    String dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0," +
-        "      'sysprop.az': 'west'" +
-        "    }," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':0," +
-        "      'sysprop.az': 'east'    " +
-        "    }}}";
-
     String autoScalingjson = "  { cluster-policy:[" +
         "    { replica :'33%', shard: '#EACH', sysprop.az : east}," +
         "    { replica :'67%', shard: '#EACH', sysprop.az : west}" +
@@ -2413,7 +2074,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
     AutoScalingConfig autoScalingConfig = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
 
     Policy.Transaction txn = new Policy.Transaction(autoScalingConfig.getPolicy());
-    txn.open(cloudManagerWithData(dataproviderdata));
+    txn.open(cloudManagerWithData((Map<String, Object>) loadFromResource("testReplicaZonesPercentage.json")));
 
     List<String> nodes = new ArrayList<>();
 
@@ -2448,8 +2109,9 @@ public class TestPolicy extends SolrTestCaseJ4 {
     assertEquals(4, count.get());
 
   }
-  public void testFreeDiskDeviation() throws IOException {
-    Map map = (Map) TestPolicy2.loadFromResource("testFreeDiskDeviation.json");
+
+  public void testFreeDiskDeviation() {
+    Map map = (Map) loadFromResource("testFreeDiskDeviation.json");
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) map.get("config"));
     SolrCloudManager scm = cloudManagerWithData(map);
     Suggester suggester = cfg.getPolicy()
@@ -2483,26 +2145,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
 
   public void testFreeDiskSuggestions() {
-    String dataproviderdata = "{" +
-        "  liveNodes:[node1,node2]," +
-        "  replicaInfo : {" +
-        "    node1:{}," +
-        "    node2:{mycoll1:{" +
-        "        shard1:[{r1:{type:NRT, INDEX.sizeInGB:900}}]," +
-        "        shard2:[{r2:{type:NRT, INDEX.sizeInGB:300}}]," +
-        "        shard3:[{r3:{type:NRT, INDEX.sizeInGB:200}}]," +
-        "        shard4:[{r4:{type:NRT, INDEX.sizeInGB:100}}]}}}" +
-        "    nodeValues : {" +
-        "    node1: { node : node1 , cores:0 , freedisk : 2000}," +
-        "    node2: { node : node2 , cores:4 , freedisk : 500}}}";
-
-
     String autoScalingjson = "  { cluster-policy:[" +
         "    { replica :'0', freedisk:'<1000'}," +
         "    { nodeRole : overseer, replica :0}]," +
         "  cluster-preferences :[{ minimize : cores, precision : 2 }]}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testFreeDiskSuggestions.json"))).getViolations();
     assertEquals(1, violations.size());
     assertEquals(4, violations.get(0).getViolatingReplicas().size());
     assertEquals(4, violations.get(0).replicaCountDelta, 0.1);
@@ -2511,7 +2159,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
     }
 
-    List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(cfg, cloudManagerWithData(dataproviderdata));
+    List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(cfg, cloudManagerWithData((Map) loadFromResource("testFreeDiskSuggestions.json")));
     assertEquals(3, l.size());
     assertEquals("r4", l.get(0)._get("operation/command/move-replica/replica", null));
     assertEquals("node1", l.get(0)._get("operation/command/move-replica/targetNode", null));
@@ -2528,13 +2176,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "    { nodeRole : overseer, replica :0}]," +
         "  cluster-preferences :[{ minimize : cores, precision : 2 }]}";
     cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
+    violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testFreeDiskSuggestions.json"))).getViolations();
     assertEquals(1, violations.size());
     assertEquals(-4, violations.get(0).replicaCountDelta, 0.1);
     assertEquals(1, violations.size());
     assertEquals(0, violations.get(0).getViolatingReplicas().size());
 
-    l = PolicyHelper.getSuggestions(cfg, cloudManagerWithData(dataproviderdata));
+    l = PolicyHelper.getSuggestions(cfg, cloudManagerWithData((Map) loadFromResource("testFreeDiskSuggestions.json")));
     assertEquals(4, l.size());
     assertEquals("r4", l.get(0)._get("operation/command/move-replica/replica", null));
     assertEquals("node1", l.get(0)._get("operation/command/move-replica/targetNode", null));
@@ -2552,34 +2200,16 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
 
   public void testCoresSuggestions() {
-    String dataproviderdata = "{" +
-        "  'liveNodes':[" +
-        "    '10.0.0.6:7574_solr'," +
-        "    '10.0.0.6:8983_solr']," +
-        "  'replicaInfo':{" +
-        "    '10.0.0.6:7574_solr':{}," +
-        "    '10.0.0.6:8983_solr':{'mycoll1':{" +
-        "        'shard1':[{'core_node1':{'type':'NRT'}}]," +
-        "        'shard2':[{'core_node2':{'type':'NRT'}}]," +
-        "        'shard3':[{'core_node3':{'type':'NRT'}}]," +
-        "        'shard4':[{'core_node4':{'type':'NRT'}}]}}}," +
-        "  'nodeValues':{" +
-        "    '10.0.0.6:7574_solr':{" +
-        "      'node':'10.0.0.6:7574_solr'," +
-        "      'cores':0}," +
-        "    '10.0.0.6:8983_solr':{" +
-        "      'node':'10.0.0.6:8983_solr'," +
-        "      'cores':4}}}";
     String autoScalingjson = "  { cluster-policy:[" +
         "    { cores :'<3', node :'#ANY'}]," +
         "  cluster-preferences :[{ minimize : cores }]}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testCoresSuggestions.json"))).getViolations();
     assertFalse(violations.isEmpty());
     assertEquals(2L, violations.get(0).replicaCountDelta.longValue());
 
     List<Suggester.SuggestionInfo> l = PolicyHelper.getSuggestions(cfg,
-        cloudManagerWithData(dataproviderdata));
+        cloudManagerWithData((Map) loadFromResource("testCoresSuggestions.json")));
     assertEquals(2, l.size());
     for (Suggester.SuggestionInfo suggestionInfo : l) {
       assertEquals("10.0.0.6:7574_solr", suggestionInfo._get("operation/command/move-replica/targetNode", null));
@@ -2589,7 +2219,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
   }
 
-  public void testSyspropSuggestions() {
+  public void testSyspropSuggestions1() {
     String autoScalingjson = "{" +
         "  'cluster-preferences': [" +
         "    { 'maximize': 'freedisk', 'precision': 50}," +
@@ -2601,28 +2231,10 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "}";
 
 
-    String dataproviderdata = "{" +
-        "  'liveNodes': [" +
-        "    'node1'," +
-        "    'node2'," +
-        "    'node3'" +
-        "  ]," +
-        "  'replicaInfo': {" +
-        "    'node1': {" +
-        "      'c1': {'s1': [{'r1': {'type': 'NRT'}, 'r2': {'type': 'NRT'}}]," +
-        "             's2': [{'r1': {'type': 'NRT'}, 'r2': {'type': 'NRT'}}]}," +
-        "    }" +
-        "  }," +
-        "    'nodeValues': {" +
-        "      'node1': {'cores': 2, 'freedisk': 334, 'sysprop.fs': 'slowdisk'}," +
-        "      'node2': {'cores': 2, 'freedisk': 749, 'sysprop.fs': 'slowdisk'}," +
-        "      'node3': {'cores': 0, 'freedisk': 262, 'sysprop.fs': 'ssd'}" +
-        "    }" +
-        "}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testSyspropSuggestions1.json"))).getViolations();
     assertEquals("expected 2 violations", 2, violations.size());
-    List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(cfg, cloudManagerWithData(dataproviderdata));
+    List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(cfg, cloudManagerWithData((Map) loadFromResource("testSyspropSuggestions1.json")));
     assertEquals(2, suggestions.size());
     for (Suggester.SuggestionInfo suggestion : suggestions) {
       suggestion._get("operation/move-replica/targetNode", null);
@@ -2640,49 +2252,10 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "  ]" +
         "}";
 
-
-    String dataproviderdata = "{" +
-        "  'liveNodes': [" +
-        "    'node1:8983'," +
-        "    'node2:8984'," +
-        "    'node3:8985'" +
-        "  ]," +
-        "  'replicaInfo': {" +
-        "    'node1:8983': {" +
-        "      'c1': {" +
-        "        's1': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]," +
-        "        's2': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]" +
-        "      }" +
-        "    }" +
-        "  }," +
-        "  'nodeValues': {" +
-        "    'node1:8983': {" +
-        "      'cores': 4," +
-        "      'freedisk': 334," +
-        "      'port': 8983" +
-        "    }," +
-        "    'node2:8984': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1000," +
-        "      'port': 8984" +
-        "    }," +
-        "    'node3:8985': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1500," +
-        "      'port': 8985" +
-        "    }" +
-        "  }" +
-        "}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData(dataproviderdata)).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testPortSuggestions.json"))).getViolations();
     assertEquals(2, violations.size());
-    List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(cfg, cloudManagerWithData(dataproviderdata));
+    List<Suggester.SuggestionInfo> suggestions = PolicyHelper.getSuggestions(cfg, cloudManagerWithData((Map) loadFromResource("testPortSuggestions.json")));
     assertEquals(4, suggestions.size());
     for (Suggester.SuggestionInfo suggestionInfo : suggestions) {
       assertEquals(suggestionInfo.operation.getPath(), "/c/c1");
@@ -2690,33 +2263,13 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testDiskSpaceHint() {
-
-    String dataproviderdata = "{" +
-        "     liveNodes:[" +
-        "       '127.0.0.1:51078_solr'," +
-        "       '127.0.0.1:51147_solr']," +
-        "     replicaInfo:{" +
-        "       '127.0.0.1:51147_solr':{}," +
-        "       '127.0.0.1:51078_solr':{testNodeAdded:{shard1:[" +
-        "             { core_node3 : { type : NRT}}," +
-        "             { core_node4 : { type : NRT}}]}}}," +
-        "     nodeValues:{" +
-        "       '127.0.0.1:51147_solr':{" +
-        "         node:'127.0.0.1:51147_solr'," +
-        "         cores:0," +
-        "         freedisk : 100}," +
-        "       '127.0.0.1:51078_solr':{" +
-        "         node:'127.0.0.1:51078_solr'," +
-        "         cores:2," +
-        "         freedisk:200}}}";
-
     String autoScalingjson = "cluster-preferences:[" +
         "       {minimize : cores}]" +
         " cluster-policy:[{cores:'<10',node:'#ANY'}," +
         "       {replica:'<2', shard:'#EACH',node:'#ANY'}," +
         "       { nodeRole:overseer,replica:0}]}";
     Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    Policy.Session session = policy.createSession(cloudManagerWithData(dataproviderdata));
+    Policy.Session session = policy.createSession(cloudManagerWithData((Map) loadFromResource("testDiskSpaceHint.json")));
     Suggester suggester = session.getSuggester(CollectionAction.ADDREPLICA)
         .hint(Hint.COLL_SHARD, new Pair<>("coll1", "shard1"))
         .hint(Hint.MINFREEDISK, 150);
@@ -2840,7 +2393,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testScheduledTriggerFailure() throws Exception {
-    Map jsonObj = (Map) TestPolicy2.loadFromResource("testScheduledTriggerFailure.json");
+    Map jsonObj = (Map) loadFromResource("testScheduledTriggerFailure.json");
     SolrCloudManager cloudManager = createCloudManager(jsonObj);
     Suggester suggester = createSuggester(cloudManager, jsonObj, null);
     int count = 0;
@@ -2856,7 +2409,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testUtilizeNodeFailure() throws Exception {
-    Map jsonObj = (Map) TestPolicy2.loadFromResource("testUtilizeNodeFailure.json"); //(Map) Utils.fromJSONString(state);
+    Map jsonObj = (Map) loadFromResource("testUtilizeNodeFailure.json"); //(Map) Utils.fromJSONString(state);
     SolrCloudManager cloudManager = createCloudManager(jsonObj);
     Suggester suggester = createSuggester(cloudManager, jsonObj, null);
     int count = 0;
@@ -2872,7 +2425,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testUtilizeNodeFailure2() throws Exception {
-    Map jsonObj = (Map) TestPolicy2.loadFromResource("testUtilizeNodeFailure2.json");
+    Map jsonObj = (Map) loadFromResource("testUtilizeNodeFailure2.json");
     SolrCloudManager cloudManager = createCloudManager(jsonObj);
     Suggester suggester = createSuggester(cloudManager, jsonObj, null);
     int count = 0;
@@ -2888,12 +2441,12 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   //SOLR-12358
-  public void testSortError() throws IOException {
+  public void testSortError() {
     Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString("{cluster-preferences: [{minimize : cores, precision:1}, " +
         "{maximize : freedisk, precision: 50}, " +
         "{minimize: sysLoadAvg}]}"));
 
-    List l = (List) TestPolicy2.loadFromResource("testSortError.json");
+    List l = (List) loadFromResource("testSortError.json");
     List<Variable.Type> params = new ArrayList<>();
     params.add(CORES);
     params.add(Variable.Type.FREEDISK);
@@ -2947,47 +2500,8 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "  ]" +
         "}";
 
-
-    String dataproviderdata = "{" +
-        "  'liveNodes': [" +
-        "    'node1:8983'," +
-        "    'node2:8984'," +
-        "    'node3:8985'" +
-        "  ]," +
-        "  'replicaInfo': {" +
-        "    'node1:8983': {" +
-        "      'c1': {" +
-        "        's1': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]," +
-        "        's2': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]" +
-        "      }" +
-        "    }" +
-        "  }," +
-        "  'nodeValues': {" +
-        "    'node1:8983': {" +
-        "      'cores': 4," +
-        "      'freedisk': 334," +
-        "      'port': 8983" +
-        "    }," +
-        "    'node2:8984': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1000," +
-        "      'port': 8984" +
-        "    }," +
-        "    'node3:8985': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1500," +
-        "      'port': 8985" +
-        "    }" +
-        "  }" +
-        "}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) Utils.fromJSONString(dataproviderdata))).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testViolationOutput.json"))).getViolations();
     StringWriter writer = new StringWriter();
     NamedList<Object> val = new NamedList<>();
     val.add("violations", violations);
@@ -3003,47 +2517,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
 
   public void testFreediskPercentage() {
-    String dataproviderdata = "{" +
-        "  'liveNodes': [" +
-        "    'node1:8983'," +
-        "    'node2:8984'," +
-        "    'node3:8985'" +
-        "  ]," +
-        "  'replicaInfo': {" +
-        "    'node1:8983': {" +
-        "      'c1': {" +
-        "        's1': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]," +
-        "        's2': [" +
-        "          {'r1': {'type': 'NRT'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]" +
-        "      }" +
-        "    }" +
-        "  }," +
-        "  'nodeValues': {" +
-        "    'node1:8983': {" +
-        "      'cores': 4," +
-        "      'freedisk': 230," +
-        "      'totaldisk': 800," +
-        "      'port': 8983" +
-        "    }," +
-        "    'node2:8984': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1000," +
-        "      'totaldisk': 1200," +
-        "      'port': 8984" +
-        "    }," +
-        "    'node3:8985': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1500," +
-        "      'totaldisk': 1700," +
-        "      'port': 8985" +
-        "    }" +
-        "  }" +
-        "}";
+
     String autoScalingjson = "{" +
         "  'cluster-preferences': [" +
         "    { 'maximize': 'freedisk', 'precision': 50}," +
@@ -3054,7 +2528,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "  ]" +
         "}";
     AutoScalingConfig cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) Utils.fromJSONString(dataproviderdata))).getViolations();
+    List<Violation> violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testFreediskPercentage.json"))).getViolations();
     assertEquals(1, violations.size());
     assertEquals(4, violations.get(0).getViolatingReplicas().size());
     for (Violation.ReplicaInfoAndErr r : violations.get(0).getViolatingReplicas()) {
@@ -3070,7 +2544,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "  ]" +
         "}";
     cfg = new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) Utils.fromJSONString(dataproviderdata))).getViolations();
+    violations = cfg.getPolicy().createSession(cloudManagerWithData((Map) loadFromResource("testFreediskPercentage.json"))).getViolations();
     assertEquals(1, violations.size());
     assertEquals(-4d, violations.get(0).replicaCountDelta, 0.01);
     for (Violation.ReplicaInfoAndErr r : violations.get(0).getViolatingReplicas()) {
@@ -3080,88 +2554,8 @@ public class TestPolicy extends SolrTestCaseJ4 {
   }
 
   public void testAutoscalingPreferencesUsedWithNoPolicy() throws IOException, InterruptedException {
-    String dataproviderdata = "{" +
-        "  'liveNodes': [" +
-        "    'node1:8983'," +
-        "    'node2:8984'," +
-        "    'node3:8985'" +
-        "  ]," +
-        "  'replicaInfo': {" +
-        "    'node1:8983': {" +
-        "      'c1': {" +
-        "        's1': [" +
-        "          {'r1': {'type': 'NRT', 'INDEX.sizeInGB':'1100'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]," +
-        "        's2': [" +
-        "          {'r1': {'type': 'NRT', 'INDEX.sizeInGB':'1100'}}," +
-        "          {'r2': {'type': 'NRT'}}" +
-        "        ]" +
-        "      }" +
-        "    }" +
-        "  }," +
-        "  'nodeValues': {" +
-        "    'node1:8983': {" +
-        "      'cores': 4," +
-        "      'freedisk': 300," +
-        "      'totaldisk': 4700," +
-        "      'port': 8983" +
-        "    }," +
-        "    'node2:8984': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1000," +
-        "      'totaldisk': 1200," +
-        "      'port': 8984" +
-        "    }," +
-        "    'node3:8985': {" +
-        "      'cores': 0," +
-        "      'freedisk': 1651," +
-        "      'totaldisk': 1700," +
-        "      'port': 8985" +
-        "    }" +
-        "  }" +
-        "}";
-
-    String clusterState = "{\n" +
-        "  \"c1\" : {\n" +
-        "    \"router\":{\"name\":\"compositeId\"},\n" +
-        "    \"maxShardsPerNode\":-1,\n" +
-        "    \"shards\" : {\n" +
-        "      \"s1\" :  {\n" +
-        "        \"replicas\" : {\n" +
-        "          \"r1\" : {\n" +
-        "            \"type\" : \"NRT\",\n" +
-        "            \"node_name\" : \"node1:8983\",\n" +
-        "            \"state\" : \"active\",\n" +
-        "            \"leader\" : \"true\"\n" +
-        "          },\n" +
-        "          \"r2\" : {\n" +
-        "            \"type\" : \"NRT\",\n" +
-        "            \"node_name\" : \"node1:8983\",\n" +
-        "            \"state\" : \"active\"\n" +
-        "          }\n" +
-        "        }\n" +
-        "      },\n" +
-        "      \"s2\" : {\n" +
-        "        \"replicas\" : {\n" +
-        "          \"r1\" : {\n" +
-        "            \"type\" : \"NRT\",\n" +
-        "            \"node_name\" : \"node1:8983\",\n" +
-        "            \"state\" : \"active\",\n" +
-        "            \"leader\" : \"true\"\n" +
-        "          },\n" +
-        "          \"r2\" : {\n" +
-        "            \"type\" : \"NRT\",\n" +
-        "            \"node_name\" : \"node1:8983\",\n" +
-        "            \"state\" : \"active\"\n" +
-        "          }\n" +
-        "        }\n" +
-        "      }\n" +
-        "    }\n" +
-        "  }\n" +
-        "}";
-
-    Map m = (Map) Utils.fromJSONString(dataproviderdata);
+    Map m = (Map) loadFromResource("testAutoscalingPreferencesUsedWithNoPolicy.json");
+    Map clusterState = (Map) m.remove("clusterstate");
 
     Map replicaInfo = (Map) m.get("replicaInfo");
     replicaInfo.forEach((node, val) -> {
@@ -3206,7 +2600,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
 
           @Override
           public ClusterState getClusterState() throws IOException {
-            return ClusterState.load(0, clusterState.getBytes(Charset.forName("UTF-8")), getLiveNodes(), ZkStateReader.getCollectionPath("c1"));
+            return ClusterState.load(0, clusterState, getLiveNodes(), ZkStateReader.getCollectionPath("c1"));
           }
         };
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1a30bfb/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
index afc5540..c2ce4fa 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
@@ -54,82 +54,12 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   public void testEqualOnNonNode() {
-    String state = "{" +
-        "  'coll1': {" +
-        "    'router': {" +
-        "      'name': 'compositeId'" +
-        "    }," +
-        "    'shards': {" +
-        "      'shard1': {" +
-        "        'range': '80000000-ffffffff'," +
-        "        'replicas': {" +
-        "          'r1': {" +//east
-        "            'core': 'r1'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r2': {" +//west
-        "            'core': 'r2'," +
-        "            'base_url': 'http://10.0.0.4:7574/solr'," +
-        "            'node_name': 'node2'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }," +
-        "      'shard2': {" +
-        "        'range': '0-7fffffff'," +
-        "        'replicas': {" +
-        "          'r3': {" +//east
-        "            'core': 'r3'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r4': {" +//west
-        "            'core': 'r4'," +
-        "            'base_url': 'http://10.0.0.4:8987/solr'," +
-        "            'node_name': 'node4'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r6': {" +//east
-        "            'core': 'r6'," +
-        "            'base_url': 'http://10.0.0.4:8989/solr'," +
-        "            'node_name': 'node3'," +
-        "            'state': 'active'" +
-        "          }," +
-        "          'r5': {" +//east
-        "            'core': 'r5'," +
-        "            'base_url': 'http://10.0.0.4:8983/solr'," +
-        "            'node_name': 'node1'," +
-        "            'state': 'active'" +
-        "          }" +
-        "        }" +
-        "      }" +
-        "    }" +
-        "  }" +
-        "}";
-    String metaData =
-        "  {'nodeValues':{" +
-            "    'node1':{'cores' : 3, 'freedisk' : 700, 'totaldisk' :1000, 'sysprop.zone' : 'east'}," +
-            "    'node2':{'cores' : 1, 'freedisk' : 900, 'totaldisk' :1000, 'sysprop.zone' : 'west'}," +
-            "    'node3':{'cores' : 1, 'freedisk' : 900, 'totaldisk' :1000, 'sysprop.zone': 'east'}," +
-            "    'node4':{'cores' : 1, 'freedisk' : 900, 'totaldisk' :1000, 'sysprop.zone': 'west'}," +
-            "    'node5':{'cores' : 0, 'freedisk' : 1000, 'totaldisk' :1000, 'sysprop.zone': 'west'}" +
-            "  }," +
-            "  'replicaValues':[" +
-            "    {'INDEX.sizeInGB': 100, core : r1}," +
-            "    {'INDEX.sizeInGB': 100, core : r2}," +
-            "    {'INDEX.sizeInGB': 100, core : r3}," +
-            "    {'INDEX.sizeInGB': 100, core : r4}," +
-            "    {'INDEX.sizeInGB': 100, core : r5}," +
-            "    {'INDEX.sizeInGB': 100, core : r6}]}";
-
+    List<Map> l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     String autoScalingjson = "{cluster-policy:[" +
         "    { replica : '<3' , shard : '#EACH', sysprop.zone: [east,west] } ]," +
         "  'cluster-preferences':[{ minimize : cores},{maximize : freedisk, precision : 50}]}";
     Policy policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    Policy.Session session = policy.createSession(createCloudManager(state, metaData));
+    Policy.Session session = policy.createSession(createCloudManager(l.get(0), l.get(1)));
     List<Violation> violations = session.getViolations();
     assertEquals(1, violations.size());
     assertEquals(3, violations.get(0).getViolatingReplicas().size());
@@ -138,11 +68,12 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
       assertEquals("shard2", r.replicaInfo.getShard());
     }
 
+    l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     autoScalingjson = "{cluster-policy:[" +
         "    { replica : '<3' , shard : '#EACH', sysprop.zone: '#EACH' } ]," +
         "  'cluster-preferences':[{ minimize : cores},{maximize : freedisk, precision : 50}]}";
     policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    session = policy.createSession(createCloudManager(state, metaData));
+    session = policy.createSession(createCloudManager(l.get(0), l.get(1)));
     violations = session.getViolations();
     assertEquals(1, violations.size());
     assertEquals(3, violations.get(0).getViolatingReplicas().size());
@@ -150,11 +81,12 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
     for (Violation.ReplicaInfoAndErr r : violations.get(0).getViolatingReplicas()) {
       assertEquals("shard2", r.replicaInfo.getShard());
     }
+    l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     autoScalingjson = "{cluster-policy:[" +
         "    { replica : '#EQUAL' , node: '#ANY' } ]," +
         "  'cluster-preferences':[{ minimize : cores},{maximize : freedisk, precision : 50}]}";
     policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    session = policy.createSession(createCloudManager(state, metaData));
+    session = policy.createSession(createCloudManager(l.get(0), l.get(1)));
     violations = session.getViolations();
     List<Suggester.SuggestionInfo> suggestions = null;
     assertEquals(2, violations.size());
@@ -169,8 +101,9 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
         fail();
       }
     }
+    l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     suggestions = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson))
-        , createCloudManager(state, metaData));
+        , createCloudManager(l.get(0), l.get(1)));
     assertEquals(1, suggestions.size());
     String repName = (String) suggestions.get(0)._get("operation/command/move-replica/replica", null);
 
@@ -182,11 +115,12 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
     });
     assertTrue(found.get());
 
+    l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     autoScalingjson = "{cluster-policy:[" +
         "    { cores : '#EQUAL' , node: '#ANY' } ]," +
         "  'cluster-preferences':[{ minimize : cores},{minimize : freedisk, precision : 50}]}";
     policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));
-    session = policy.createSession(createCloudManager(state, metaData));
+    session = policy.createSession(createCloudManager(l.get(0), l.get(1)));
     violations = session.getViolations();
     assertEquals(2, violations.size());
     for (Violation violation : violations) {
@@ -201,9 +135,9 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
       }
 
     }
-
+    l = (List<Map>) loadFromResource("testEqualOnNonNode.json");
     suggestions = PolicyHelper.getSuggestions(new AutoScalingConfig((Map<String, Object>) Utils.fromJSONString(autoScalingjson)),
-        createCloudManager(state, metaData));
+        createCloudManager(l.get(0), l.get(1)));
     assertEquals(1, suggestions.size());
     assertEquals("node5", suggestions.get(0)._get("operation/command/move-replica/targetNode", null));
 
@@ -219,9 +153,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
 
   }
 
-  static SolrCloudManager createCloudManager(String clusterStateStr, String metadata) {
-    Map m = (Map) Utils.fromJSONString(clusterStateStr);
-    Map meta = (Map) Utils.fromJSONString(metadata);
+  static SolrCloudManager createCloudManager(Map m, Map meta) {
     Map nodeVals = (Map) meta.get("nodeValues");
     List<Map> replicaVals = (List<Map>) meta.get("replicaValues");
     ClusterState clusterState = ClusterState.load(0, m, Collections.emptySet(), null);
@@ -467,9 +399,11 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
 
   }
 
-  public static Object loadFromResource(String file) throws IOException {
+  public static Object loadFromResource(String file)  {
     try (InputStream is = TestPolicy2.class.getResourceAsStream("/solrj/solr/autoscaling/" + file)) {
       return Utils.fromJSON(is);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
     }
   }