|
@@ -6,8 +6,6 @@ import org.junit.Test; |
|
@@ -6,8 +6,6 @@ import org.junit.Test; |
|
6
|
import java.util.ArrayList;
|
6
|
import java.util.ArrayList;
|
|
7
|
import java.util.List;
|
7
|
import java.util.List;
|
|
8
|
|
8
|
|
|
9
|
-import static org.junit.Assert.*;
|
|
|
|
10
|
-
|
|
|
|
11
|
public class SortArrayMapConsistentHashTest {
|
9
|
public class SortArrayMapConsistentHashTest {
|
|
12
|
|
10
|
|
|
13
|
@Test
|
11
|
@Test
|
|
@@ -15,13 +13,12 @@ public class SortArrayMapConsistentHashTest { |
|
@@ -15,13 +13,12 @@ public class SortArrayMapConsistentHashTest { |
|
15
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
13
|
AbstractConsistentHash map = new SortArrayMapConsistentHash() ;
|
|
16
|
|
14
|
|
|
17
|
List<String> strings = new ArrayList<String>();
|
15
|
List<String> strings = new ArrayList<String>();
|
|
18
|
- strings.add("") ;
|
|
|
|
19
|
for (int i = 0; i < 10; i++) {
|
16
|
for (int i = 0; i < 10; i++) {
|
|
20
|
strings.add("127.0.0." + i) ;
|
17
|
strings.add("127.0.0." + i) ;
|
|
21
|
}
|
18
|
}
|
|
22
|
String process = map.process(strings,"zhangsan");
|
19
|
String process = map.process(strings,"zhangsan");
|
|
23
|
System.out.println(process);
|
20
|
System.out.println(process);
|
|
24
|
- Assert.assertEquals("127.0.0.8",process);
|
21
|
+ Assert.assertEquals("127.0.0.2",process);
|
|
25
|
|
22
|
|
|
26
|
}
|
23
|
}
|
|
27
|
|
24
|
|
|
@@ -36,7 +33,7 @@ public class SortArrayMapConsistentHashTest { |
|
@@ -36,7 +33,7 @@ public class SortArrayMapConsistentHashTest { |
|
36
|
String process = map.process(strings,"zhangsan2");
|
33
|
String process = map.process(strings,"zhangsan2");
|
|
37
|
System.out.println(process);
|
34
|
System.out.println(process);
|
|
38
|
|
35
|
|
|
39
|
- Assert.assertEquals("127.0.0.4",process);
|
36
|
+ Assert.assertEquals("127.0.0.3",process);
|
|
40
|
}
|
37
|
}
|
|
41
|
|
38
|
|
|
42
|
@Test
|
39
|
@Test
|
|
@@ -79,7 +76,7 @@ public class SortArrayMapConsistentHashTest { |
|
@@ -79,7 +76,7 @@ public class SortArrayMapConsistentHashTest { |
|
79
|
String process = map.process(strings,"1551253899106");
|
76
|
String process = map.process(strings,"1551253899106");
|
|
80
|
|
77
|
|
|
81
|
System.out.println(process);
|
78
|
System.out.println(process);
|
|
82
|
- Assert.assertEquals("45.78.28.220:9100:10081",process);
|
79
|
+ Assert.assertEquals("45.78.28.220:9000:8081",process);
|
|
83
|
}
|
80
|
}
|
|
84
|
|
81
|
|
|
85
|
@Test
|
82
|
@Test
|
|
@@ -94,7 +91,7 @@ public class SortArrayMapConsistentHashTest { |
|
@@ -94,7 +91,7 @@ public class SortArrayMapConsistentHashTest { |
|
94
|
String process = map.process(strings,"1551253899106");
|
91
|
String process = map.process(strings,"1551253899106");
|
|
95
|
|
92
|
|
|
96
|
System.out.println(process);
|
93
|
System.out.println(process);
|
|
97
|
- Assert.assertEquals("45.78.28.220:9100:10081",process);
|
94
|
+ Assert.assertEquals("45.78.28.220:9000:8081",process);
|
|
98
|
}
|
95
|
}
|
|
99
|
@Test
|
96
|
@Test
|
|
100
|
public void getFirstNodeValue7() {
|
97
|
public void getFirstNodeValue7() {
|
|
@@ -109,7 +106,7 @@ public class SortArrayMapConsistentHashTest { |
|
@@ -109,7 +106,7 @@ public class SortArrayMapConsistentHashTest { |
|
109
|
String process = map.process(strings,"1551253899106");
|
106
|
String process = map.process(strings,"1551253899106");
|
|
110
|
|
107
|
|
|
111
|
System.out.println(process);
|
108
|
System.out.println(process);
|
|
112
|
- Assert.assertEquals("45.78.28.220:9100:10081",process);
|
109
|
+ Assert.assertEquals("45.78.28.220:9000:8081",process);
|
|
113
|
}
|
110
|
}
|
|
114
|
|
111
|
|
|
115
|
|
112
|
|