--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/JavaTestsResource.st Fri Apr 08 12:02:36 2011 +0000
@@ -0,0 +1,111 @@
+"{ Package: 'stx:libjava' }"
+
+TestResource subclass:#JavaTestsResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+JavaTestsResource class instanceVariableNames:'projectDir projectBuilded'
+
+"
+ The following class instance variables are inherited by this class:
+
+ TestResource - current
+ TestAsserter -
+ Object -
+"
+!
+
+
+!JavaTestsResource class methodsFor:'initialization'!
+
+initialize
+ "Invoked at system start or when the class is dynamically loaded."
+
+ "/ please change as required (and remove this comment)
+
+ projectDir :=
+ (Smalltalk packageDirectoryForPackageId: 'stx:libjava') asFilename
+ / 'java' / 'libjava-tests' .
+
+ projectBuilded := false.
+
+ "Modified: / 16-03-2011 / 14:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsResource class methodsFor:'accessing'!
+
+projectBuilded:aBoolean
+
+ "
+ JavaTestsResource projectBuilded: true.
+ JavaTestsResource projectBuilded: false.
+ "
+
+ projectBuilded := aBoolean.
+
+ "Modified: / 16-03-2011 / 15:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+projectDir
+ ^ projectDir
+! !
+
+!JavaTestsResource class methodsFor:'running'!
+
+buildProject
+
+ "
+ JavaTestsResource projectBuilded: true.
+ JavaTestsResource projectBuilded: false.
+ "
+
+
+ projectBuilded == true ifFalse:[
+ "Check for ant"
+ self assert: (OperatingSystem canExecuteCommand:'ant')
+ description: 'Cannot execute ant'.
+
+ self assert: (self projectDir / 'build.xml') exists
+ description: 'No build.xml in ' , self projectDir asString.
+
+
+ "Launch ant"
+ Transcript show:'Running ant in '; showCR: self projectDir asString.
+ OperatingSystem
+ executeCommand:'ant -f build.xml'
+ inputFrom:nil
+ outputTo:Stdout
+ errorTo:Stderr
+ inDirectory: self projectDir
+ onError:
+ [:status |
+ Transcript showCR:'ANT FAILED!!!!!!'.
+ self error:'ant failed'.
+ ^self].
+
+ Transcript show:'Ant finished'].
+ ^ projectBuilded
+
+ "Modified: / 16-03-2011 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsResource methodsFor:'running'!
+
+setUp
+ self class buildProject.
+ Java addToClassPath: (self class projectDir / 'bin') asString
+
+ "Created: / 06-03-2011 / 14:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaTestsResource initialize!