1 18 19 package org.objectweb.speedo.stress; 20 21 import org.objectweb.speedo.api.ExceptionHelper; 22 import org.objectweb.speedo.pobjects.userid.IntUserId; 23 import org.objectweb.util.monolog.api.BasicLevel; 24 25 import javax.jdo.PersistenceManager; 26 import javax.jdo.JDOException; 27 import javax.jdo.JDOFatalException; 28 29 import junit.framework.TestSuite; 30 import junit.textui.TestRunner; 31 32 36 public class TestCreDel extends StressHelper { 37 38 protected String CREATION = getLoggerName() + ".creation"; 39 protected String THRESHOLD = getLoggerName() + ".threshold"; 40 41 public TestCreDel(String s) { 42 super(s); 43 } 44 protected String getLoggerName() { 45 return STRESS_LOG_NAME + ".stress.TestCreDel"; 46 } 47 48 protected String [] getClassNamesToInit() { 49 return new String []{IntUserId.class.getName()}; 50 } 51 52 public static void main(String [] args) { 53 TestRunner.run(new TestSuite(TestCreDel.class)); 54 } 55 56 class CreDelContext { 57 public int nbCreDel; 58 public int startId; 59 public int threshold; 60 public CreDelContext(int nbCreDel, int startId, int threshold) { 61 this.nbCreDel = nbCreDel; 62 this.startId = startId; 63 this.threshold = threshold; 64 } 65 66 public String toString() { 67 return "nbCreDel = " + nbCreDel + " / startid = " + startId 68 + " / threshold = " + threshold; 69 } 70 } 71 72 class CreDelThreadManager extends TaskManager { 73 public boolean[] txCreateStarted; 74 public Threshold threshold; 75 76 public CreDelThreadManager(int[] nbThread, 77 int[] nbTx, 78 int timeout, 79 Object ctx) { 80 super(nbThread, nbTx, timeout, ctx); 81 threshold = new Threshold(((CreDelContext) ctx).threshold); 82 txCreateStarted = new boolean[nbTx[0]]; 83 } 84 85 public Task newTask(int taskId, 86 int nbTx, 87 int nbThread, 88 TaskManager taskManager, 89 Object ctx) { 90 return new CreDelTask(taskId, nbTx, nbThread,taskManager); 91 } 92 } 93 94 class CreDelTask extends Task { 95 public CreDelTask(int taskId, 96 int nbTx, 97 int nbThread, 98 TaskManager taskManager) { 99 super(taskId, nbTx, nbThread, taskManager); 100 } 101 102 public int getTxId(int threadId) { 103 if (taskId == 0) { 104 return getCreateTxId(threadId); 105 } else if (taskId == 1) { 106 return getDeleteTxId(threadId); 107 } else { 108 return -1; 109 } 110 } 111 public int getCreateTxId(int threadId) { 112 synchronized (txToExecute) { 113 boolean[] txCreateStarted = ((CreDelThreadManager) taskManager).txCreateStarted; 114 for (int txId = 0; txId < txToExecute.length; txId++) { 115 if (txToExecute[txId]) { 116 if (txCreateStarted[txId]) { 117 continue; 118 } 119 txCreateStarted[txId] = true; 120 return txId; 121 } 122 } 123 } 124 return -1; 125 } 126 public int getDeleteTxId(int threadId) { 127 boolean[] txCreateToExecute = ((CreDelThreadManager) taskManager).tasks[0].txToExecute; 128 synchronized (txCreateToExecute) { 129 int txId; 130 int nbDel = 0; 131 for (txId = 0; txId < txToExecute.length; txId++) { 132 if (!txToExecute[txId]) { 133 nbDel++; 134 continue; 135 } 136 if (!txCreateToExecute[txId]) { 137 break; 138 } 139 } 140 if (txId == txToExecute.length) { 141 if (nbDel == txToExecute.length) { 142 return -1; 143 } 144 try { 145 logger.log(BasicLevel.DEBUG, 146 "Deletion thread " + threadId + " go to sleep"); 147 txCreateToExecute.wait(); 148 logger.log(BasicLevel.DEBUG, 149 "Deletion thread " + threadId + " wakes up!!!"); 150 } catch (InterruptedException e) { 151 } 152 return -2; 153 } else { 154 if (!((CreDelThreadManager) taskManager).threshold.canDelete()) { 155 try { 156 logger.log(BasicLevel.DEBUG, "Deletion thread " 157 + threadId + " go to sleep (threshold/level=" 158 + ((CreDelThreadManager) taskManager).threshold.getLevel() + ")..."); 159 txCreateToExecute.wait(); 160 logger.log(BasicLevel.DEBUG, "Deletion thread " 161 + threadId + " wakes up (threshold)!!!"); 162 } catch (InterruptedException e) { 163 } 164 return -2; 165 } 166 } 167 txToExecute[txId] = false; 168 ((CreDelThreadManager) taskManager).threshold.deleteDone(); 169 return txId; 170 } 171 } 172 } 173 174 protected void perform(Task task, int threadId, int txId, Object ctx, PerformResult res) { 175 if (task.taskId == 0) { 176 performCreate(task, threadId, txId, ctx, res); 177 } else if (task.taskId == 1) { 178 performRemove(task, threadId, txId, ctx, res); 179 } else { 180 throw new RuntimeException ("Task Id not managed: " + task.taskId); 181 } 182 } 183 184 protected void performCreate(Task task, int threadId, int txId, Object _ctx, PerformResult res) { 185 CreDelContext ctx = (CreDelContext) _ctx; 186 PersistenceManager pm = getPM(task, threadId,txId); 187 try { 188 res.beginTest(); 189 beginTx(pm, task, threadId, txId); 190 for (int no = 0; no < ctx.nbCreDel; no++) { 191 int oid = (txId * ctx.nbCreDel) + no + ctx.startId; 192 if (debug) { 193 logger.log(BasicLevel.DEBUG, "Creating object " + oid); 194 } 195 IntUserId iui = new IntUserId(oid, "Obj No " + oid); 196 pm.makePersistent(iui); 197 } 198 commitTx(pm, task, threadId, txId); 199 res.endTest(); 200 } catch (JDOFatalException e) { 201 rollbackExceptions.add(e); 202 res.ok = false; 203 logger.log(BasicLevel.INFO, "Creation thread " + threadId + " has been rolledback: try again !", e); 204 if (pm.currentTransaction().isActive()) { 205 pm.currentTransaction().rollback(); 206 errors.add(e); 207 } 208 } catch (Exception e) { 209 Exception ie = ExceptionHelper.getNested(e); 210 errors.add(ie); 211 res.ok = false; 212 logger.log(BasicLevel.ERROR, "Creation thread " + threadId + " has a problem", ie); 213 pm.currentTransaction().rollback(); 214 } catch (Throwable e) { 215 logger.log(BasicLevel.ERROR, "Creation thread " + threadId + " has a problem", e); 216 res.ok = false; 217 pm.currentTransaction().rollback(); 218 } finally { 219 try { 220 task.txToExecute[txId] = false; 221 pm.close(); 222 } catch (JDOException e) { 223 logger.log(BasicLevel.ERROR, "Creation thread " + threadId 224 + " has been " 225 + (res.ok ? "committed" : "rolledback") 226 + " and the close occurs an error", e); 227 throw e; 228 } 229 } 230 231 synchronized (task.txToExecute) { 232 task.txToExecute[txId] = false; 233 Threshold threshold = ((CreDelThreadManager) task.taskManager).threshold; 234 threshold.createDone(); 235 if (txId == (task.txToExecute.length - 1)) { 236 for (int i = 0; i < threshold.getThreshold(); i++) { 237 threshold.createDone(); 238 } 239 } 240 task.txToExecute.notifyAll(); 241 } 242 } 243 244 protected void performRemove(Task task, int threadId, int txId, Object _ctx, PerformResult res) { 245 CreDelContext ctx = (CreDelContext) _ctx; 246 PersistenceManager pm = getPM(task, threadId,txId); 247 try { 248 res.beginTest(); 249 beginTx(pm, task, threadId, txId); 250 for (int no = 0; no < ctx.nbCreDel; no++) { 251 int id = (txId * ctx.nbCreDel) + no + ctx.startId; 252 Object oid = pm.newObjectIdInstance(IntUserId.class, String.valueOf(id)); 253 pm.deletePersistent(pm.getObjectById(oid, false)); 254 } 255 pm.currentTransaction().commit(); 256 res.endTest(); 257 logger.log(BasicLevel.DEBUG, "Deletion Tx " + txId + " finished"); 258 } catch (JDOFatalException e) { 259 rollbackOnException(pm, e, res, task, threadId, txId); 260 } catch (Throwable e) { 261 stopOnError(pm, e, res, task, threadId, txId); 262 } finally { 263 closePM(pm, threadId, txId, task, res); 264 } 265 } 266 267 private void perform(int nbth, int nbtx, int nbc, int to, int startid) { 268 perform(nbth, nbtx, to, new CreDelContext(nbc, startid, 0)); 269 } 270 271 272 273 277 public void testInteractive() { 278 if (interactive) { 279 perform(Integer.getInteger(THREAD, 10).intValue(), 280 Integer.getInteger(TX, 100).intValue(), 281 Integer.getInteger(TIMEOUT, 1000000).intValue(), 282 new CreDelContext( 283 Integer.getInteger(CREATION, 1000).intValue(), 0, 284 Integer.getInteger(THRESHOLD, 0).intValue())); 285 } 286 } 287 288 291 public void testCreDelTh1Tx10Cr1() { 292 if (!interactive) { 293 perform(1, 10, 1, 1000000, getStartId(ID_Th1Tx10Cr1)); 294 } 295 } 296 297 300 public void testCreDelTh1Tx100Cr1() { 301 if (!interactive) { 302 perform(1, 100, 1, 1000000, getStartId(ID_Th1Tx100Cr1)); 303 } 304 } 305 306 309 public void testCreDelTh1Tx1000Cr1() { 310 if (!interactive) { 311 perform(1, 1000, 1, 1000000, getStartId(ID_Th1Tx1000Cr1)); 312 } 313 } 314 315 318 public void testCreDelTh1Tx10000Cr1() { 319 if (!interactive) { 320 perform(1, 10000, 1, 1000000, getStartId(ID_Th1Tx10000Cr1)); 321 } 322 } 323 324 327 public void testCreDelTh1Tx100000Cr1() { 328 if (!interactive) { 329 perform(1, 100000, 1, 10000000, getStartId(ID_Th1Tx100000Cr1)); 330 } 331 } 332 333 336 public void testCreDelTh1Tx10Cr10() { 337 if (!interactive) { 338 perform(1, 10, 10, 1000000, getStartId(ID_Th1Tx10Cr10)); 339 } 340 } 341 342 345 public void testCreDelTh1Tx100Cr10() { 346 if (!interactive) { 347 perform(1, 100, 10, 1000000, getStartId(ID_Th1Tx100Cr10)); 348 } 349 } 350 351 354 public void testCreDelTh1Tx1000Cr10() { 355 if (!interactive) { 356 perform(1, 1000, 10, 1000000, getStartId(ID_Th1Tx1000Cr10)); 357 } 358 } 359 360 363 public void testCreDelTh1Tx10000Cr10() { 364 if (!interactive) { 365 perform(1, 10000, 10, 10000000, getStartId(ID_Th1Tx10000Cr10)); 366 } 367 } 368 369 372 public void testCreDelTh1Tx100000Cr10() { 373 if (!interactive) { 374 perform(1, 100000, 10, 100000000, getStartId(ID_Th1Tx100000Cr10)); 375 } 376 } 377 378 381 public void testCreDelTh1Tx10Cr100() { 382 if (!interactive) { 383 perform(1, 10, 100, 1000000, getStartId(ID_Th1Tx10Cr100)); 384 } 385 } 386 387 390 public void testCreDelTh1Tx100Cr100() { 391 if (!interactive) { 392 perform(1, 100, 100, 1000000, getStartId(ID_Th1Tx100Cr100)); 393 } 394 } 395 396 399 public void testCreDelTh1Tx1000Cr100() { 400 if (!interactive) { 401 perform(1, 1000, 100, 10000000, getStartId(ID_Th1Tx1000Cr100)); 402 } 403 } 404 405 408 public void testCreDelTh1Tx10000Cr100() { 409 if (!interactive) { 410 perform(1, 10000, 100, 100000000, getStartId(ID_Th1Tx10000Cr100)); 411 } 412 } 413 414 417 public void testCreDelTh1Tx10Cr500() { 418 if (!interactive) { 419 perform(1, 10, 500, 1000000, getStartId(ID_Th1Tx10Cr500)); 420 } 421 } 422 423 426 public void testCreDelTh1Tx100Cr500() { 427 if (!interactive) { 428 perform(1, 100, 500, 10000000, getStartId(ID_Th1Tx100Cr500)); 429 } 430 } 431 432 435 public void testCreDelTh1Tx1000Cr500() { 436 if (!interactive) { 437 perform(1, 1000, 500, 100000000, getStartId(ID_Th1Tx1000Cr500)); 438 } 439 } 440 441 444 public void testCreDelTh1Tx10Cr1000() { 445 if (!interactive) { 446 perform(1, 10, 1000, 1000000, getStartId(ID_Th1Tx10Cr1000)); 447 } 448 } 449 450 453 public void testCreDelTh1Tx100Cr1000() { 454 if (!interactive) { 455 perform(1, 100, 1000, 10000000, getStartId(ID_Th1Tx100Cr1000)); 456 } 457 } 458 459 462 public void testCreDelTh1Tx1000Cr1000() { 463 if (!interactive) { 464 perform(1, 1000, 1000, 100000000, getStartId(ID_Th1Tx1000Cr1000)); 465 } 466 } 467 468 471 public void testCreDelTh1Tx10Cr2000() { 472 if (!interactive) { 473 perform(1, 10, 2000, 10000000, getStartId(ID_Th1Tx10Cr2000)); 474 } 475 } 476 477 480 public void testCreDelTh1Tx100Cr2000() { 481 if (!interactive) { 482 perform(1, 100, 2000, 100000000, getStartId(ID_Th1Tx100Cr2000)); 483 } 484 } 485 486 489 public void testCreDelTh1Tx1000Cr2000() { 490 if (!interactive) { 491 perform(1, 1000, 2000, 1000000000, getStartId(ID_Th1Tx1000Cr2000)); 492 } 493 } 494 495 498 public void testCreDelTh1Tx10Cr10000() { 499 if (!interactive) { 500 perform(1, 10, 10000, 100000000, getStartId(ID_Th1Tx10Cr10000)); 501 } 502 } 503 504 507 public void testCreDelTh1Tx100Cr10000() { 508 if (!interactive) { 509 perform(1, 100, 10000, 1000000000, getStartId(ID_Th1Tx100Cr10000)); 510 } 511 } 512 513 516 public void testCreDelTh2Tx10Cr1() { 517 if (!interactive) { 518 perform(2, 10, 1, 1000000, getStartId(ID_Th2Tx10Cr1)); 519 } 520 } 521 522 525 public void testCreDelTh2Tx100Cr1() { 526 527 528 if (!interactive) { 529 perform(2, 100, 1, 1000000, getStartId(ID_Th2Tx100Cr1)); 530 } 531 } 532 533 536 public void testCreDelTh2Tx1000Cr1() { 537 538 539 if (!interactive) { 540 perform(2, 1000, 1, 1000000, getStartId(ID_Th2Tx1000Cr1)); 541 } 542 } 543 544 547 public void testCreDelTh2Tx10000Cr1() { 548 549 550 if (!interactive) { 551 perform(2, 10000, 1, 1000000, getStartId(ID_Th2Tx10000Cr1)); 552 } 553 } 554 555 558 public void testCreDelTh2Tx100000Cr1() { 559 560 561 if (!interactive) { 562 perform(2, 100000, 1, 1000000, getStartId(ID_Th2Tx100000Cr1)); 563 } 564 } 565 566 569 public void testCreDelTh2Tx10Cr10() { 570 571 572 if (!interactive) { 573 perform(2, 10, 10, 1000000, getStartId(ID_Th2Tx10Cr10)); 574 } 575 } 576 577 580 public void testCreDelTh2Tx100Cr10() { 581 582 583 if (!interactive) { 584 perform(2, 100, 10, 1000000, getStartId(ID_Th2Tx100Cr10)); 585 } 586 } 587 588 591 public void testCreDelTh2Tx1000Cr10() { 592 593 594 if (!interactive) { 595 perform(2, 1000, 10, 1000000, getStartId(ID_Th2Tx1000Cr10)); 596 } 597 } 598 599 602 public void testCreDelTh2Tx10000Cr10() { 603 604 605 if (!interactive) { 606 perform(2, 10000, 10, 1000000, getStartId(ID_Th2Tx10000Cr10)); 607 } 608 } 609 610 613 public void testCreDelTh2Tx100000Cr10() { 614 615 616 if (!interactive) { 617 perform(2, 100000, 10, 1000000, getStartId(ID_Th2Tx100000Cr10)); 618 } 619 } 620 621 624 public void testCreDelTh2Tx10Cr100() { 625 626 627 if (!interactive) { 628 perform(2, 10, 100, 1000000, getStartId(ID_Th2Tx10Cr100)); 629 } 630 } 631 632 635 public void testCreDelTh2Tx100Cr100() { 636 637 638 if (!interactive) { 639 perform(2, 100, 100, 1000000, getStartId(ID_Th2Tx100Cr100)); 640 } 641 } 642 643 646 public void testCreDelTh2Tx1000Cr100() { 647 648 649 if (!interactive) { 650 perform(2, 1000, 100, 1000000, getStartId(ID_Th2Tx1000Cr100)); 651 } 652 } 653 654 657 public void testCreDelTh2Tx10000Cr100() { 658 659 660 if (!interactive) { 661 perform(2, 10000, 100, 1000000, getStartId(ID_Th2Tx10000Cr100)); 662 } 663 } 664 665 668 public void testCreDelTh2Tx10Cr500() { 669 670 671 if (!interactive) { 672 perform(2, 10, 500, 1000000, getStartId(ID_Th2Tx10Cr500)); 673 } 674 } 675 676 679 public void testCreDelTh2Tx100Cr500() { 680 681 682 if (!interactive) { 683 perform(2, 100, 500, 1000000, getStartId(ID_Th2Tx100Cr500)); 684 } 685 } 686 687 690 public void testCreDelTh2Tx1000Cr500() { 691 692 693 if (!interactive) { 694 perform(2, 1000, 500, 1000000, getStartId(ID_Th2Tx1000Cr500)); 695 } 696 } 697 698 701 public void testCreDelTh2Tx10Cr1000() { 702 703 704 if (!interactive) { 705 perform(2, 10, 1000, 1000000, getStartId(ID_Th2Tx10Cr1000)); 706 } 707 } 708 709 712 public void testCreDelTh2Tx100Cr1000() { 713 714 715 if (!interactive) { 716 perform(2, 100, 1000, 1000000, getStartId(ID_Th2Tx100Cr1000)); 717 } 718 } 719 720 723 public void testCreDelTh2Tx1000Cr1000() { 724 725 726 if (!interactive) { 727 perform(2, 1000, 1000, 1000000, getStartId(ID_Th2Tx1000Cr1000)); 728 } 729 } 730 731 734 public void testCreDelTh2Tx10Cr2000() { 735 736 737 if (!interactive) { 738 perform(2, 10, 2000, 10000000, getStartId(ID_Th2Tx10Cr2000)); 739 } 740 } 741 742 745 public void testCreDelTh2Tx100Cr2000() { 746 747 748 if (!interactive) { 749 perform(2, 100, 2000, 10000000, getStartId(ID_Th2Tx100Cr2000)); 750 } 751 } 752 753 756 public void testCreDelTh2Tx1000Cr2000() { 757 758 759 if (!interactive) { 760 perform(2, 1000, 2000, 10000000, getStartId(ID_Th2Tx1000Cr2000)); 761 } 762 } 763 764 767 public void testCreDelTh2Tx10Cr10000() { 768 769 770 if (!interactive) { 771 perform(2, 10, 10000, 10000000, getStartId(ID_Th2Tx10Cr10000)); 772 } 773 } 774 775 778 public void testCreDelTh2Tx100Cr10000() { 779 780 781 if (!interactive) { 782 perform(2, 100, 10000, 10000000, getStartId(ID_Th2Tx100Cr10000)); 783 } 784 } 785 786 789 public void testCreDelTh3Tx10Cr1() { 790 791 792 if (!interactive) { 793 perform(3, 10, 1, 1000000, getStartId(ID_Th3Tx10Cr1)); 794 } 795 } 796 797 800 public void testCreDelTh3Tx100Cr1() { 801 802 803 if (!interactive) { 804 perform(3, 100, 1, 1000000, getStartId(ID_Th3Tx100Cr1)); 805 } 806 } 807 808 811 public void testCreDelTh3Tx1000Cr1() { 812 813 814 if (!interactive) { 815 perform(3, 1000, 1, 1000000, getStartId(ID_Th3Tx1000Cr1)); 816 } 817 } 818 819 822 public void testCreDelTh3Tx10000Cr1() { 823 824 825 if (!interactive) { 826 perform(3, 10000, 1, 1000000, getStartId(ID_Th3Tx10000Cr1)); 827 } 828 } 829 830 833 public void testCreDelTh3Tx100000Cr1() { 834 835 836 if (!interactive) { 837 perform(3, 100000, 1, 1000000, getStartId(ID_Th3Tx100000Cr1)); 838 } 839 } 840 841 844 public void testCreDelTh3Tx10Cr10() { 845 846 847 if (!interactive) { 848 perform(3, 10, 10, 1000000, getStartId(ID_Th3Tx10Cr10)); 849 } 850 } 851 852 855 public void testCreDelTh3Tx100Cr10() { 856 857 858 if (!interactive) { 859 perform(3, 100, 10, 1000000, getStartId(ID_Th3Tx100Cr10)); 860 } 861 } 862 863 866 public void testCreDelTh3Tx1000Cr10() { 867 868 869 if (!interactive) { 870 perform(3, 1000, 10, 1000000, getStartId(ID_Th3Tx1000Cr10)); 871 } 872 } 873 874 877 public void testCreDelTh3Tx10000Cr10() { 878 879 880 if (!interactive) { 881 perform(3, 10000, 10, 1000000, getStartId(ID_Th3Tx10000Cr10)); 882 } 883 } 884 885 888 public void testCreDelTh3Tx100000Cr10() { 889 890 891 if (!interactive) { 892 perform(3, 100000, 10, 1000000, getStartId(ID_Th3Tx100000Cr10)); 893 } 894 } 895 896 899 public void testCreDelTh3Tx10Cr100() { 900 901 902 if (!interactive) { 903 perform(3, 10, 100, 1000000, getStartId(ID_Th3Tx10Cr100)); 904 } 905 } 906 907 910 public void testCreDelTh3Tx100Cr100() { 911 912 913 if (!interactive) { 914 perform(3, 100, 100, 1000000, getStartId(ID_Th3Tx100Cr100)); 915 } 916 } 917 918 921 public void testCreDelTh3Tx1000Cr100() { 922 923 924 if (!interactive) { 925 perform(3, 1000, 100, 1000000, getStartId(ID_Th3Tx1000Cr100)); 926 } 927 } 928 929 932 public void testCreDelTh3Tx10000Cr100() { 933 934 935 if (!interactive) { 936 perform(3, 10000, 100, 1000000, getStartId(ID_Th3Tx10000Cr100)); 937 } 938 } 939 940 943 public void testCreDelTh3Tx10Cr500() { 944 945 946 if (!interactive) { 947 perform(3, 10, 500, 1000000, getStartId(ID_Th3Tx10Cr500)); 948 } 949 } 950 951 954 public void testCreDelTh3Tx100Cr500() { 955 956 957 if (!interactive) { 958 perform(3, 100, 500, 1000000, getStartId(ID_Th3Tx100Cr500)); 959 } 960 } 961 962 965 public void testCreDelTh3Tx1000Cr500() { 966 967 968 if (!interactive) { 969 perform(3, 1000, 500, 1000000, getStartId(ID_Th3Tx1000Cr500)); 970 } 971 } 972 973 976 public void testCreDelTh3Tx10Cr1000() { 977 978 979 if (!interactive) { 980 perform(3, 10, 1000, 1000000, getStartId(ID_Th3Tx10Cr1000)); 981 } 982 } 983 984 987 public void testCreDelTh3Tx100Cr1000() { 988 989 990 if (!interactive) { 991 perform(3, 100, 1000, 1000000, getStartId(ID_Th3Tx100Cr1000)); 992 } 993 } 994 995 998 public void testCreDelTh3Tx1000Cr1000() { 999 1000 1001 if (!interactive) { 1002 perform(3, 1000, 1000, 1000000, getStartId(ID_Th3Tx1000Cr1000)); 1003 } 1004 } 1005 1006 1009 public void testCreDelTh3Tx10Cr2000() { 1010 1011 1012 if (!interactive) { 1013 perform(3, 10, 2000, 10000000, getStartId(ID_Th3Tx10Cr2000)); 1014 } 1015 } 1016 1017 1020 public void testCreDelTh3Tx100Cr2000() { 1021 1022 1023 if (!interactive) { 1024 perform(3, 100, 2000, 10000000, getStartId(ID_Th3Tx100Cr2000)); 1025 } 1026 } 1027 1028 1031 public void testCreDelTh3Tx1000Cr2000() { 1032 1033 1034 if (!interactive) { 1035 perform(3, 1000, 2000, 10000000, getStartId(ID_Th3Tx1000Cr2000)); 1036 } 1037 } 1038 1039 1042 public void testCreDelTh3Tx10Cr10000() { 1043 1044 1045 if (!interactive) { 1046 perform(3, 10, 10000, 10000000, getStartId(ID_Th3Tx10Cr10000)); 1047 } 1048 } 1049 1050 1053 public void testCreDelTh3Tx100Cr10000() { 1054 1055 1056 if (!interactive) { 1057 perform(3, 100, 10000, 10000000, getStartId(ID_Th3Tx100Cr10000)); 1058 } 1059 } 1060 1061 1064 public void testCreDelTh4Tx10Cr1() { 1065 1066 1067 if (!interactive) { 1068 perform(4, 10, 1, 1000000, getStartId(ID_Th4Tx10Cr1)); 1069 } 1070 } 1071 1072 1075 public void testCreDelTh4Tx100Cr1() { 1076 1077 1078 if (!interactive) { 1079 perform(4, 100, 1, 1000000, getStartId(ID_Th4Tx100Cr1)); 1080 } 1081 } 1082 1083 1086 public void testCreDelTh4Tx1000Cr1() { 1087 1088 1089 if (!interactive) { 1090 perform(4, 1000, 1, 1000000, getStartId(ID_Th4Tx1000Cr1)); 1091 } 1092 } 1093 1094 1097 public void testCreDelTh4Tx10000Cr1() { 1098 1099 1100 if (!interactive) { 1101 perform(4, 10000, 1, 1000000, getStartId(ID_Th4Tx10000Cr1)); 1102 } 1103 } 1104 1105 1108 public void testCreDelTh4Tx100000Cr1() { 1109 1110 1111 if (!interactive) { 1112 perform(4, 100000, 1, 1000000, getStartId(ID_Th4Tx100000Cr1)); 1113 } 1114 } 1115 1116 1119 public void testCreDelTh4Tx10Cr10() { 1120 1121 1122 if (!interactive) { 1123 perform(4, 10, 10, 1000000, getStartId(ID_Th4Tx10Cr10)); 1124 } 1125 } 1126 1127 1130 public void testCreDelTh4Tx100Cr10() { 1131 1132 1133 if (!interactive) { 1134 perform(4, 100, 10, 1000000, getStartId(ID_Th4Tx100Cr10)); 1135 } 1136 } 1137 1138 1141 public void testCreDelTh4Tx1000Cr10() { 1142 1143 1144 if (!interactive) { 1145 perform(4, 1000, 10, 1000000, getStartId(ID_Th4Tx1000Cr10)); 1146 } 1147 } 1148 1149 1152 public void testCreDelTh4Tx10000Cr10() { 1153 1154 1155 if (!interactive) { 1156 perform(4, 10000, 10, 1000000, getStartId(ID_Th4Tx10000Cr10)); 1157 } 1158 } 1159 1160 1163 public void testCreDelTh4Tx100000Cr10() { 1164 1165 1166 if (!interactive) { 1167 perform(4, 100000, 10, 1000000, getStartId(ID_Th4Tx100000Cr10)); 1168 } 1169 } 1170 1171 1174 public void testCreDelTh4Tx10Cr100() { 1175 1176 1177 if (!interactive) { 1178 perform(4, 10, 100, 1000000, getStartId(ID_Th4Tx10Cr100)); 1179 } 1180 } 1181 1182 1185 public void testCreDelTh4Tx100Cr100() { 1186 1187 1188 if (!interactive) { 1189 perform(4, 100, 100, 1000000, getStartId(ID_Th4Tx100Cr100)); 1190 } 1191 } 1192 1193 1196 public void testCreDelTh4Tx1000Cr100() { 1197 1198 1199 if (!interactive) { 1200 perform(4, 1000, 100, 1000000, getStartId(ID_Th4Tx1000Cr100)); 1201 } 1202 } 1203 1204 1207 public void testCreDelTh4Tx10000Cr100() { 1208 1209 1210 if (!interactive) { 1211 perform(4, 10000, 100, 1000000, getStartId(ID_Th4Tx10000Cr100)); 1212 } 1213 } 1214 1215 1218 public void testCreDelTh4Tx10Cr500() { 1219 1220 1221 if (!interactive) { 1222 perform(4, 10, 500, 1000000, getStartId(ID_Th4Tx10Cr500)); 1223 } 1224 } 1225 1226 1229 public void testCreDelTh4Tx100Cr500() { 1230 1231 1232 if (!interactive) { 1233 perform(4, 100, 500, 1000000, getStartId(ID_Th4Tx100Cr500)); 1234 } 1235 } 1236 1237 1240 public void testCreDelTh4Tx1000Cr500() { 1241 1242 1243 if (!interactive) { 1244 perform(4, 1000, 500, 1000000, getStartId(ID_Th4Tx1000Cr500)); 1245 } 1246 } 1247 1248 1251 public void testCreDelTh4Tx10Cr1000() { 1252 1253 1254 if (!interactive) { 1255 perform(4, 10, 1000, 1000000, getStartId(ID_Th4Tx10Cr1000)); 1256 } 1257 } 1258 1259 1262 public void testCreDelTh4Tx100Cr1000() { 1263 1264 1265 if (!interactive) { 1266 perform(4, 100, 1000, 1000000, getStartId(ID_Th4Tx100Cr1000)); 1267 } 1268 } 1269 1270 1273 public void testCreDelTh4Tx1000Cr1000() { 1274 1275 1276 if (!interactive) { 1277 perform(4, 1000, 1000, 1000000, getStartId(ID_Th4Tx1000Cr1000)); 1278 } 1279 } 1280 1281 1284 public void testCreDelTh4Tx10Cr2000() { 1285 1286 1287 if (!interactive) { 1288 perform(4, 10, 2000, 10000000, getStartId(ID_Th4Tx10Cr2000)); 1289 } 1290 } 1291 1292 1295 public void testCreDelTh4Tx100Cr2000() { 1296 1297 1298 if (!interactive) { 1299 perform(4, 100, 2000, 10000000, getStartId(ID_Th4Tx100Cr2000)); 1300 } 1301 } 1302 1303 1306 public void testCreDelTh4Tx1000Cr2000() { 1307 1308 1309 if (!interactive) { 1310 perform(4, 1000, 2000, 10000000, getStartId(ID_Th4Tx1000Cr2000)); 1311 } 1312 } 1313 1314 1317 public void testCreDelTh4Tx10Cr10000() { 1318 1319 1320 if (!interactive) { 1321 perform(4, 10, 10000, 10000000, getStartId(ID_Th4Tx10Cr10000)); 1322 } 1323 } 1324 1325 1328 public void testCreDelTh4Tx100Cr10000() { 1329 1330 1331 if (!interactive) { 1332 perform(4, 100, 10000, 10000000, getStartId(ID_Th4Tx100Cr10000)); 1333 } 1334 } 1335 1336 1339 public void testCreDelTh10Tx10Cr1() { 1340 1341 1342 if (!interactive) { 1343 perform(10, 10, 1, 1000000, getStartId(ID_Th10Tx10Cr1)); 1344 } 1345 } 1346 1347 1350 public void testCreDelTh10Tx100Cr1() { 1351 1352 1353 if (!interactive) { 1354 perform(10, 100, 1, 1000000, getStartId(ID_Th10Tx100Cr1)); 1355 } 1356 } 1357 1358 1361 public void testCreDelTh10Tx1000Cr1() { 1362 1363 1364 if (!interactive) { 1365 perform(10, 1000, 1, 1000000, getStartId(ID_Th10Tx1000Cr1)); 1366 } 1367 } 1368 1369 1372 public void testCreDelTh10Tx10000Cr1() { 1373 1374 1375 if (!interactive) { 1376 perform(10, 10000, 1, 1000000, getStartId(ID_Th10Tx10000Cr1)); 1377 } 1378 } 1379 1380 1383 public void testCreDelTh10Tx100000Cr1() { 1384 1385 1386 if (!interactive) { 1387 perform(10, 100000, 1, 1000000, getStartId(ID_Th10Tx100000Cr1)); 1388 } 1389 } 1390 1391 1394 public void testCreDelTh10Tx10Cr10() { 1395 1396 1397 if (!interactive) { 1398 perform(10, 10, 10, 1000000, getStartId(ID_Th10Tx10Cr10)); 1399 } 1400 } 1401 1402 1405 public void testCreDelTh10Tx100Cr10() { 1406 1407 1408 if (!interactive) { 1409 perform(10, 100, 10, 1000000, getStartId(ID_Th10Tx100Cr10)); 1410 } 1411 } 1412 1413 1416 public void testCreDelTh10Tx1000Cr10() { 1417 1418 1419 if (!interactive) { 1420 perform(10, 1000, 10, 1000000, getStartId(ID_Th10Tx1000Cr10)); 1421 } 1422 } 1423 1424 1427 public void testCreDelTh10Tx10000Cr10() { 1428 1429 1430 if (!interactive) { 1431 perform(10, 10000, 10, 1000000, getStartId(ID_Th10Tx10000Cr10)); 1432 } 1433 } 1434 1435 1438 public void testCreDelTh10Tx100000Cr10() { 1439 1440 1441 if (!interactive) { 1442 perform(10, 100000, 10, 1000000, getStartId(ID_Th10Tx100000Cr10)); 1443 } 1444 } 1445 1446 1449 public void testCreDelTh10Tx10Cr100() { 1450 1451 1452 if (!interactive) { 1453 perform(10, 10, 100, 1000000, getStartId(ID_Th10Tx10Cr100)); 1454 } 1455 } 1456 1457 1460 public void testCreDelTh10Tx100Cr100() { 1461 1462 1463 if (!interactive) { 1464 perform(10, 100, 100, 1000000, getStartId(ID_Th10Tx100Cr100)); 1465 } 1466 } 1467 1468 1471 public void testCreDelTh10Tx1000Cr100() { 1472 1473 1474 if (!interactive) { 1475 perform(10, 1000, 100, 1000000, getStartId(ID_Th10Tx1000Cr100)); 1476 } 1477 } 1478 1479 1482 public void testCreDelTh10Tx10000Cr100() { 1483 1484 1485 if (!interactive) { 1486 perform(10, 10000, 100, 1000000, getStartId(ID_Th10Tx10000Cr100)); 1487 } 1488 } 1489 1490 1493 public void testCreDelTh10Tx10Cr500() { 1494 if (!interactive) { 1495 perform(10, 10, 500, 1000000, getStartId(ID_Th10Tx10Cr500)); 1496 } 1497 } 1498 1499 1502 public void testCreDelTh10Tx100Cr500() { 1503 if (!interactive) { 1504 perform(10, 100, 500, 1000000, getStartId(ID_Th10Tx100Cr500)); 1505 } 1506 } 1507 1508 1511 public void testCreDelTh10Tx1000Cr500() { 1512 1513 1514 if (!interactive) { 1515 perform(10, 1000, 500, 1000000, getStartId(ID_Th10Tx1000Cr500)); 1516 } 1517 } 1518 1519 1522 public void testCreDelTh10Tx10Cr1000() { 1523 if (!interactive) { 1524 perform(10, 10, 1000, 1000000, getStartId(ID_Th10Tx10Cr1000)); 1525 } 1526 } 1527 1528 1531 public void testCreDelTh10Tx100Cr1000() { 1532 if (!interactive) { 1533 perform(10, 100, 1000, 1000000, getStartId(ID_Th10Tx100Cr1000)); 1534 } 1535 } 1536 1537 1540 public void testCreDelTh10Tx1000Cr1000() { 1541 if (!interactive) { 1542 perform(10, 1000, 1000, 1000000, getStartId(ID_Th10Tx1000Cr1000)); 1543 } 1544 } 1545 1546 1549 public void testCreDelTh10Tx10Cr2000() { 1550 if (!interactive) { 1551 perform(10, 10, 2000, 10000000, getStartId(ID_Th10Tx10Cr2000)); 1552 } 1553 } 1554 1555 1558 public void testCreDelTh10Tx100Cr2000() { 1559 if (!interactive) { 1560 perform(10, 100, 2000, 10000000, getStartId(ID_Th10Tx100Cr2000)); 1561 } 1562 } 1563 1564 1567 public void testCreDelTh10Tx1000Cr2000() { 1568 if (!interactive) { 1569 perform(10, 1000, 2000, 10000000, getStartId(ID_Th10Tx1000Cr2000)); 1570 } 1571 } 1572 1573 1576 public void testCreDelTh10Tx10Cr10000() { 1577 if (!interactive) { 1578 perform(10, 10, 10000, 10000000, getStartId(ID_Th10Tx10Cr10000)); 1579 } 1580 } 1581 1582 1585 public void testCreDelTh10Tx100Cr10000() { 1586 if (!interactive) { 1587 perform(10, 100, 10000, 10000000, getStartId(ID_Th10Tx100Cr10000)); 1588 } 1589 } 1590} 1591 1592class Threshold { 1593 private final int threshold; 1594 private int level; 1595 1596 Threshold(int th) { 1597 threshold = th; 1598 level = 0; 1599 } 1600 1601 void createDone() { 1602 level++; 1603 } 1604 1605 void deleteDone() { 1606 level--; 1607 } 1608 1609 boolean canDelete() { 1610 return level >= threshold; 1611 } 1612 1613 int getLevel() { 1614 return level; 1615 } 1616 1617 int getThreshold() { 1618 return threshold; 1619 } 1620} 1621 | Popular Tags |