Skip to content

Commit 7285b85

Browse files
authored
Fix typos of test cases(#15569)
1 parent ef5bf4a commit 7285b85

2 files changed

Lines changed: 50 additions & 50 deletions

File tree

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalanceTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ void testConsistentHashLoadBalanceInGenericCall() {
4444
Map<Invoker, AtomicLong> genericInvokeCounter = getGenericInvokeCounter(runs, ConsistentHashLoadBalance.NAME);
4545
Map<Invoker, AtomicLong> invokeCounter = getInvokeCounter(runs, ConsistentHashLoadBalance.NAME);
4646

47-
Invoker genericHitted = findHitted(genericInvokeCounter);
48-
Invoker hitted = findHitted(invokeCounter);
47+
Invoker genericHit = findHit(genericInvokeCounter);
48+
Invoker hit = findHit(invokeCounter);
4949

50-
Assertions.assertEquals(hitted, genericHitted, "hitted should equals to genericHitted");
50+
Assertions.assertEquals(hit, genericHit, "hit should equals to genericHit");
5151
}
5252

5353
@Test
@@ -78,7 +78,7 @@ void testArgumentMatchAll() {
7878
}
7979
}
8080

81-
private Invoker findHitted(Map<Invoker, AtomicLong> invokerCounter) {
81+
private Invoker findHit(Map<Invoker, AtomicLong> invokerCounter) {
8282
Invoker invoker = null;
8383

8484
for (Map.Entry<Invoker, AtomicLong> entry : invokerCounter.entrySet()) {
@@ -96,26 +96,26 @@ private Invoker findHitted(Map<Invoker, AtomicLong> invokerCounter) {
9696
@Test
9797
void testConsistentHashLoadBalance() {
9898
int runs = 10000;
99-
long unHitedInvokerCount = 0;
100-
Map<Invoker, Long> hitedInvokers = new HashMap<>();
99+
long unHitInvokerCount = 0;
100+
Map<Invoker, Long> hitInvokers = new HashMap<>();
101101
Map<Invoker, AtomicLong> counter = getInvokeCounter(runs, ConsistentHashLoadBalance.NAME);
102102
for (Invoker minvoker : counter.keySet()) {
103103
Long count = counter.get(minvoker).get();
104104

105105
if (count == 0) {
106-
unHitedInvokerCount++;
106+
unHitInvokerCount++;
107107
} else {
108-
hitedInvokers.put(minvoker, count);
108+
hitInvokers.put(minvoker, count);
109109
}
110110
}
111111

112112
Assertions.assertEquals(
113-
counter.size() - 1, unHitedInvokerCount, "the number of unHitedInvoker should be counter.size() - 1");
114-
Assertions.assertEquals(1, hitedInvokers.size(), "the number of hitedInvoker should be 1");
113+
counter.size() - 1, unHitInvokerCount, "the number of unHitInvoker should be counter.size() - 1");
114+
Assertions.assertEquals(1, hitInvokers.size(), "the number of hitInvoker should be 1");
115115
Assertions.assertEquals(
116116
runs,
117-
hitedInvokers.values().iterator().next().intValue(),
118-
"the number of hited count should be the number of runs");
117+
hitInvokers.values().iterator().next().intValue(),
118+
"the number of hit count should be the number of runs");
119119
}
120120

121121
// https://github.com/apache/dubbo/issues/5429

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterTest.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -495,48 +495,48 @@ void testRoute_Arguments() {
495495
RpcInvocation invocation = new RpcInvocation();
496496
String p = "a";
497497
invocation.setArguments(new Object[] {null});
498-
List<Invoker<String>> fileredInvokers = router.route(
498+
List<Invoker<String>> filteredInvokers = router.route(
499499
invokers.clone(),
500500
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
501501
invocation,
502502
false,
503503
new Holder<>());
504-
Assertions.assertEquals(3, fileredInvokers.size());
504+
Assertions.assertEquals(3, filteredInvokers.size());
505505

506506
invocation.setArguments(new Object[] {p});
507-
fileredInvokers = router.route(
507+
filteredInvokers = router.route(
508508
invokers.clone(),
509509
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
510510
invocation,
511511
false,
512512
new Holder<>());
513-
Assertions.assertEquals(0, fileredInvokers.size());
513+
Assertions.assertEquals(0, filteredInvokers.size());
514514

515515
router = new ConditionStateRouterFactory()
516516
.getRouter(
517517
String.class,
518518
getRouteUrl("arguments = b " + " => " + " host = 1.2.3.4")
519519
.addParameter(FORCE_KEY, String.valueOf(true)));
520-
fileredInvokers = router.route(
520+
filteredInvokers = router.route(
521521
invokers.clone(),
522522
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
523523
invocation,
524524
false,
525525
new Holder<>());
526-
Assertions.assertEquals(3, fileredInvokers.size());
526+
Assertions.assertEquals(3, filteredInvokers.size());
527527

528528
router = new ConditionStateRouterFactory()
529529
.getRouter(
530530
String.class,
531531
getRouteUrl("arguments[10].inner = a " + " => " + " host = 1.2.3.4")
532532
.addParameter(FORCE_KEY, String.valueOf(true)));
533-
fileredInvokers = router.route(
533+
filteredInvokers = router.route(
534534
invokers.clone(),
535535
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
536536
invocation,
537537
false,
538538
new Holder<>());
539-
Assertions.assertEquals(3, fileredInvokers.size());
539+
Assertions.assertEquals(3, filteredInvokers.size());
540540

541541
int integer = 1;
542542
invocation.setArguments(new Object[] {integer});
@@ -545,13 +545,13 @@ void testRoute_Arguments() {
545545
String.class,
546546
getRouteUrl("arguments[0].inner = 1 " + " => " + " host = 1.2.3.4")
547547
.addParameter(FORCE_KEY, String.valueOf(true)));
548-
fileredInvokers = router.route(
548+
filteredInvokers = router.route(
549549
invokers.clone(),
550550
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
551551
invocation,
552552
false,
553553
new Holder<>());
554-
Assertions.assertEquals(0, fileredInvokers.size());
554+
Assertions.assertEquals(0, filteredInvokers.size());
555555
}
556556

557557
@Test
@@ -574,48 +574,48 @@ void testRoute_Attachments() {
574574
BitList<Invoker<String>> invokers = new BitList<>(originInvokers);
575575

576576
RpcInvocation invocation = new RpcInvocation();
577-
List<Invoker<String>> fileredInvokers = router.route(
577+
List<Invoker<String>> filteredInvokers = router.route(
578578
invokers.clone(),
579579
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
580580
invocation,
581581
false,
582582
new Holder<>());
583-
Assertions.assertEquals(3, fileredInvokers.size());
583+
Assertions.assertEquals(3, filteredInvokers.size());
584584

585585
invocation.setAttachment("foo", "a");
586-
fileredInvokers = router.route(
586+
filteredInvokers = router.route(
587587
invokers.clone(),
588588
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
589589
invocation,
590590
false,
591591
new Holder<>());
592-
Assertions.assertEquals(0, fileredInvokers.size());
592+
Assertions.assertEquals(0, filteredInvokers.size());
593593

594594
router = new ConditionStateRouterFactory()
595595
.getRouter(
596596
String.class,
597597
getRouteUrl("attachments = a " + " => " + " host = 1.2.3.4")
598598
.addParameter(FORCE_KEY, String.valueOf(true)));
599-
fileredInvokers = router.route(
599+
filteredInvokers = router.route(
600600
invokers.clone(),
601601
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
602602
invocation,
603603
false,
604604
new Holder<>());
605-
Assertions.assertEquals(3, fileredInvokers.size());
605+
Assertions.assertEquals(3, filteredInvokers.size());
606606

607607
router = new ConditionStateRouterFactory()
608608
.getRouter(
609609
String.class,
610610
getRouteUrl("attachments[foo] = a " + " => " + " region = hangzhou")
611611
.addParameter(FORCE_KEY, String.valueOf(true)));
612-
fileredInvokers = router.route(
612+
filteredInvokers = router.route(
613613
invokers.clone(),
614614
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
615615
invocation,
616616
false,
617617
new Holder<>());
618-
Assertions.assertEquals(1, fileredInvokers.size());
618+
Assertions.assertEquals(1, filteredInvokers.size());
619619
}
620620

621621
@Test
@@ -638,72 +638,72 @@ void testRoute_Range_Pattern() {
638638
BitList<Invoker<String>> invokers = new BitList<>(originInvokers);
639639

640640
RpcInvocation invocation = new RpcInvocation();
641-
List<Invoker<String>> fileredInvokers = router.route(
641+
List<Invoker<String>> filteredInvokers = router.route(
642642
invokers.clone(),
643643
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
644644
invocation,
645645
false,
646646
new Holder<>());
647-
Assertions.assertEquals(3, fileredInvokers.size());
647+
Assertions.assertEquals(3, filteredInvokers.size());
648648

649649
invocation.setAttachment("user_id", "80");
650-
fileredInvokers = router.route(
650+
filteredInvokers = router.route(
651651
invokers.clone(),
652652
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
653653
invocation,
654654
false,
655655
new Holder<>());
656-
Assertions.assertEquals(1, fileredInvokers.size());
656+
Assertions.assertEquals(1, filteredInvokers.size());
657657

658658
invocation.setAttachment("user_id", "101");
659-
fileredInvokers = router.route(
659+
filteredInvokers = router.route(
660660
invokers.clone(),
661661
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
662662
invocation,
663663
false,
664664
new Holder<>());
665-
Assertions.assertEquals(3, fileredInvokers.size());
665+
Assertions.assertEquals(3, filteredInvokers.size());
666666

667667
router = new ConditionStateRouterFactory()
668668
.getRouter(
669669
String.class,
670670
getRouteUrl("attachments[user_id] = ~100 " + " => " + " region = hangzhou")
671671
.addParameter(FORCE_KEY, String.valueOf(true)));
672672
invocation.setAttachment("user_id", "1");
673-
fileredInvokers = router.route(
673+
filteredInvokers = router.route(
674674
invokers.clone(),
675675
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
676676
invocation,
677677
false,
678678
new Holder<>());
679-
Assertions.assertEquals(1, fileredInvokers.size());
679+
Assertions.assertEquals(1, filteredInvokers.size());
680680

681681
router = new ConditionStateRouterFactory()
682682
.getRouter(
683683
String.class,
684684
getRouteUrl("attachments[user_id] = ~100 " + " => " + " region = hangzhou")
685685
.addParameter(FORCE_KEY, String.valueOf(true)));
686686
invocation.setAttachment("user_id", "101");
687-
fileredInvokers = router.route(
687+
filteredInvokers = router.route(
688688
invokers.clone(),
689689
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
690690
invocation,
691691
false,
692692
new Holder<>());
693-
Assertions.assertEquals(3, fileredInvokers.size());
693+
Assertions.assertEquals(3, filteredInvokers.size());
694694

695695
router = new ConditionStateRouterFactory()
696696
.getRouter(
697697
String.class,
698698
getRouteUrl("attachments[user_id] = ~100 " + " => " + " region = hangzhou")
699699
.addParameter(FORCE_KEY, String.valueOf(true)));
700-
fileredInvokers = router.route(
700+
filteredInvokers = router.route(
701701
invokers.clone(),
702702
URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService"),
703703
invocation,
704704
false,
705705
new Holder<>());
706-
Assertions.assertEquals(3, fileredInvokers.size());
706+
Assertions.assertEquals(3, filteredInvokers.size());
707707
}
708708

709709
@Test
@@ -727,16 +727,16 @@ void testRoute_Key_Not_Exist() {
727727

728728
URL consumer = URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService?when_key=a");
729729

730-
List<Invoker<String>> fileredInvokers = router.route(invokers.clone(), consumer, null, false, new Holder<>());
731-
Assertions.assertEquals(0, fileredInvokers.size());
730+
List<Invoker<String>> filteredInvokers = router.route(invokers.clone(), consumer, null, false, new Holder<>());
731+
Assertions.assertEquals(0, filteredInvokers.size());
732732

733733
router = new ConditionStateRouterFactory()
734734
.getRouter(
735735
String.class,
736736
getRouteUrl("not_exist_when_key=a " + " => " + " then_key = a")
737737
.addParameter(FORCE_KEY, String.valueOf(true)));
738-
fileredInvokers = router.route(invokers, consumer, null, false, new Holder<>());
739-
Assertions.assertEquals(3, fileredInvokers.size());
738+
filteredInvokers = router.route(invokers, consumer, null, false, new Holder<>());
739+
Assertions.assertEquals(3, filteredInvokers.size());
740740
}
741741

742742
@Test
@@ -763,9 +763,9 @@ void testRoute_Multiple_Conditions() {
763763
String.class,
764764
getRouteUrl("application=consumer_app&arguments[0]=a" + " => " + " host = " + LOCAL_HOST)
765765
.addParameter(FORCE_KEY, String.valueOf(true)));
766-
List<Invoker<String>> fileredInvokers =
766+
List<Invoker<String>> filteredInvokers =
767767
router.route(invokers.clone(), consumer1, invocation, false, new Holder<>());
768-
Assertions.assertEquals(2, fileredInvokers.size());
768+
Assertions.assertEquals(2, filteredInvokers.size());
769769

770770
// one of the conditions does not match
771771
URL consume2 = URL.valueOf("consumer://" + LOCAL_HOST + "/com.foo.BarService?application=another_consumer_app");
@@ -774,7 +774,7 @@ void testRoute_Multiple_Conditions() {
774774
String.class,
775775
getRouteUrl("application=consumer_app&arguments[0]=a" + " => " + " host = " + LOCAL_HOST)
776776
.addParameter(FORCE_KEY, String.valueOf(true)));
777-
fileredInvokers = router2.route(invokers.clone(), consume2, invocation, false, new Holder<>());
778-
Assertions.assertEquals(3, fileredInvokers.size());
777+
filteredInvokers = router2.route(invokers.clone(), consume2, invocation, false, new Holder<>());
778+
Assertions.assertEquals(3, filteredInvokers.size());
779779
}
780780
}

0 commit comments

Comments
 (0)