--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaTestCaseProxy.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,241 @@
+"
+ 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' }"
+
+TestCase subclass:#JavaTestCaseProxy
+ instanceVariableNames:''
+ classVariableNames:'TestCases'
+ poolDictionaries:''
+ category:'Languages-Java-Tests-Proxies'
+!
+
+JavaTestCaseProxy class instanceVariableNames:'javaClassName shouldFork'
+
+"
+ The following class instance variables are inherited by this class:
+
+ TestCase - lastTestRunResultOrNil lastTestRunsPassedTests lastTestRunsFailedTests lastTestRunsErrorTests
+ TestAsserter -
+ Object -
+"
+!
+
+!JavaTestCaseProxy 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.
+
+"
+! !
+
+!JavaTestCaseProxy class methodsFor:'initialization'!
+
+initialize
+
+ TestCases := Dictionary new.
+
+ "Created: / 01-03-2011 / 10:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setJavaClassName: aSymbol
+
+ javaClassName ifNotNil:
+ [self error: 'Attempting to set java class name twice'].
+ javaClassName := aSymbol.
+
+ "Created: / 01-03-2011 / 10:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'accessing'!
+
+javaClass
+
+ ^Java classForName: javaClassName
+
+ "Created: / 01-03-2011 / 11:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-06-2011 / 17:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassName
+
+ ^javaClassName
+
+ "Created: / 01-03-2011 / 11:30:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+shouldFork
+ ^ shouldFork ? false
+
+ "Modified: / 13-06-2011 / 16:34:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+shouldFork:aBoolean
+ shouldFork := aBoolean.
+!
+
+sunitName
+
+ ^javaClassName
+
+ "Created: / 10-08-2011 / 21:21:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'private'!
+
+testSelectors
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+! !
+
+!JavaTestCaseProxy class methodsFor:'queries'!
+
+isAbstract
+
+ ^self == JavaTestCaseProxy or:[self superclass == JavaTestCaseProxy]
+
+ "Created: / 21-06-2011 / 16:56:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isTestlet
+
+ ^false
+
+ "Created: / 21-06-2011 / 16:57:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'subclass creation'!
+
+for: javaClass
+
+ self subclassResponsibility
+
+ "Modified: / 21-06-2011 / 17:08:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+forClassNamed: name
+ "Answers a new (anonymous) testcase proxy for
+ given javaClass"
+
+ | meta cls |
+ TestCases at: name ifPresent: [:c | ^ c ].
+ meta := Metaclass new.
+ meta setSuperclass: self class.
+ meta instSize: self class instSize.
+ cls := meta new.
+ cls setSuperclass: self.
+ cls flags: self flags.
+ cls instSize: self instSize.
+ cls setJavaClassName: name.
+ cls
+ setName: (self name , ' for: (Java classForName: ' , name storeString
+ , ')') asSymbol.
+ cls setCategory: #'(java test case proxies)'.
+ TestCases at: name put: cls.
+ ^ cls
+
+ "Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 21-06-2011 / 17:07:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy methodsFor:'accessing'!
+
+javaClass
+
+ | javaClass |
+
+ self
+ assert: (javaClass := self class javaClass) isJavaClass
+ description: 'java class does not exists'.
+ ^javaClass
+
+ "Created: / 01-03-2011 / 14:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+! !
+
+!JavaTestCaseProxy class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaTestCaseProxy initialize!
\ No newline at end of file