JavaLookupTestsResource.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Nov 2011 12:54:59 +0100
changeset 2305 c11e70f81f74
parent 2288 5af9886de3b4
child 2353 fa7400d022a0
permissions -rw-r--r--
fixed: #version_SVN ($ to §)

"
 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' }"

TestResource subclass:#JavaLookupTestsResource
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Lookup-Tests'
!

JavaLookupTestsResource class instanceVariableNames:'projectDir projectBuilded'

"
 The following class instance variables are inherited by this class:

	TestResource - current
	TestAsserter - 
	Object - 
"
!

!JavaLookupTestsResource 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.

"
! !

!JavaLookupTestsResource 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-projects/MethodLookupTests' .

    projectBuilded := false.

    "Modified: / 16-03-2011 / 14:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 11-04-2011 / 19:30:29 / kursjan <kursjan@fit.cvut.cz>"
! !

!JavaLookupTestsResource 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
! !

!JavaLookupTestsResource 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>"
! !

!JavaLookupTestsResource methodsFor:'running'!

setUp
    self class buildProject.
    Java addToClassPath: (self class projectDir / 'bin') asString.
    JavaObject lookupObject: JavaLookup instance.

    "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>"
    "Modified: / 11-04-2011 / 20:15:15 / kursjan <kursjan@fit.cvut.cz>"
!

tearDown
    JavaObject lookupObject: nil

    "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Created: / 11-04-2011 / 20:15:28 / kursjan <kursjan@fit.cvut.cz>"
! !

!JavaLookupTestsResource class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libjava/JavaLookupTestsResource.st,v 1.3 2011-11-24 11:54:20 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libjava/JavaLookupTestsResource.st,v 1.3 2011-11-24 11:54:20 cg Exp $'
!

version_SVN
    ^ '§Id: JavaLookupTestsResource.st,v 1.1 2011/08/18 19:06:53 vrany Exp §'
! !

JavaLookupTestsResource initialize!