SOLR-6220: Fixes forbidden method invocation String#getBytes() in RuleEngineTest

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1677622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-05-04 16:10:22 +00:00
parent c427526bcd
commit 1ed601dfed
1 changed files with 4 additions and 3 deletions

View File

@ -18,6 +18,7 @@ package org.apache.solr.cloud.rule;
*/
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -60,7 +61,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{
" 'node':'127.0.0.1:49958_'," +
" 'disk':992," +
" 'cores':1}}";
MockSnitch.nodeVsTags = (Map) ZkStateReader.fromJSON(s.getBytes());
MockSnitch.nodeVsTags = (Map) ZkStateReader.fromJSON(s.getBytes(StandardCharsets.UTF_8));
Map shardVsReplicaCount = makeMap("shard1", 2, "shard2", 2);
List<Rule> rules = parseRules("[{'cores':'<4'}, {" +
@ -105,7 +106,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{
" 'node':'127.0.0.1:49958_'," +
" 'disk':970," +
" 'cores':1}}";
MockSnitch.nodeVsTags = (Map) ZkStateReader.fromJSON(s.getBytes());
MockSnitch.nodeVsTags = (Map) ZkStateReader.fromJSON(s.getBytes(StandardCharsets.UTF_8));
//test not
List<Rule> rules = parseRules(
"[{cores:'<4'}, " +
@ -182,7 +183,7 @@ public class RuleEngineTest extends SolrTestCaseJ4{
private List<Rule> parseRules(String s) {
List maps = (List) ZkStateReader.fromJSON(s.getBytes());
List maps = (List) ZkStateReader.fromJSON(s.getBytes(StandardCharsets.UTF_8));
List<Rule> rules = new ArrayList<>();
for (Object map : maps) rules.add(new Rule((Map) map));