"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
"{ Package: 'stx:libjava' }"
AbstractJavaTestCase subclass:#JavaRuntimeConstantPoolTests
instanceVariableNames:'constantPoolCacheBackup'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Tests-RuntimeConstantPool'
!
!JavaRuntimeConstantPoolTests class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
! !
!JavaRuntimeConstantPoolTests methodsFor:'helpers'!
cleanUpCPCache
"warning - counting with the fact that cp cache is backed up in setUp and restored in tearDown methods"
JavaConstantPool allConstantPools: OrderedCollection new.
"Created: / 13-05-2011 / 09:42:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaRuntimeConstantPoolTests methodsFor:'running'!
setUp
super setUp.
constantPoolCacheBackup := JavaConstantPool allConstantPools.
"Created: / 13-05-2011 / 09:33:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
tearDown
super tearDown.
JavaConstantPool allConstantPools: constantPoolCacheBackup.
"Created: / 13-05-2011 / 09:33:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaRuntimeConstantPoolTests methodsFor:'tests'!
testConstantPoolCaching
| newConstantPool |
JavaConstantPool allConstantPools: OrderedCollection new.
newConstantPool := self getPrettyBigConstantPool.
self
assertTrue: (JavaConstantPool allConstantPools includes: newConstantPool).
"Created: / 13-05-2011 / 09:36:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testInvalidateAll
| cp |
cp := self getPrettyBigConstantPool.
cp do: [:each | each isJavaRef ifTrue: [each resolve]].
cp
do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ].
cp invalidateAll.
cp
do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved not) ] ].
"Created: / 08-04-2011 / 17:03:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 13-05-2011 / 09:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testInvalidateForClass
| cp |
self cleanUpCPCache.
cp := self getPrettyBigConstantPool.
cp do: [:each | each isJavaRef ifTrue: [ each resolve ] ].
cp
do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ].
JavaConstantPool invalidateReferencesToClass: 'Ljava/lang/Runnable;'.
1 to: 13
do:
[:index |
(cp at: index) isJavaRef
ifTrue: [ self assertTrue: (cp at: index) isResolved ] ].
14 to: 20
do:
[:index |
(cp at: index) isJavaRef
ifTrue: [ self assertTrue: (cp at: index) isResolved not ] ].
"Created: / 08-04-2011 / 17:10:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 23-05-2011 / 15:29:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaRuntimeConstantPoolTests class methodsFor:'documentation'!
version_SVN
^ '$Id: JavaRuntimeConstantPoolTests.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
! !