1 18 19 package org.objectweb.speedo.stress; 20 21 22 import org.objectweb.util.monolog.api.BasicLevel; 23 import org.objectweb.speedo.pobjects.common.ParamsTest; 24 25 import javax.jdo.PersistenceManager; 26 import javax.jdo.JDOFatalException; 27 28 33 public class TestDeletion extends IntUserIdHelper { 34 35 private String DELETION = getLoggerName() + ".deletion"; 36 37 38 public TestDeletion(String s) { 39 super(s); 40 } 41 42 protected String getLoggerName() { 43 return STRESS_LOG_NAME + ".TestDeletion"; 44 } 45 46 class DeletionCtx extends IUICtx { 47 public int nbDeletion; 48 49 public DeletionCtx(int dbSize, int nbDeletion) { 50 super(dbSize); 51 this.nbDeletion = nbDeletion; 52 } 53 54 public String toString() { 55 return super.toString() + " / ndDeletion = " + nbDeletion; 56 } 57 } 58 59 protected void prepareTest(StressHelper.TaskManager tm, Object ctx) { 60 oids = null; 61 super.prepareTest(tm, ctx); 62 } 63 64 protected void perform(Task task, int threadId, int txId, Object ctx, PerformResult res) { 65 DeletionCtx dctx = (DeletionCtx) ctx; 66 PersistenceManager pm = getPM(task, threadId,txId); 67 try { 68 res.beginTest(); 69 beginTx(pm, task, threadId, txId); 70 for (int no = 0; no < dctx.nbDeletion; no++) { 71 int oid = (txId * dctx.nbDeletion) + no; 72 if (debug) { 73 logger.log(BasicLevel.DEBUG, "Deleting object " + oid); 74 } 75 pm.deletePersistent(pm.getObjectById(dctx.oids[oid], false)); 76 } 77 commitTx(pm, task, threadId, txId); 78 res.endTest(); 79 } catch (JDOFatalException e) { 80 rollbackOnException(pm, e, res, task, threadId, txId); 81 } catch (Throwable e) { 82 stopOnError(pm, e, res, task, threadId, txId); 83 } finally { 84 closePM(pm, threadId, txId, task, res); 85 } 86 } 87 88 89 92 protected void perform(ParamsTest param) { 93 if (!interactive) { 94 perform(param.getNbth(), param.getNbtx(), param.getTo(), 95 new DeletionCtx(param.getDbSize(), param.getNbc())); 96 } 97 } 98 99 103 public void testInteractive() { 104 if (interactive) { 105 perform(Integer.getInteger(THREAD, 10).intValue(), 106 Integer.getInteger(TX, 100).intValue(), 107 Integer.getInteger(TIMEOUT, 200000).intValue(), 108 new DeletionCtx( 109 Integer.getInteger(DBSIZE, 100000).intValue(), 110 Integer.getInteger(DELETION, 1000).intValue())); 111 } 112 } 113 114 118 public void testDeletionTh1Tx10Cr1() { 119 if (!interactive) { 120 perform(1, 10, 1000000, new DeletionCtx(10, 1)); 121 } 122 } 123 129 130 134 public void testDeletionTh1Tx100De1() { 135 ParamsTest params = new ParamsTest(1, 100, 1, 1000000, 0, 100); 136 if (!interactive) { 137 perform(params); 138 } 139 } 140 144 public void testDeletionTh1Tx1000Cr1() { 145 ParamsTest params = new ParamsTest(1, 1000, 1, 1000000, 0, 1000); 146 if (!interactive) { 147 perform(params); 148 } 149 } 150 151 155 public void testDeletionTh1Tx10000Cr1() { 156 ParamsTest params = new ParamsTest(1, 10000, 1, 1000000, 0, 10000); 157 if (!interactive) { 158 perform(params); 159 } 160 } 161 162 166 public void testDeletionTh1Tx100000Cr1() { 167 168 169 ParamsTest params = new ParamsTest(1, 100000, 1, 10000000, 0, 100000); 170 if (!interactive) { 171 perform(params); 172 } 173 } 174 175 179 public void testDeletionTh1Tx10Cr10() { 180 181 182 ParamsTest params = new ParamsTest(1, 10, 10, 1000000, 0, 100); 183 if (!interactive) { 184 perform(params); 185 } 186 } 187 188 192 public void testDeletionTh1Tx100Cr10() { 193 194 195 ParamsTest params = new ParamsTest(1, 100, 10, 1000000, 0, 1000); 196 if (!interactive) { 197 perform(params); 198 } 199 } 200 201 205 public void testDeletionTh1Tx1000Cr10() { 206 207 208 ParamsTest params = new ParamsTest(1, 1000, 10, 1000000, 0, 10000); 209 if (!interactive) { 210 perform(params); 211 } 212 } 213 214 218 public void testDeletionTh1Tx10000Cr10() { 219 220 221 ParamsTest params = new ParamsTest(1, 10000, 10, 10000000, 0, 100000); 222 if (!interactive) { 223 perform(params); 224 } 225 } 226 227 231 public void _testDeletionTh1Tx100000Cr10() { 232 233 234 ParamsTest params = new ParamsTest(1, 100000, 10, 100000000, 0, 1000000); 235 if (!interactive) { 236 perform(params); 237 } 238 } 239 240 244 public void testDeletionTh1Tx10Cr100() { 245 246 247 ParamsTest params = new ParamsTest(1, 10, 100, 1000000, 0, 1000); 248 if (!interactive) { 249 perform(params); 250 } 251 } 252 253 257 public void testDeletionTh1Tx100Cr100() { 258 259 260 ParamsTest params = new ParamsTest(1, 100, 100, 1000000, 0, 10000); 261 if (!interactive) { 262 perform(params); 263 } 264 } 265 266 270 public void testDeletionTh1Tx1000Cr100() { 271 272 273 ParamsTest params = new ParamsTest(1, 1000, 100, 10000000, 0, 100000); 274 if (!interactive) { 275 perform(params); 276 } 277 } 278 279 283 public void testDeletionTh1Tx10000Cr100() { 284 285 286 ParamsTest params = new ParamsTest(1, 10000, 100, 100000000, 0, 1000000); 287 if (!interactive) { 288 perform(params); 289 } 290 } 291 292 296 public void testDeletionTh1Tx10Cr500() { 297 298 299 ParamsTest params = new ParamsTest(1, 10, 500, 1000000, 0, 5000); 300 if (!interactive) { 301 perform(params); 302 } 303 } 304 305 309 public void testDeletionTh1Tx100Cr500() { 310 311 312 ParamsTest params = new ParamsTest(1, 100, 500, 10000000, 0, 50000); 313 if (!interactive) { 314 perform(params); 315 } 316 } 317 318 322 public void testDeletionTh1Tx1000Cr500() { 323 324 325 ParamsTest params = new ParamsTest(1, 1000, 500, 100000000, 0, 500000); 326 if (!interactive) { 327 perform(params); 328 } 329 } 330 331 335 public void testDeletionTh1Tx10Cr1000() { 336 337 338 ParamsTest params = new ParamsTest(1, 10, 1000, 1000000, 0, 10000); 339 if (!interactive) { 340 perform(params); 341 } 342 } 343 344 348 public void testDeletionTh1Tx100Cr1000() { 349 350 351 ParamsTest params = new ParamsTest(1, 100, 1000, 10000000, 0, 100000); 352 if (!interactive) { 353 perform(params); 354 } 355 } 356 357 361 public void testDeletionTh1Tx1000Cr1000() { 362 363 364 ParamsTest params = new ParamsTest(1, 1000, 1000, 100000000, 0, 1000000); 365 if (!interactive) { 366 perform(params); 367 } 368 } 369 370 374 public void testDeletionTh1Tx10Cr2000() { 375 376 377 ParamsTest params = new ParamsTest(1, 10, 2000, 10000000, 0, 20000); 378 if (!interactive) { 379 perform(params); 380 } 381 } 382 383 387 public void testDeletionTh1Tx100Cr2000() { 388 389 390 ParamsTest params = new ParamsTest(1, 100, 2000, 100000000, 0, 200000); 391 if (!interactive) { 392 perform(params); 393 } 394 } 395 396 400 public void testDeletionTh2Tx10Cr1() { 401 402 403 ParamsTest params = new ParamsTest(2, 10, 1, 1000000, 0, 10); 404 if (!interactive) { 405 perform(params); 406 } 407 } 408 409 413 public void testDeletionTh2Tx100Cr1() { 414 415 416 ParamsTest params = new ParamsTest(2, 100, 1, 1000000, 0, 100); 417 if (!interactive) { 418 perform(params); 419 } 420 } 421 422 426 public void testDeletionTh2Tx1000Cr1() { 427 428 429 ParamsTest params = new ParamsTest(2, 1000, 1, 1000000, 0, 1000); 430 if (!interactive) { 431 perform(params); 432 } 433 } 434 435 439 public void testDeletionTh2Tx10000Cr1() { 440 441 442 ParamsTest params = new ParamsTest(2, 10000, 1, 1000000, 0, 10000); 443 if (!interactive) { 444 perform(params); 445 } 446 } 447 448 452 public void _testDeletionTh2Tx100000Cr1() { 453 454 455 ParamsTest params = new ParamsTest(2, 100000, 1, 1000000, 0, 100000); 456 if (!interactive) { 457 perform(params); 458 } 459 } 460 461 465 public void testDeletionTh2Tx10Cr10() { 466 467 468 ParamsTest params = new ParamsTest(2, 10, 10, 1000000, 0, 100); 469 if (!interactive) { 470 perform(params); 471 } 472 } 473 474 478 public void testDeletionTh2Tx100Cr10() { 479 480 481 ParamsTest params = new ParamsTest(2, 100, 10, 1000000, 0, 1000); 482 if (!interactive) { 483 perform(params); 484 } 485 } 486 487 491 public void testDeletionTh2Tx1000Cr10() { 492 493 494 ParamsTest params = new ParamsTest(2, 1000, 10, 1000000, 0, 10000); 495 if (!interactive) { 496 perform(params); 497 } 498 } 499 500 504 public void testDeletionTh2Tx10000Cr10() { 505 506 507 ParamsTest params = new ParamsTest(2, 10000, 10, 1000000, 0, 100000); 508 if (!interactive) { 509 perform(params); 510 } 511 } 512 513 517 public void _testDeletionTh2Tx100000Cr10() { 518 519 520 ParamsTest params = new ParamsTest(2, 100000, 10, 1000000, 0, 1000000); 521 if (!interactive) { 522 perform(params); 523 } 524 } 525 526 530 public void testDeletionTh2Tx10Cr100() { 531 532 533 ParamsTest params = new ParamsTest(2, 10, 100, 1000000, 0, 1000); 534 if (!interactive) { 535 perform(params); 536 } 537 } 538 539 543 public void testDeletionTh2Tx100Cr100() { 544 545 546 ParamsTest params = new ParamsTest(2, 100, 100, 1000000, 0, 10000); 547 if (!interactive) { 548 perform(params); 549 } 550 } 551 552 556 public void testDeletionTh2Tx1000Cr100() { 557 558 559 ParamsTest params = new ParamsTest(2, 1000, 100, 1000000, 0, 100000); 560 if (!interactive) { 561 perform(params); 562 } 563 } 564 565 569 public void testDeletionTh2Tx100Cr2000() { 570 571 572 ParamsTest params = new ParamsTest(2, 100, 2000, 10000000, 0, 200000); 573 if (!interactive) { 574 perform(params); 575 } 576 } 577 578 582 public void testDeletionTh2Tx1000Cr2000() { 583 584 585 ParamsTest params = new ParamsTest(2, 1000, 2000, 10000000, 0, 2000000); 586 if (!interactive) { 587 perform(params); 588 } 589 } 590 591 595 public void testDeletionTh3Tx10Cr1() { 596 597 598 ParamsTest params = new ParamsTest(3, 10, 1, 1000000, 0, 10); 599 if (!interactive) { 600 perform(params); 601 } 602 } 603 604 608 public void testDeletionTh3Tx100Cr1() { 609 610 611 ParamsTest params = new ParamsTest(3, 100, 1, 1000000, 0, 100); 612 if (!interactive) { 613 perform(params); 614 } 615 } 616 617 621 public void testDeletionTh3Tx1000Cr1() { 622 623 624 ParamsTest params = new ParamsTest(3, 1000, 1, 1000000, 0, 1000); 625 if (!interactive) { 626 perform(params); 627 } 628 } 629 630 634 public void testDeletionTh3Tx10000Cr1() { 635 636 637 ParamsTest params = new ParamsTest(3, 10000, 1, 1000000, 0, 10000); 638 if (!interactive) { 639 perform(params); 640 } 641 } 642 643 647 public void _testDeletionTh3Tx100000Cr1() { 648 649 650 ParamsTest params = new ParamsTest(3, 100000, 1, 1000000, 0, 100000); 651 if (!interactive) { 652 perform(params); 653 } 654 } 655 656 660 public void testDeletionTh3Tx10Cr10() { 661 662 663 ParamsTest params = new ParamsTest(3, 10, 10, 1000000, 0, 100); 664 if (!interactive) { 665 perform(params); 666 } 667 } 668 669 673 public void testDeletionTh3Tx100Cr10() { 674 675 676 ParamsTest params = new ParamsTest(3, 100, 10, 1000000, 0, 1000); 677 if (!interactive) { 678 perform(params); 679 } 680 } 681 682 686 public void testDeletionTh3Tx1000Cr10() { 687 688 689 ParamsTest params = new ParamsTest(3, 1000, 10, 1000000, 0, 10000); 690 if (!interactive) { 691 perform(params); 692 } 693 } 694 695 699 public void testDeletionTh3Tx10000Cr10() { 700 701 702 ParamsTest params = new ParamsTest(3, 10000, 10, 1000000, 0, 100000); 703 if (!interactive) { 704 perform(params); 705 } 706 } 707 708 712 public void _testDeletionTh3Tx100000Cr10() { 713 714 715 ParamsTest params = new ParamsTest(3, 100000, 10, 1000000, 0, 1000000); 716 if (!interactive) { 717 perform(params); 718 } 719 } 720 721 725 public void testDeletionTh4Tx100Cr1() { 726 727 728 ParamsTest params = new ParamsTest(4, 100, 1, 1000000, 0, 100); 729 if (!interactive) { 730 perform(params); 731 } 732 } 733 734 738 public void testDeletionTh4Tx1000Cr1() { 739 740 741 ParamsTest params = new ParamsTest(4, 1000, 1, 1000000, 0, 1000); 742 if (!interactive) { 743 perform(params); 744 } 745 } 746 747 751 public void testDeletionTh4Tx10000Cr1() { 752 753 754 ParamsTest params = new ParamsTest(4, 10000, 1, 1000000, 0, 10000); 755 if (!interactive) { 756 perform(params); 757 } 758 } 759 760 764 public void _testDeletionTh4Tx100000Cr1() { 765 766 767 768 ParamsTest params = new ParamsTest(4, 100000, 1, 1000000, 0, 100000); 769 if (!interactive) { 770 perform(params); 771 } 772 } 773 774 778 public void testDeletionTh4Tx10Cr10() { 779 780 781 ParamsTest params = new ParamsTest(4, 10, 10, 1000000, 0, 100); 782 if (!interactive) { 783 perform(params); 784 } 785 } 786 787 791 public void testDeletionTh4Tx1000Cr10() { 792 793 794 ParamsTest params = new ParamsTest(4, 1000, 10, 1000000, 0, 10000); 795 if (!interactive) { 796 perform(params); 797 } 798 } 799 800 804 public void testDeletionTh4Tx10000Cr10() { 805 806 807 ParamsTest params = new ParamsTest(4, 10000, 10, 1000000, 0, 100000); 808 if (!interactive) { 809 perform(params); 810 } 811 } 812 813 817 public void _testDeletionTh4Tx100000Cr10() { 818 819 820 ParamsTest params = new ParamsTest(4, 100000, 10, 1000000, 0, 1000000); 821 if (!interactive) { 822 perform(params); 823 } 824 } 825 826 830 public void testDeletionTh4Tx100Cr500() { 831 832 833 ParamsTest params = new ParamsTest(4, 100, 500, 1000000, 0, 50000); 834 if (!interactive) { 835 perform(params); 836 } 837 } 838 839 843 public void testDeletionTh4Tx1000Cr500() { 844 845 846 ParamsTest params = new ParamsTest(4, 1000, 500, 1000000, 0, 500000); 847 if (!interactive) { 848 perform(params); 849 } 850 } 851 852 856 public void testDeletionTh4Tx100Cr10000() { 857 858 859 ParamsTest params = new ParamsTest(4, 100, 10000, 10000000, 1000000); 860 if (!interactive) { 861 perform(params); 862 } 863 } 864 865 869 public void testDeletionTh10Tx10Cr1() { 870 871 872 ParamsTest params = new ParamsTest(10, 10, 1, 1000000, 0, 10); 873 if (!interactive) { 874 perform(params); 875 } 876 } 877 878 882 public void testDeletionTh10Tx100Cr1() { 883 884 885 ParamsTest params = new ParamsTest(10, 100, 1, 1000000, 0, 100); 886 if (!interactive) { 887 perform(params); 888 } 889 } 890 891 895 public void testDeletionTh10Tx1000Cr1() { 896 897 898 ParamsTest params = new ParamsTest(10, 1000, 1, 1000000, 0, 1000); 899 if (!interactive) { 900 perform(params); 901 } 902 } 903 904 908 public void testDeletionTh10Tx10000Cr1() { 909 910 911 ParamsTest params = new ParamsTest(10, 10000, 1, 1000000, 0, 10000); 912 if (!interactive) { 913 perform(params); 914 } 915 } 916 917 921 public void _testDeletionTh10Tx100000Cr1() { 922 923 924 ParamsTest params = new ParamsTest(10, 100000, 1, 1000000, 0, 100000); 925 if (!interactive) { 926 perform(params); 927 } 928 } 929 930 934 public void testDeletionTh10Tx10Cr10() { 935 936 937 ParamsTest params = new ParamsTest(10, 10, 10, 1000000, 0, 100); 938 if (!interactive) { 939 perform(params); 940 } 941 } 942 943 947 public void testDeletionTh10Tx100Cr10() { 948 949 950 ParamsTest params = new ParamsTest(10, 100, 10, 1000000, 0, 1000); 951 if (!interactive) { 952 perform(params); 953 } 954 } 955 956 960 public void testDeletionTh10Tx1000Cr10() { 961 962 963 ParamsTest params = new ParamsTest(10, 1000, 10, 1000000, 0, 10000); 964 if (!interactive) { 965 perform(params); 966 } 967 } 968 969 973 public void testDeletionTh10Tx10000Cr10() { 974 975 976 ParamsTest params = new ParamsTest(10, 10000, 10, 1000000, 0, 100000); 977 if (!interactive) { 978 perform(params); 979 } 980 } 981 982 986 public void _testDeletionTh10Tx100000Cr10() { 987 988 989 ParamsTest params = new ParamsTest(10, 100000, 10, 1000000, 0, 1000000); 990 if (!interactive) { 991 perform(params); 992 } 993 } 994 995 999 public void testDeletionTh10Tx100Cr500() { 1000 1001 1002 ParamsTest params = new ParamsTest(10, 100, 500, 1000000, 0, 50000); 1003 if (!interactive) { 1004 perform(params); 1005 } 1006 } 1007 1008 1012 public void testDeletionTh10Tx1000Cr500() { 1013 1014 1015 ParamsTest params = new ParamsTest(10, 1000, 500, 1000000, 0, 500000); 1016 if (!interactive) { 1017 perform(params); 1018 } 1019 } 1020 1021 1025 public void testDeletionTh10Tx1000Cr1000() { 1026 1027 1028 ParamsTest params = new ParamsTest(10, 1000, 1000, 1000000, 0, 1000000); 1029 if (!interactive) { 1030 perform(params); 1031 } 1032 } 1033 1034 1038 public void testDeletionTh10Tx100Cr10000() { 1039 1040 1041 1042 ParamsTest params = new ParamsTest(10, 100, 10000, 10000000, 0, 1000000); 1043 1044 if (!interactive) { 1045 perform(params); 1046 } 1047 } 1048 1049} 1050 | Popular Tags |