--- a/mercurial/HGStXTests.st Fri Nov 29 15:49:36 2013 +0000
+++ b/mercurial/HGStXTests.st Fri Nov 29 21:00:10 2013 +0000
@@ -1204,6 +1204,80 @@
"
"Created: / 11-06-2013 / 00:16:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_commit_16a
+ "
+ Test correct fileout if Java extensions
+ "
+
+ | repo pmN111 ctN111 java_lang_String changeset |
+
+ repo := self repositoryNamed: 'mocks/hg/p5'.
+ self assert: (Smalltalk loadPackage:'mocks:hg/p5').
+
+ "/ Do skipIf after package is loaded!!!!!! otherwise the
+ "/ Java extension is not loaded!!
+ self skipIf: self stxlibjavaAvailable not description: 'STX:LIBJAVA not available'.
+
+ java_lang_String := Java classForName: 'java.lang.String'.
+ (Compiler compile:'test_commit_16a ^ #foo' forClass: java_lang_String)
+ package:#'mocks:hg/p5'.
+ self assert: (java_lang_String methodDictionary includesKey:#test_commit_16a).
+
+ pmN111 := HGPackageModel named: #'mocks:hg/p5'.
+ ctN111 := pmN111 commitTask.
+ ctN111 message:'test_commit_16a '.
+ ctN111 do.
+ "
+ repo workingCopy browse
+ "
+ changeset := repo @ 2.
+
+ self assert: (changeset changes contains:[:change | change isAdded ]).
+ self deny: (changeset changes contains:[:change | change isRemoved ]).
+
+ self assert: (changeset / 'java' / 'extensions' / 'java' / 'lang' / 'String.st' ) notNil.
+
+ "Created: / 29-11-2013 / 16:25:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_commit_16b
+ "
+ Test covering issue #26: Java extension files are removed.
+
+ Check, that if the particular class is not loaded in the system,
+ extension file is kept intact.
+ "
+
+ | repo pmN111 ctN111 changeset |
+
+ repo := self repositoryNamed: 'mocks/hg/p5'.
+ self assert: (Smalltalk loadPackage:'mocks:hg/p5').
+
+ "/ Do skipIf after package is loaded!!!!!! otherwise the
+ "/ Java extension is not loaded!!
+ self skipIf: self stxlibjavaAvailable not description: 'STX:LIBJAVA not available'.
+
+ "/ Flush Java to make sure java.lang.Object is not loaded.
+ (Smalltalk at:#Java) flushAllJavaResources.
+
+
+ pmN111 := HGPackageModel named: #'mocks:hg/p5'.
+ ctN111 := pmN111 commitTask.
+ ctN111 message:'test_commit_16a '.
+ ctN111 do.
+ "
+ repo workingCopy browse
+ "
+ changeset := repo @ 2.
+
+ self deny: (changeset changes contains:[:change | change isAdded ]).
+ self deny: (changeset changes contains:[:change | change isRemoved ]).
+
+ self assert: (changeset / 'java' / 'extensions' / 'java' / 'lang' / 'Object.st' ) notNil.
+
+ "Created: / 29-11-2013 / 17:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGStXTests methodsFor:'tests - manager API'!
@@ -1711,6 +1785,37 @@
self tearDown
"Created: / 20-11-2012 / 19:32:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+stxlibjavaAvailable
+ "raise an error: this method should be implemented (TODO)"
+
+ (Smalltalk at:#JavaVM) isNil ifTrue:[
+ Smalltalk loadPackage:'stx:libjava'.
+ ].
+ (Smalltalk at:#JavaVM) isNil ifTrue:[
+ ^ false
+ ].
+ (Smalltalk at:#Java) isNil ifTrue:[
+ ^ false
+ ].
+ ^ [
+ (Smalltalk at:#JavaVM) booted ifTrue:[
+ "/ Sorry, flush it...
+ (Smalltalk at:#Java) flushAllJavaResources.
+ ].
+
+ "/ Opps, workaround - have to nil out Java:ExtensionsPathPackages
+ Smalltalk at: #'Java:ExtensionsPathPackages' put: nil.
+
+ "/ Now, initialize ot..."
+ (Smalltalk at:#Java) initialize.
+ (Smalltalk at:#JavaVM) initializeVM.
+ true.
+ ] on:Error do:[:ex | false ]
+
+ "Created: / 29-11-2013 / 16:21:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-11-2013 / 17:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGStXTests class methodsFor:'documentation'!