src/JavaLookupTestsResource.st
branchjk_new_structure
changeset 761 43e017ec7958
child 877 f5a5b93e1c78
equal deleted inserted replaced
760:5f55da80009b 761:43e017ec7958
       
     1 "{ Package: 'stx:libjava' }"
       
     2 
       
     3 TestResource subclass:#JavaLookupTestsResource
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'Languages-Java-Lookup-Tests'
       
     8 !
       
     9 
       
    10 JavaLookupTestsResource class instanceVariableNames:'projectDir projectBuilded'
       
    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 !JavaLookupTestsResource class methodsFor:'initialization'!
       
    23 
       
    24 initialize
       
    25     "Invoked at system start or when the class is dynamically loaded."
       
    26 
       
    27     "/ please change as required (and remove this comment)
       
    28 
       
    29     projectDir := 
       
    30         (Smalltalk packageDirectoryForPackageId: 'stx:libjava') asFilename
       
    31             / 'java' / 'libjava-projects/MethodLookupTests' .
       
    32 
       
    33     projectBuilded := false.
       
    34 
       
    35     "Modified: / 16-03-2011 / 14:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    36     "Modified: / 11-04-2011 / 19:30:29 / kursjan <kursjan@fit.cvut.cz>"
       
    37 ! !
       
    38 
       
    39 !JavaLookupTestsResource class methodsFor:'accessing'!
       
    40 
       
    41 projectBuilded:aBoolean
       
    42 
       
    43     "
       
    44         JavaTestsResource projectBuilded: true.
       
    45         JavaTestsResource projectBuilded: false.
       
    46     "
       
    47 
       
    48     projectBuilded := aBoolean.
       
    49 
       
    50     "Modified: / 16-03-2011 / 15:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    51 !
       
    52 
       
    53 projectDir
       
    54     ^ projectDir
       
    55 ! !
       
    56 
       
    57 !JavaLookupTestsResource class methodsFor:'running'!
       
    58 
       
    59 buildProject
       
    60 
       
    61     "
       
    62         JavaTestsResource projectBuilded: true.
       
    63         JavaTestsResource projectBuilded: false.
       
    64     "
       
    65 
       
    66 
       
    67     projectBuilded == true ifFalse:[ 
       
    68         "Check for ant"
       
    69         self assert: (OperatingSystem canExecuteCommand:'ant')
       
    70              description: 'Cannot execute ant'.
       
    71 
       
    72         self assert: (self projectDir / 'build.xml') exists
       
    73              description: 'No build.xml in ' , self projectDir asString.
       
    74 
       
    75 
       
    76         "Launch ant"
       
    77         Transcript show:'Running ant in '; showCR: self projectDir asString.
       
    78         OperatingSystem
       
    79                 executeCommand:'ant -f build.xml' 
       
    80                 inputFrom:nil 
       
    81                 outputTo:Stdout 
       
    82                 errorTo:Stderr 
       
    83                 inDirectory: self projectDir
       
    84                 onError:
       
    85                     [:status | 
       
    86                     Transcript showCR:'ANT FAILED!!!!!!'.
       
    87                     self error:'ant failed'.
       
    88                     ^self].
       
    89 
       
    90         Transcript show:'Ant finished'].
       
    91     ^ projectBuilded
       
    92 
       
    93     "Modified: / 16-03-2011 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    94 ! !
       
    95 
       
    96 !JavaLookupTestsResource methodsFor:'running'!
       
    97 
       
    98 setUp
       
    99     self class buildProject.
       
   100     Java addToClassPath: (self class projectDir / 'bin') asString.
       
   101     JavaObject lookupObject: JavaLookup instance.
       
   102 
       
   103     "Created: / 06-03-2011 / 14:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   104     "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   105     "Modified: / 11-04-2011 / 20:15:15 / kursjan <kursjan@fit.cvut.cz>"
       
   106 !
       
   107 
       
   108 tearDown
       
   109     JavaObject lookupObject: nil
       
   110 
       
   111     "Modified: / 16-03-2011 / 14:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   112     "Created: / 11-04-2011 / 20:15:28 / kursjan <kursjan@fit.cvut.cz>"
       
   113 ! !
       
   114 
       
   115 !JavaLookupTestsResource class methodsFor:'documentation'!
       
   116 
       
   117 version_SVN
       
   118     ^ '$Id$'
       
   119 ! !
       
   120 
       
   121 JavaLookupTestsResource initialize!