author | hlopkmar |
Sat, 01 Dec 2012 22:06:11 +0000 | |
branch | development |
changeset 1851 | d74d5dc547f3 |
parent 1835 | 764f75cfd4d0 |
child 1953 | 1e42ad3fc322 |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
1515 | 23 |
JavaRefsAndConstantPoolTestCase subclass:#JavaRuntimeConstantPoolTests |
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
24 |
instanceVariableNames:'constantPoolCacheBackup' |
752 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaRuntimeConstantPoolTests class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
752 | 55 |
|
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
56 |
!JavaRuntimeConstantPoolTests methodsFor:'helpers'! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
57 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
58 |
cleanUpCPCache |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
59 |
"warning - counting with the fact that cp cache is backed up in setUp and restored in tearDown methods" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
60 |
JavaConstantPool allConstantPools: OrderedCollection new. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
61 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
62 |
"Created: / 13-05-2011 / 09:42:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
63 |
! ! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
64 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
65 |
!JavaRuntimeConstantPoolTests methodsFor:'running'! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
66 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
67 |
setUp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
68 |
super setUp. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
69 |
constantPoolCacheBackup := JavaConstantPool allConstantPools. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
70 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
71 |
"Created: / 13-05-2011 / 09:33:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
72 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
73 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
74 |
tearDown |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
75 |
super tearDown. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
76 |
JavaConstantPool allConstantPools: constantPoolCacheBackup. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
77 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
78 |
"Created: / 13-05-2011 / 09:33:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
79 |
! ! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
80 |
|
771 | 81 |
!JavaRuntimeConstantPoolTests methodsFor:'tests'! |
82 |
||
1469 | 83 |
_testConstantPoolCaching |
84 |
"will be enabled when caching and invalidation is implemented" |
|
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
85 |
| newConstantPool | |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
86 |
JavaConstantPool allConstantPools: OrderedCollection new. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
87 |
newConstantPool := self getPrettyBigConstantPool. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
88 |
self |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
89 |
assertTrue: (JavaConstantPool allConstantPools includes: newConstantPool). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
90 |
|
1469 | 91 |
"Created: / 12-04-2012 / 10:16:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
92 |
! |
|
93 |
||
1829 | 94 |
_testInvalidateAll |
95 |
| cp | |
|
96 |
cp := self getPrettyBigConstantPool. |
|
97 |
cp do: [:each | each isJavaRef ifTrue: [ each resolve ] ]. |
|
98 |
cp do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ]. |
|
99 |
cp invalidateAll. |
|
100 |
cp do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved not) ] ]. |
|
101 |
||
102 |
"Created: / 17-11-2012 / 21:44:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
103 |
! |
|
104 |
||
1469 | 105 |
_testInvalidateForClass |
106 |
"will be enabled when caching and invalidation is implemented" |
|
107 |
| cp | |
|
108 |
self cleanUpCPCache. |
|
109 |
cp := self getPrettyBigConstantPool. |
|
110 |
cp do: [:each | each isJavaRef ifTrue: [ each resolve ] ]. |
|
111 |
cp do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ]. |
|
112 |
JavaConstantPool invalidateReferencesToClass: 'Ljava/lang/Runnable;'. |
|
113 |
1 to: 13 do: [ |
|
114 |
:index | |
|
115 |
(cp at: index) isJavaRef ifTrue: [ self assertTrue: (cp at: index) isResolved ] |
|
116 |
]. |
|
117 |
14 to: 20 do: [ |
|
118 |
:index | |
|
119 |
(cp at: index) isJavaRef ifTrue: [ |
|
120 |
self assertTrue: (cp at: index) isResolved not |
|
121 |
] |
|
122 |
]. |
|
123 |
||
124 |
"Created: / 12-04-2012 / 10:16:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
771 | 125 |
! ! |
126 |
||
752 | 127 |
!JavaRuntimeConstantPoolTests class methodsFor:'documentation'! |
128 |
||
129 |
version_SVN |
|
130 |
^ '$Id$' |
|
131 |
! ! |