src/LookupIntegrationTestsResource.st
author vranyj1
Sun, 01 Jan 2012 17:03:10 +0000
branchjk_new_structure
changeset 1332 a2e2c13b0ff6
parent 1281 b46adbe75503
permissions -rw-r--r--
Some testing methods

"
 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:#LookupIntegrationTestsResource
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Experiments-Tests'
!

LookupIntegrationTestsResource class instanceVariableNames:'projectDir projectBuilded'

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

	TestResource - current
	TestAsserter - 
	Object - 
"
!

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

"
! !

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

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

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

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

!LookupIntegrationTestsResource class methodsFor:'documentation'!

version_SVN
    ^ '$Id$'
! !

LookupIntegrationTestsResource initialize!