1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226
|
Description: In junit5 5.3.2, the booleans() method is not available in
the ValueSource annotation class, using ints() instead.
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2022-06-16
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/test/ObserverMasterTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/test/ObserverMasterTest.java
@@ -77,8 +77,9 @@
* be elected if and only if an Observer voted.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testObserver(boolean testObserverMaster) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testObserver(int arg) throws Exception {
+ boolean testObserverMaster = (arg == 1);
// We expect two notifications before we want to continue
latch = new CountDownLatch(2);
setUp(-1, testObserverMaster);
@@ -176,8 +177,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRevalidation(boolean testObserverMaster) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRevalidation(int arg) throws Exception {
+ boolean testObserverMaster = (arg == 1);
setUp(-1, testObserverMaster);
q3.start();
assertTrue(ClientBase.waitForServerUp("127.0.0.1:" + CLIENT_PORT_OBS, CONNECTION_TIMEOUT),
@@ -209,8 +211,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testInOrderCommits(boolean testObserverMaster) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testInOrderCommits(int arg) throws Exception {
+ boolean testObserverMaster = (arg == 1);
setUp(-1, testObserverMaster);
zk = new ZooKeeper("127.0.0.1:" + CLIENT_PORT_QP1, ClientBase.CONNECTION_TIMEOUT, null);
@@ -273,8 +276,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testAdminCommands(boolean testObserverMaster) throws IOException, MBeanException, InstanceNotFoundException, ReflectionException, InterruptedException, MalformedObjectNameException, AttributeNotFoundException, InvalidAttributeValueException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testAdminCommands(int arg) throws IOException, MBeanException, InstanceNotFoundException, ReflectionException, InterruptedException, MalformedObjectNameException, AttributeNotFoundException, InvalidAttributeValueException, KeeperException {
+ boolean testObserverMaster = (arg == 1);
// flush all beans, then start
for (ZKMBeanInfo beanInfo : MBeanRegistry.getInstance().getRegisteredBeans()) {
MBeanRegistry.getInstance().unregister(beanInfo);
@@ -395,9 +399,10 @@
// This test is known to be flaky and fail due to "reconfig already in progress".
// TODO: Investigate intermittent testDynamicReconfig failures.
@ParameterizedTest
- @ValueSource(booleans = {true, false})
+ @ValueSource(ints = {1, 0})
@Disabled
- public void testDynamicReconfig(boolean testObserverMaster) throws InterruptedException, IOException, KeeperException {
+ public void testDynamicReconfig(int arg) throws InterruptedException, IOException, KeeperException {
+ boolean testObserverMaster = (arg == 1);
if (!testObserverMaster) {
return;
}
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/RemoveWatchesTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/RemoveWatchesTest.java
@@ -174,8 +174,9 @@
* Test verifies removal of single watcher when there is server connection
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveSingleWatcher(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveSingleWatcher(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
zk1.create("/node2", null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
MyWatcher w1 = new MyWatcher("/node1", 1);
@@ -206,8 +207,9 @@
* connection
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultipleDataWatchers(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testMultipleDataWatchers(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
MyWatcher w1 = new MyWatcher("/node1", 1);
LOG.info("Adding data watcher {} on path {}", w1, "/node1");
@@ -236,8 +238,9 @@
* connection
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultipleChildWatchers(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testMultipleChildWatchers(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 1);
LOG.info("Adding child watcher {} on path {}", w1, "/node1");
@@ -271,8 +274,9 @@
* data, child, exists
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllWatchers(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllWatchers(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 2);
MyWatcher w2 = new MyWatcher("/node1", 2);
@@ -296,8 +300,9 @@
* watchers. Child watchers shouldn't be removed
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllDataWatchers(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllDataWatchers(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 1);
MyWatcher w2 = new MyWatcher("/node1", 1);
@@ -338,8 +343,9 @@
* watchers. Data watchers shouldn't be removed
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllChildWatchers(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllChildWatchers(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 1);
MyWatcher w2 = new MyWatcher("/node1", 1);
@@ -381,8 +387,9 @@
* <p>All other watchers shouldn't be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllPersistentWatchers(boolean useAsync) throws InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllPersistentWatchers(int arg) throws InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> persistentEvents1 = new LinkedBlockingDeque<>();
BlockingDeque<WatchedEvent> persistentEvents2 = new LinkedBlockingDeque<>();
@@ -425,8 +432,9 @@
* <p>All other watchers shouldn't be removed
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllPersistentRecursiveWatchers(boolean useAsync) throws InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllPersistentRecursiveWatchers(int arg) throws InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> recursiveEvents1 = new LinkedBlockingDeque<>();
BlockingDeque<WatchedEvent> recursiveEvents2 = new LinkedBlockingDeque<>();
@@ -467,8 +475,9 @@
* Test verifies given watcher doesn't exists!
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testNoWatcherException(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testNoWatcherException(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 2);
MyWatcher w2 = new MyWatcher("/node1", 2);
@@ -495,8 +504,9 @@
* function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAnyDataWatcher(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAnyDataWatcher(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 1);
MyWatcher w2 = new MyWatcher("/node1", 2);
@@ -521,8 +531,9 @@
* function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAnyChildWatcher(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAnyChildWatcher(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 2);
MyWatcher w2 = new MyWatcher("/node1", 1);
@@ -546,8 +557,9 @@
* local=true, otw should retain it
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveWatcherWhenNoConnection(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveWatcherWhenNoConnection(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
MyWatcher w1 = new MyWatcher("/node1", 2);
MyWatcher w2 = new MyWatcher("/node1", 1);
@@ -576,8 +588,9 @@
* datastructure 'watchManager.existWatches'
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testManyPreNodeWatchers(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testManyPreNodeWatchers(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
int count = 50;
List<MyWatcher> wList = new ArrayList<>(count);
MyWatcher w;
@@ -604,8 +617,9 @@
* 'watchManager.childWatches'
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testManyChildWatchers(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testManyChildWatchers(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
int count = 50;
List<MyWatcher> wList = new ArrayList<>(count);
MyWatcher w;
@@ -639,8 +653,9 @@
* 'watchManager.dataWatches'
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testManyDataWatchers(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testManyDataWatchers(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
int count = 50;
List<MyWatcher> wList = new ArrayList<>(count);
MyWatcher w;
@@ -670,8 +685,9 @@
* WatcherType#Any. Also, verifies internal watchManager datastructures
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testManyWatchersWhenNoConnection(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testManyWatchersWhenNoConnection(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
int count = 3;
List<MyWatcher> wList = new ArrayList<>(count);
MyWatcher w;
@@ -716,8 +732,9 @@
* Test verifies removing watcher having namespace
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testChRootRemoveWatcher(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testChRootRemoveWatcher(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
// creating the subtree for chRoot clients.
String chRoot = "/appsX";
zk1.create("/appsX", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -771,8 +788,9 @@
*
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testNoWatcherServerException(boolean useAsync) throws KeeperException, InterruptedException, IOException, TimeoutException {
+ @ValueSource(ints = {1, 0})
+ public void testNoWatcherServerException(int arg) throws KeeperException, InterruptedException, IOException, TimeoutException {
+ boolean useAsync = (arg == 1);
CountdownWatcher watcher = new CountdownWatcher();
ZooKeeper zk = spy(new ZooKeeper(hostPort, CONNECTION_TIMEOUT, watcher));
MyWatchManager watchManager = new MyWatchManager(false, watcher);
@@ -789,8 +807,9 @@
* Test verifies given watcher doesn't exists!
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllNoWatcherException(boolean useAsync) throws IOException, InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllNoWatcherException(int arg) throws IOException, InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
removeAllWatches(zk2, "/node1", WatcherType.Any, false, Code.NOWATCHER, useAsync);
}
@@ -799,8 +818,9 @@
* Test verifies null watcher
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testNullWatcherReference(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testNullWatcherReference(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
try {
if (useAsync) {
@@ -819,8 +839,9 @@
* function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveWhenMultipleDataWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveWhenMultipleDataWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
final CountDownLatch dataWatchCount = new CountDownLatch(1);
final CountDownLatch rmWatchCount = new CountDownLatch(1);
@@ -853,8 +874,9 @@
* watcher function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveWhenMultipleChildWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveWhenMultipleChildWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
final CountDownLatch childWatchCount = new CountDownLatch(1);
final CountDownLatch rmWatchCount = new CountDownLatch(1);
@@ -886,8 +908,9 @@
* Test verifies {@link WatcherType#Persistent} - removes only the configured watcher function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveWhenMultiplePersistentWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveWhenMultiplePersistentWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> persistentEvents1 = new LinkedBlockingDeque<>();
@@ -909,8 +932,9 @@
* Test verifies {@link WatcherType#PersistentRecursive} - removes only the configured watcher function
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveWhenMultiplePersistentRecursiveWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveWhenMultiplePersistentRecursiveWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> recursiveEvents1 = new LinkedBlockingDeque<>();
@@ -932,8 +956,9 @@
* Test verifies {@link OpCode#checkWatches} {@link WatcherType#Persistent} using {@link WatcherType#Data}.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemovePersistentWatchesOnAPathPartially(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemovePersistentWatchesOnAPathPartially(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> persistentEvents = new LinkedBlockingDeque<>();
@@ -961,8 +986,9 @@
* <p>All other watcher types shouldn't be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllDataWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllDataWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> dataEvents1 = new LinkedBlockingDeque<>();
@@ -1005,8 +1031,9 @@
* <p>All other watcher types shouldn't be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllChildWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllChildWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> childrenEvents1 = new LinkedBlockingDeque<>();
@@ -1047,8 +1074,9 @@
* <p>All other watcher types shouldn't be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllPersistentWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllPersistentWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> persistentEvents1 = new LinkedBlockingDeque<>();
@@ -1086,8 +1114,9 @@
* Test verifies {@link OpCode#removeWatches} {@link WatcherType#Persistent} using {@link WatcherType#Data}.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllPersistentWatchesOnAPathPartially(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllPersistentWatchesOnAPathPartially(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> persistentEvents = new LinkedBlockingDeque<>();
@@ -1114,8 +1143,9 @@
* <p>All other watcher types shouldn't be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllPersistentRecursiveWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllPersistentRecursiveWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
BlockingDeque<WatchedEvent> recursiveEvents1 = new LinkedBlockingDeque<>();
@@ -1155,8 +1185,9 @@
* <p>All watcher types should be removed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testRemoveAllWatchesOnAPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testRemoveAllWatchesOnAPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
// Add multiple child watches
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
@@ -52,8 +52,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testLearnerMetricsTest(boolean asyncSending) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testLearnerMetricsTest(int arg) throws Exception {
+ boolean asyncSending = (arg == 1);
Learner.setAsyncSending(asyncSending);
ServerMetrics.getMetrics().resetAll();
ClientBase.setupTestEnv();
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/ReconfigDuringLeaderSyncTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/ReconfigDuringLeaderSyncTest.java
@@ -81,8 +81,9 @@
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testDuringLeaderSync(boolean asyncSending) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testDuringLeaderSync(int arg) throws Exception {
+ boolean asyncSending = (arg == 1);
setup(asyncSending);
final int[] clientPorts = new int[SERVER_COUNT + 1];
StringBuilder sb = new StringBuilder();
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/UnifiedServerSocketModeDetectionTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/UnifiedServerSocketModeDetectionTest.java
@@ -154,80 +154,90 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetInetAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetInetAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getInetAddress();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetLocalAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetLocalAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getLocalAddress();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetPort(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetPort(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getPort();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetLocalPort(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetLocalPort(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getLocalPort();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetRemoteSocketAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetRemoteSocketAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getRemoteSocketAddress();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetLocalSocketAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetLocalSocketAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getLocalSocketAddress();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetInputStream(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetInputStream(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getInputStream();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetOutputStream(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetOutputStream(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getOutputStream();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetTcpNoDelay(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetTcpNoDelay(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getTcpNoDelay();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetTcpNoDelay(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetTcpNoDelay(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
boolean tcpNoDelay = serverSideSocket.getTcpNoDelay();
tcpNoDelay = !tcpNoDelay;
@@ -237,16 +247,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetSoLinger(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetSoLinger(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getSoLinger();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetSoLinger(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetSoLinger(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
int soLinger = serverSideSocket.getSoLinger();
if (soLinger == -1) {
@@ -263,16 +275,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetSoTimeout(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetSoTimeout(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getSoTimeout();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetSoTimeout(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetSoTimeout(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
int timeout = serverSideSocket.getSoTimeout();
timeout = timeout + 10;
@@ -282,16 +296,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetSendBufferSize(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetSendBufferSize(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getSendBufferSize();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetSendBufferSize(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetSendBufferSize(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.setSendBufferSize(serverSideSocket.getSendBufferSize() + 1024);
assertFalse(serverSideSocket.isModeKnown());
@@ -302,16 +318,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetReceiveBufferSize(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetReceiveBufferSize(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getReceiveBufferSize();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetReceiveBufferSize(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetReceiveBufferSize(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.setReceiveBufferSize(serverSideSocket.getReceiveBufferSize() + 1024);
assertFalse(serverSideSocket.isModeKnown());
@@ -322,16 +340,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetKeepAlive(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetKeepAlive(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getKeepAlive();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetKeepAlive(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetKeepAlive(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
boolean keepAlive = serverSideSocket.getKeepAlive();
keepAlive = !keepAlive;
@@ -341,16 +361,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetTrafficClass(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetTrafficClass(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getTrafficClass();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetTrafficClass(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetTrafficClass(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.setTrafficClass(SocketOptions.IP_TOS);
assertFalse(serverSideSocket.isModeKnown());
@@ -360,16 +382,18 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetReuseAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetReuseAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.getReuseAddress();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetReuseAddress(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetReuseAddress(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
boolean reuseAddress = serverSideSocket.getReuseAddress();
reuseAddress = !reuseAddress;
@@ -379,56 +403,63 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testClose(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testClose(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.close();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testShutdownInput(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testShutdownInput(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.shutdownInput();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testShutdownOutput(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testShutdownOutput(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.shutdownOutput();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testIsConnected(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testIsConnected(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.isConnected();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testIsBound(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testIsBound(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.isBound();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testIsClosed(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testIsClosed(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.isClosed();
assertFalse(serverSideSocket.isModeKnown());
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testIsInputShutdown(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testIsInputShutdown(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.isInputShutdown();
assertFalse(serverSideSocket.isModeKnown());
@@ -437,8 +468,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testIsOutputShutdown(boolean useSecureClient) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testIsOutputShutdown(int arg) throws Exception {
+ boolean useSecureClient = (arg == 1);
init(useSecureClient);
serverSideSocket.isOutputShutdown();
assertFalse(serverSideSocket.isModeKnown());
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/WatchLeakTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/WatchLeakTest.java
@@ -81,8 +81,9 @@
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testWatchesLeak(boolean sessionTimedout) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testWatchesLeak(int arg) throws Exception {
+ boolean sessionTimedout = (arg == 1);
NIOServerCnxnFactory serverCnxnFactory = mock(NIOServerCnxnFactory.class);
final SelectionKey sk = new FakeSK();
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/test/MultiOperationTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/test/MultiOperationTest.java
@@ -190,8 +190,9 @@
* Test verifies the multi calls with invalid znode path
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testInvalidPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testInvalidPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<Integer> expectedResultCodes = new ArrayList<>();
expectedResultCodes.add(KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
expectedResultCodes.add(KeeperException.Code.BADARGUMENTS.intValue());
@@ -247,8 +248,9 @@
* 3. multi delete should succeed.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiRollback(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMultiRollback(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk.create("/foo", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
ZooKeeper epheZk = createClient();
@@ -292,8 +294,9 @@
* Test verifies the multi calls with blank znode path
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testBlankPath(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testBlankPath(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<Integer> expectedResultCodes = new ArrayList<>();
expectedResultCodes.add(KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
expectedResultCodes.add(KeeperException.Code.BADARGUMENTS.intValue());
@@ -314,8 +317,9 @@
* Test verifies the multi.create with invalid createModeFlag
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testInvalidCreateModeFlag(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testInvalidCreateModeFlag(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<Integer> expectedResultCodes = new ArrayList<>();
expectedResultCodes.add(KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
expectedResultCodes.add(KeeperException.Code.BADARGUMENTS.intValue());
@@ -331,8 +335,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testChRootCreateDelete(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testChRootCreateDelete(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
// creating the subtree for chRoot clients.
String chRoot = createNameSpace(useAsync);
// Creating child using chRoot client.
@@ -352,8 +357,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testChRootSetData(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testChRootSetData(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
// creating the subtree for chRoot clients.
String chRoot = createNameSpace(useAsync);
// setData using chRoot client.
@@ -374,8 +380,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testChRootCheck(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testChRootCheck(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
// creating the subtree for chRoot clients.
String chRoot = createNameSpace(useAsync);
// checking the child version using chRoot client.
@@ -393,8 +400,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testChRootTransaction(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testChRootTransaction(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
// creating the subtree for chRoot clients.
String chRoot = createNameSpace(useAsync);
// checking the child version using chRoot client.
@@ -429,8 +437,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testCreate(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testCreate(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
multi(zk, Arrays.asList(
Op.create("/multi0", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
Op.create("/multi1", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
@@ -442,8 +451,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testCreate2(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testCreate2(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
CreateOptions options = CreateOptions.newBuilder(Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT).build();
List<Op> ops = Arrays.asList(
Op.create("/multi0", new byte[0], options),
@@ -464,14 +474,16 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testEmpty(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testEmpty(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
multi(zk, Arrays.asList(), useAsync);
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testCreateDelete(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testCreateDelete(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
multi(zk, Arrays.asList(
Op.create("/multi", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
Op.delete("/multi", 0)),
@@ -482,8 +494,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testInvalidVersion(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testInvalidVersion(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
try {
multi(zk, Arrays.asList(
@@ -497,8 +510,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testNestedCreate(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testNestedCreate(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
multi(zk, Arrays.asList(
/* Create */
@@ -515,8 +529,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testSetData(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testSetData(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
String[] names = {"/multi0", "/multi1", "/multi2"};
List<Op> ops = new ArrayList<>();
@@ -534,8 +549,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testUpdateConflict(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testUpdateConflict(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
assertNull(zk.exists("/multi", null));
@@ -564,8 +580,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testDeleteUpdateConflict(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testDeleteUpdateConflict(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
/* Delete of a node folowed by an update of the (now) deleted node */
try {
@@ -584,8 +601,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testGetResults(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testGetResults(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
/* Delete of a node folowed by an update of the (now) deleted node */
Iterable<Op> ops = Arrays.asList(
Op.create("/multi", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
@@ -640,8 +658,9 @@
* Exercise the equals methods of OpResult classes.
*/
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testOpResultEquals(boolean useAsync) {
+ @ValueSource(ints = {1, 0})
+ public void testOpResultEquals(int arg) {
+ boolean useAsync = (arg == 1);
opEquals(new CreateResult("/foo"), new CreateResult("/foo"), new CreateResult("nope"));
opEquals(new CreateResult("/foo"), new CreateResult("/foo"), new CreateResult("/foo", new Stat(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
@@ -670,8 +689,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testWatchesTriggered(boolean useAsync) throws KeeperException, InterruptedException {
+ @ValueSource(ints = {1, 0})
+ public void testWatchesTriggered(int arg) throws KeeperException, InterruptedException {
+ boolean useAsync = (arg == 1);
HasTriggeredWatcher watcher = new HasTriggeredWatcher();
zk.getChildren("/", watcher);
multi(zk, Arrays.asList(
@@ -682,8 +702,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testNoWatchesTriggeredForFailedMultiRequest(boolean useAsync) throws InterruptedException, KeeperException {
+ @ValueSource(ints = {1, 0})
+ public void testNoWatchesTriggeredForFailedMultiRequest(int arg) throws InterruptedException, KeeperException {
+ boolean useAsync = (arg == 1);
HasTriggeredWatcher watcher = new HasTriggeredWatcher();
zk.getChildren("/", watcher);
try {
@@ -704,8 +725,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testTransactionBuilder(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testTransactionBuilder(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<OpResult> results = commit(
zk.transaction()
.create("/t1", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT)
@@ -763,8 +785,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetChildren(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetChildren(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<String> topLevelNodes = new ArrayList<>();
Map<String, List<String>> childrenNodes = new HashMap<>();
// Creating a database where '/fooX' nodes has 'barXY' named children.
@@ -795,8 +818,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetChildrenSameNode(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetChildrenSameNode(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
List<String> childrenNodes = new ArrayList<>();
// Creating a database where '/foo' node has 'barX' named children.
String topLevelNode = "/foo";
@@ -824,8 +848,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetChildrenAuthentication(boolean useAsync) throws KeeperException, InterruptedException {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetChildrenAuthentication(int arg) throws KeeperException, InterruptedException {
+ boolean useAsync = (arg == 1);
List<ACL> writeOnly = Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, new Id("world", "anyone")));
zk.create("/foo_auth", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/foo_auth/bar", null, Ids.READ_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -850,8 +875,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetChildrenMixedAuthenticationErrorFirst(boolean useAsync) throws KeeperException, InterruptedException {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetChildrenMixedAuthenticationErrorFirst(int arg) throws KeeperException, InterruptedException {
+ boolean useAsync = (arg == 1);
List<ACL> writeOnly = Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, new Id("world", "anyone")));
zk.create("/foo_auth", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/foo_auth/bar", null, Ids.READ_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -873,8 +899,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetChildrenMixedAuthenticationCorrectFirst(boolean useAsync) throws KeeperException, InterruptedException {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetChildrenMixedAuthenticationCorrectFirst(int arg) throws KeeperException, InterruptedException {
+ boolean useAsync = (arg == 1);
List<ACL> writeOnly = Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, new Id("world", "anyone")));
zk.create("/foo_auth", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/foo_auth/bar", null, Ids.READ_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -897,8 +924,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiGetData(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMultiGetData(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk.create("/node1", "data1".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/node2", "data2".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -909,8 +937,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMultiRead(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMultiRead(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk.create("/node1", "data1".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/node2", "data2".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
zk.create("/node1/node1", "data11".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
@@ -957,8 +986,9 @@
}
@ParameterizedTest
- @ValueSource(booleans = {true, false})
- public void testMixedReadAndTransaction(boolean useAsync) throws Exception {
+ @ValueSource(ints = {1, 0})
+ public void testMixedReadAndTransaction(int arg) throws Exception {
+ boolean useAsync = (arg == 1);
zk.create("/node", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
try {
List<OpResult> multiRead = multi(zk, Arrays.asList(
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumSSLTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumSSLTest.java
@@ -125,13 +125,13 @@
@Retention(RetentionPolicy.RUNTIME)
@ParameterizedTest(name = "fipsEnabled = {0}")
- @ValueSource(booleans = { false, true})
+ @ValueSource(ints = { 0, 1})
private @interface TestBothFipsModes {
}
@Retention(RetentionPolicy.RUNTIME)
@ParameterizedTest(name = "fipsEnabled = {0}")
- @ValueSource(booleans = { false })
+ @ValueSource(ints = { 0 })
private @interface TestNoFipsOnly {
}
|