JavaMonitorsTests.st
changeset 2396 fadc6d7a2f5b
parent 2353 fa7400d022a0
child 2429 ebece4dcaab9
child 2678 c865275e48a7
equal deleted inserted replaced
2390:47358426d752 2396:fadc6d7a2f5b
    51      as of 1.9.2010
    51      as of 1.9.2010
    52 
    52 
    53 "
    53 "
    54 ! !
    54 ! !
    55 
    55 
       
    56 
    56 !JavaMonitorsTests class methodsFor:'accessing'!
    57 !JavaMonitorsTests class methodsFor:'accessing'!
    57 
    58 
    58 resources
    59 resources
    59 
    60 
    60   ^ Array 
    61   ^ Array 
    63         with: JavaTestsResource
    64         with: JavaTestsResource
    64 
    65 
    65     "Created: / 30-03-2012 / 13:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    66     "Created: / 30-03-2012 / 13:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    66 ! !
    67 ! !
    67 
    68 
       
    69 
    68 !JavaMonitorsTests methodsFor:'accessing'!
    70 !JavaMonitorsTests methodsFor:'accessing'!
    69 
    71 
    70 timeout
    72 timeout
    71     ^60 * 5 "/5 min"
    73     ^60 * 5 "/5 min"
    72 
    74 
    73     "Created: / 03-12-2012 / 19:35:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    75     "Created: / 03-12-2012 / 19:35:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    74 ! !
    76 ! !
       
    77 
    75 
    78 
    76 !JavaMonitorsTests methodsFor:'mh exploratory tests'!
    79 !JavaMonitorsTests methodsFor:'mh exploratory tests'!
    77 
    80 
    78 _testAssertInAnotherThreadShouldFail
    81 _testAssertInAnotherThreadShouldFail
    79     | t |
    82     | t |
   144     self validateResult."
   147     self validateResult."
   145 
   148 
   146     "Created: / 20-11-2011 / 20:50:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   149     "Created: / 20-11-2011 / 20:50:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   147 ! !
   150 ! !
   148 
   151 
       
   152 
   149 !JavaMonitorsTests methodsFor:'multithreading testing support'!
   153 !JavaMonitorsTests methodsFor:'multithreading testing support'!
   150 
   154 
   151 assert: aBoolean message: message 
   155 assert: aBoolean message: message 
   152     assertionAccess critical: [
   156     assertionAccess critical: [
   153     result ifTrue: [
   157     result ifTrue: [
   203 waitForWaitingThread: aThread 
   207 waitForWaitingThread: aThread 
   204     [ aThread isWaiting ] whileFalse: [ Delay waitForMilliseconds: 100 ].
   208     [ aThread isWaiting ] whileFalse: [ Delay waitForMilliseconds: 100 ].
   205 
   209 
   206     "Created: / 20-11-2011 / 20:55:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   210     "Created: / 20-11-2011 / 20:55:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   207 ! !
   211 ! !
       
   212 
   208 
   213 
   209 !JavaMonitorsTests methodsFor:'tests'!
   214 !JavaMonitorsTests methodsFor:'tests'!
   210 
   215 
   211 testBruteForceEnter
   216 testBruteForceEnter
   212     | mon  threads  cleanupThread |
   217     | mon  threads  cleanupThread |
   364     self validateResult.
   369     self validateResult.
   365 
   370 
   366     "Created: / 20-11-2011 / 14:51:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   371     "Created: / 20-11-2011 / 14:51:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   367 ! !
   372 ! !
   368 
   373 
       
   374 
   369 !JavaMonitorsTests methodsFor:'tests-java'!
   375 !JavaMonitorsTests methodsFor:'tests-java'!
   370 
   376 
   371 test_releasing_01
   377 test_releasing_01
   372     "This tests call Java code in following setup:
   378     "This tests call Java code in following setup:
   373         - a java method with handler that calls
   379         - a java method with handler that calls
   429 
   435 
   430     self assert: (JavaVM enteredMonitorsOfProcess: thisProcess) isEmptyOrNil.
   436     self assert: (JavaVM enteredMonitorsOfProcess: thisProcess) isEmptyOrNil.
   431 
   437 
   432     "Created: / 07-04-2012 / 08:42:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   438     "Created: / 07-04-2012 / 08:42:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   433 ! !
   439 ! !
       
   440 
   434 
   441 
   435 !JavaMonitorsTests methodsFor:'wait notify tests'!
   442 !JavaMonitorsTests methodsFor:'wait notify tests'!
   436 
   443 
   437 testManyThreadsWaitNotifyAll
   444 testManyThreadsWaitNotifyAll
   438     | mon  threads |
   445     | mon  threads |
   563     self validateResult.
   570     self validateResult.
   564 
   571 
   565     "Created: / 22-11-2011 / 12:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   572     "Created: / 22-11-2011 / 12:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
   566 ! !
   573 ! !
   567 
   574 
       
   575 
   568 !JavaMonitorsTests class methodsFor:'documentation'!
   576 !JavaMonitorsTests class methodsFor:'documentation'!
   569 
   577 
   570 version_CVS
   578 version_CVS
   571     ^ '$Header: /cvs/stx/stx/libjava/JavaMonitorsTests.st,v 1.1 2013-02-16 18:08:32 vrany Exp $'
   579     ^ '$Header: /cvs/stx/stx/libjava/JavaMonitorsTests.st,v 1.2 2013-02-25 11:15:31 vrany Exp $'
   572 !
   580 !
   573 
   581 
   574 version_HG
   582 version_HG
   575 
   583 
   576     ^ '$Changeset: <not expanded> $'
   584     ^ '$Changeset: <not expanded> $'