JavaLookupTestsResource.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 11 Feb 2014 15:10:40 +0000
branchdevelopment
changeset 3029 bc928fce0f14
parent 2731 13f5be2bf83b
permissions -rw-r--r--
Merged 6d6f9fd894f7 and c04668cd040d

"
 COPYRIGHT (c) 1996-2011 by Claus Gittinger

 New code and modifications done at SWING Research Group [1]:

 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                            SWING Research Group, Czech Technical University in Prague

 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.

 [1] Code written at SWING Research Group contains a signature
     of one of the above copright owners. For exact set of such code,
     see the differences between this version and version stx:libjava
     as of 1.9.2010
"
"{ Package: 'stx:libjava' }"

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

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

 New code and modifications done at SWING Research Group [1]:

 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                            SWING Research Group, Czech Technical University in Prague

 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.

 [1] Code written at SWING Research Group contains a signature
     of one of the above copright owners. For exact set of such code,
     see the differences between this version and version stx:libjava
     as of 1.9.2010

"
! !

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

resources

    ^ { JavaInitializedResource }

    "Created: / 01-01-2012 / 17:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!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 flushAllJavaResources.
"/    Java initialize.                                             "Initialize classPath and other stuff"
"/    JavaVM initializeVM. 

    Java addToClassPath: (self class projectDir / 'bin') asString.
    JavaLookup cleanup.
"/    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>"
    "Modified: / 05-09-2011 / 20:15:27 / Jan Kurs <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_CVS
    ^ '$Header: /cvs/stx/stx/libjava/JavaLookupTestsResource.st,v 1.6 2013-09-06 00:41:24 vrany Exp $'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ 'Id'
! !


JavaLookupTestsResource initialize!