author | vranyj1 |
Sat, 11 Jun 2011 15:07:29 +0000 | |
branch | jk_new_structure |
changeset 848 | b06ee9c295d9 |
parent 841 | 4db3d65dfd33 |
child 849 | 0addf2406912 |
permissions | -rw-r--r-- |
752 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
3 |
TestResource subclass:#JavaTestsResource |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Languages-Java-Tests' |
|
8 |
! |
|
9 |
||
763 | 10 |
JavaTestsResource class instanceVariableNames:'testsBuilded' |
752 | 11 |
|
12 |
" |
|
13 |
The following class instance variables are inherited by this class: |
|
14 |
||
15 |
TestResource - current |
|
16 |
TestAsserter - |
|
17 |
Object - |
|
18 |
" |
|
19 |
! |
|
20 |
||
21 |
||
22 |
!JavaTestsResource class methodsFor:'initialization'! |
|
23 |
||
24 |
initialize |
|
25 |
"Invoked at system start or when the class is dynamically loaded." |
|
26 |
"/ please change as required (and remove this comment) |
|
27 |
||
763 | 28 |
testsBuilded := false. |
752 | 29 |
|
30 |
"Modified: / 16-03-2011 / 14:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
841 | 31 |
"Modified: / 04-06-2011 / 18:01:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 32 |
! ! |
33 |
||
34 |
!JavaTestsResource class methodsFor:'accessing'! |
|
35 |
||
848
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
36 |
classpath |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
37 |
|cp| |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
38 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
39 |
cp := OrderedCollection new. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
40 |
self testsDirectory |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
41 |
directoryContentsAsFilenamesDo:[:dir | cp := cp , (self classpathFor:dir) ]. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
42 |
^ cp |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
43 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
44 |
" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
45 |
JavaTestsResource testsClasspath" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
46 |
"Created: / 07-05-2011 / 18:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
47 |
"Modified: / 11-06-2011 / 15:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
48 |
! |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
49 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
50 |
classpathFor:testProject |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
51 |
|cp dir| |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
52 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
53 |
cp := OrderedCollection new. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
54 |
dir := self testsDirectory / testProject. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
55 |
dir isDirectory |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
56 |
ifTrue: |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
57 |
[ (dir / 'bin') exists ifTrue:[ cp add:(dir / 'bin') asString ]. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
58 |
(dir / 'lib') exists |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
59 |
ifTrue: |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
60 |
[ cp addAll:((dir / 'lib') directoryContentsAsFilenames |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
61 |
select:[:jar | jar suffix = 'jar' ]) ] ]. |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
62 |
^ cp |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
63 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
64 |
" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
65 |
JavaTestsResource testsClasspath" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
66 |
"Created: / 11-06-2011 / 15:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
67 |
! |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
68 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
69 |
classpathForMauve |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
70 |
^ self classpathFor:'libjava-mauve' |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
71 |
|
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
72 |
" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
73 |
JavaTestsResource testsClasspathForMauve" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
74 |
"Created: / 11-06-2011 / 15:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
75 |
! |
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
76 |
|
763 | 77 |
testsBuilded |
78 |
||
79 |
^testsBuilded == true |
|
752 | 80 |
|
763 | 81 |
"Created: / 07-05-2011 / 18:44:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
82 |
! |
|
83 |
||
84 |
testsBuilded:aBoolean |
|
752 | 85 |
" |
86 |
JavaTestsResource projectBuilded: true. |
|
763 | 87 |
JavaTestsResource projectBuilded: false." |
88 |
||
89 |
testsBuilded := aBoolean. |
|
752 | 90 |
|
91 |
"Modified: / 16-03-2011 / 15:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
92 |
! |
|
93 |
||
763 | 94 |
testsDirectory |
95 |
^ UserPreferences current javaTestsDirectory asFilename |
|
96 |
||
97 |
"Modified: / 07-05-2011 / 17:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 98 |
! ! |
99 |
||
100 |
!JavaTestsResource class methodsFor:'running'! |
|
101 |
||
102 |
buildProject |
|
103 |
" |
|
104 |
JavaTestsResource projectBuilded: true. |
|
763 | 105 |
JavaTestsResource projectBuilded: false." |
106 |
||
841 | 107 |
testsBuilded == true ifFalse: [ |
108 |
"Check for ant" |
|
109 |
self assert: (OperatingSystem canExecuteCommand: 'ant') |
|
110 |
description: 'Cannot execute ant'. |
|
111 |
self assert: (self testsDirectory / 'build.xml') exists |
|
112 |
description: 'No build.xml in ' , self testsDirectory asString. |
|
113 |
"Launch ant" |
|
114 |
Transcript |
|
115 |
show: 'Running ant in '; |
|
116 |
showCR: self testsDirectory asString. |
|
117 |
OperatingSystem |
|
118 |
executeCommand: 'ant -f build.xml' |
|
119 |
inputFrom: nil |
|
120 |
outputTo: Stdout |
|
121 |
errorTo: Stderr |
|
122 |
inDirectory: self testsDirectory |
|
123 |
onError: [ |
|
124 |
:status | |
|
125 |
Transcript showCR: 'ANT FAILED!!!!!!'. |
|
126 |
self error: 'ant failed'. |
|
127 |
^ self |
|
128 |
]. |
|
129 |
Transcript showCR: 'Ant finished'. |
|
130 |
testsBuilded := true. |
|
131 |
]. |
|
132 |
^ testsBuilded. |
|
752 | 133 |
|
134 |
"Modified: / 16-03-2011 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
841 | 135 |
"Modified: / 04-06-2011 / 18:03:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 136 |
! ! |
137 |
||
138 |
!JavaTestsResource methodsFor:'running'! |
|
139 |
||
140 |
setUp |
|
141 |
self class buildProject. |
|
848
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
142 |
self class classpath do:[:each | Java addToClassPath:each ]. |
763 | 143 |
|
144 |
" |
|
145 |
JavaTestsResource basicNew setUp |
|
848
b06ee9c295d9
Utility methods to load relevant subset of Mauve test suite
vranyj1
parents:
841
diff
changeset
|
146 |
Java classPath" |
752 | 147 |
"Created: / 06-03-2011 / 14:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
763 | 148 |
"Modified: / 07-05-2011 / 18:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 149 |
! ! |
150 |
||
151 |
!JavaTestsResource class methodsFor:'documentation'! |
|
152 |
||
153 |
version_SVN |
|
154 |
^ '$Id$' |
|
155 |
! ! |
|
156 |
||
157 |
JavaTestsResource initialize! |