|
...
|
...
|
@@ -15,11 +15,11 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("zhangsan") ;
|
|
|
|
strings.add("") ;
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
strings.add("127.0.0." + i) ;
|
|
|
|
}
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"zhangsan");
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("127.0.0.8",process);
|
|
|
|
|
|
...
|
...
|
@@ -30,11 +30,10 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("zhangsan2");
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
strings.add("127.0.0." + i) ;
|
|
|
|
}
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"zhangsan2");
|
|
|
|
System.out.println(process);
|
|
|
|
|
|
|
|
Assert.assertEquals("127.0.0.4",process);
|
|
...
|
...
|
@@ -45,11 +44,10 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("1551253899106") ;
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
strings.add("127.0.0." + i) ;
|
|
|
|
}
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"1551253899106");
|
|
|
|
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("127.0.0.6",process);
|
|
...
|
...
|
@@ -61,11 +59,10 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("1551253899106") ;
|
|
|
|
strings.add("45.78.28.220:9000:8081") ;
|
|
|
|
strings.add("45.78.28.220:9100:9081") ;
|
|
|
|
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"1551253899106");
|
|
|
|
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("45.78.28.220:9000:8081",process);
|
|
...
|
...
|
@@ -75,12 +72,11 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("1551253899106") ;
|
|
|
|
strings.add("45.78.28.220:9000:8081") ;
|
|
|
|
strings.add("45.78.28.220:9100:9081") ;
|
|
|
|
strings.add("45.78.28.220:9100:10081") ;
|
|
|
|
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"1551253899106");
|
|
|
|
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("45.78.28.220:9100:10081",process);
|
|
...
|
...
|
@@ -91,12 +87,11 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("1551253899106") ;
|
|
|
|
strings.add("45.78.28.220:9000:8081") ;
|
|
|
|
strings.add("45.78.28.220:9100:9081") ;
|
|
|
|
strings.add("45.78.28.220:9100:10081") ;
|
|
|
|
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"1551253899106");
|
|
|
|
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("45.78.28.220:9100:10081",process);
|
|
...
|
...
|
@@ -106,15 +101,17 @@ public class SortArrayMapConsistentHashTest { |
|
|
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
|
|
|
|
|
|
List<String> strings = new ArrayList<String>();
|
|
|
|
strings.add("1551253899106") ;
|
|
|
|
strings.add("45.78.28.220:9000:8081") ;
|
|
|
|
strings.add("45.78.28.220:9100:9081") ;
|
|
|
|
strings.add("45.78.28.220:9100:10081") ;
|
|
|
|
strings.add("45.78.28.220:9100:00081") ;
|
|
|
|
|
|
|
|
String process = map.process(strings);
|
|
|
|
String process = map.process(strings,"1551253899106");
|
|
|
|
|
|
|
|
System.out.println(process);
|
|
|
|
Assert.assertEquals("45.78.28.220:9100:10081",process);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|