Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/Molecule-Tests/MolComponentFactoryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MolComponentFactoryTest >> cleanGeneratedClassesAndTraits [
edited := true.
].

edited ifTrue:[(Delay forMilliseconds: 100) wait].
edited ifTrue:[ 100 milliSeconds wait ].
]

{ #category : #running }
Expand Down Expand Up @@ -326,7 +326,7 @@ MolComponentFactoryTest >> testComponentContractChanged [

]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testComponentContractImplGeneration [

| toFind |
Expand All @@ -353,7 +353,7 @@ MolComponentFactoryTest >> testComponentFactoryDefaultClass [
MolComponentFactory cleanUp.
]

{ #category : #'test - component subclasses' }
{ #category : #'tests - component subclasses' }
MolComponentFactoryTest >> testComponentSubclassesTraitsUses [
"Test if the traits declaration are correctly injected into a component class hierarchy
We have 3 components : A, B and C which inherits one another.
Expand Down Expand Up @@ -414,7 +414,7 @@ MolComponentFactoryTest >> testComponentSubclassesTraitsUses [
MolTestComponentImplC setTraitComposition: #().
]

{ #category : #'test - component subclasses' }
{ #category : #'tests - component subclasses' }
MolComponentFactoryTest >> testComponentSubclassesTraitsUses2 [

| type |
Expand Down Expand Up @@ -1329,7 +1329,7 @@ MolComponentFactoryTest >> testRebuildComponentAccessorsFor [
self assert: (MolCompleteComponentImpl selectors includes: #getMolUsedEventsSubscriber).
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedConsumedEvents [
"Testing issue #210 fix"

Expand All @@ -1342,7 +1342,7 @@ MolComponentFactoryTest >> testRemoveOverloadedConsumedEvents [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedProducedEvents [
"Testing issue #210 fix"

Expand All @@ -1355,7 +1355,7 @@ MolComponentFactoryTest >> testRemoveOverloadedProducedEvents [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedProvidedParameters [
"Testing issue #210 fix"

Expand All @@ -1368,7 +1368,7 @@ MolComponentFactoryTest >> testRemoveOverloadedProvidedParameters [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedProvidedServices [
"Testing issue #210 fix"

Expand All @@ -1381,7 +1381,7 @@ MolComponentFactoryTest >> testRemoveOverloadedProvidedServices [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedUsedParameters [
"Testing issue #210 fix"

Expand All @@ -1394,7 +1394,7 @@ MolComponentFactoryTest >> testRemoveOverloadedUsedParameters [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testRemoveOverloadedUsedServices [
"Testing issue #210 fix"

Expand All @@ -1407,7 +1407,7 @@ MolComponentFactoryTest >> testRemoveOverloadedUsedServices [
do: [ :e | e signal ]
]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testSubOverrideOfContractAddingProvidedServices [
"Related to issue #209, can override an overriden contract"

Expand Down Expand Up @@ -1459,7 +1459,7 @@ MolComponentFactoryTest >> testSubOverrideOfContractAddingProvidedServices [

]

{ #category : #'test - overload' }
{ #category : #'tests - overload' }
MolComponentFactoryTest >> testSubOverrideOfContractAddingUsedServices [
"Related to issue #209, can override an overriden contract"

Expand Down
5 changes: 4 additions & 1 deletion src/Molecule-Tests/MolDirtyComponentTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ MolDirtyComponentTest >> generationTag [
{ #category : #running }
MolDirtyComponentTest >> setUp [

super setUp.

MolComponentManager cleanUp.
self cleanGeneratedClassesAndTraits.
]

{ #category : #running }
MolDirtyComponentTest >> tearDown [

(Delay forMilliseconds: 10) wait.
self cleanGeneratedClassesAndTraits.
MolComponentManager cleanUp.

super tearDown
]

{ #category : #tests }
Expand Down
4 changes: 2 additions & 2 deletions src/Molecule-Tests/MolLocatorServicesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ MolLocatorServicesTest >> testNotReadySearchEventSubscriberFor [
self assert: (eventSubscriber observersConnection isEmpty).
]

{ #category : #test }
{ #category : #tests }
MolLocatorServicesTest >> testSearchComponentTypeImplementorFor [

| manager component myComponent |
Expand All @@ -93,7 +93,7 @@ MolLocatorServicesTest >> testSearchComponentTypeImplementorFor [
self assert: component identicalTo: myComponent
]

{ #category : #test }
{ #category : #tests }
MolLocatorServicesTest >> testSearchComponentTypeImplementorForNamed [

| manager component myComponent |
Expand Down
52 changes: 43 additions & 9 deletions src/Molecule-Tests/MolUtilsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ Class {
#category : #'Molecule-Tests-Cases'
}

{ #category : #tests }
{ #category : #running }
MolUtilsTest >> setUp [

super setUp.

MolComponentManager cleanUp
]

{ #category : #tests }
{ #category : #running }
MolUtilsTest >> tearDown [

MolComponentManager cleanUp
MolComponentManager cleanUp.

super tearDown
]

{ #category : #tests }
Expand Down Expand Up @@ -58,7 +62,21 @@ MolUtilsTest >> testActivateComponents [
{ #category : #tests }
MolUtilsTest >> testAllComponentImplementationClassesOfType [

self assert: (MolUtils allComponentImplementationClassesOfType: MolCompleteComponent) size equals: 7.
| nb |

"Fix #250 by waiting for code-source changes notification from previous tests"
2 second wait.

nb := 0.
MolCompleteComponent users do:[ :e |
e isComponentClass ifTrue:[
nb := nb + 1.
e allSubclassesDo: [ :f | f isComponentClass ifTrue:[ nb := nb + 1 ] ]
].
].

self assert: nb > 0.
self assert: (MolUtils allComponentImplementationClassesOfType: MolCompleteComponent) size equals: nb.
]

{ #category : #tests }
Expand Down Expand Up @@ -235,20 +253,36 @@ MolUtilsTest >> testInstanceKindOf [
"Test method instanceKindOf: of Utils"

| homeServices |
MolComponentManager default deploymentServices
deployComponentImplementation: MolBasicSubComponentImpl.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) isNil.

MolComponentManager default deploymentServices deployComponentImplementation: MolBasicSubComponentImpl.
homeServices := MolComponentManager default homeServices.
homeServices instantiateComponent: MolBasicSubComponentImpl.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) notNil
]

{ #category : #tests }
MolUtilsTest >> testInstanceKindOfNamed [
"Test method instanceKindOf:Named: of Utils"

self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) isNil.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl named: #myComponent) isNil.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl named: #otherComponent) isNil.


MolBasicSubComponentImpl start: #myComponent.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) isNil.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl named: #myComponent) notNil.
self assert: (MolUtils instanceKindOf: MolBasicComponentImpl named: #otherComponent) isNil.
]

{ #category : #tests }
MolUtilsTest >> testInstanceOf [

| instance |
self assert: (MolUtils instanceOf: MolBasicComponentImpl) isNil.

MolUtils startComponent: MolBasicComponentImpl.
instance := MolUtils instanceOf: MolBasicComponentImpl.
self assert: instance class equals: MolBasicComponentImpl.
self assert: (MolUtils instanceOf: MolBasicComponentImpl) class equals: MolBasicComponentImpl.

]

Expand Down
15 changes: 10 additions & 5 deletions src/Molecule/MolUtils.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,18 @@ MolUtils class >> instanceKindOf: aClass [

{ #category : #accessing }
MolUtils class >> instanceKindOf: aClass named: aName [

| instance |

(self instanceOf: aClass named: aName) ifNil:[
aClass allSubclasses do:
[:c |
"Search instance in class instances"
instance := self instanceOf: aClass named: aName.
instance ifNotNil: [ :e | ^ e ].

"Search instance in subclasses instances"
aClass allSubclasses do: [ :c |
instance := self instanceOf: c named: aName.
instance ifNotNil: [^instance]]].
instance ifNotNil: [ ^ instance ] ].

^ nil
]

{ #category : #accessing }
Expand Down
Loading