diff --git a/src/Molecule-Tests/MolComponentManagerTest.class.st b/src/Molecule-Tests/MolComponentManagerTest.class.st index 8877b21..dc76268 100644 --- a/src/Molecule-Tests/MolComponentManagerTest.class.st +++ b/src/Molecule-Tests/MolComponentManagerTest.class.st @@ -38,6 +38,22 @@ MolComponentManagerTest >> testCleanUp [ ] +{ #category : #tests } +MolComponentManagerTest >> testCleanUpAnnouncements [ +| announcement list selection | +announcement := nil. + SystemAnnouncer uniqueInstance when: MolComponentInstanciated do:[ :a | announcement := a ]. + SystemAnnouncer uniqueInstance when: MolComponentPassivated do:[ :a | announcement := a ]. + SystemAnnouncer uniqueInstance when: MolComponentInstanciated do:[ :a | announcement := a ]. + list := MolAnnouncement withAllSubclasses. + selection := SystemAnnouncer uniqueInstance subscriptions subscriptions select: [ :e | list includes: e announcementClass] . + self assert: (selection size > 0). + MolComponentManager cleanupMolAnnouncements. + selection := SystemAnnouncer uniqueInstance subscriptions subscriptions select: [ :e | list includes: e announcementClass] . + self assert: (selection size = 0). + +] + { #category : #'tests - general' } MolComponentManagerTest >> testCleanUpIgnoreErrors [ "Start a manuel tree of components and clean up, components are removed during the cleanUp but some componentRemove methods should remove again an already removed component : a error is reach but ignored during a cleanUp" diff --git a/src/Molecule/MolComponentManager.class.st b/src/Molecule/MolComponentManager.class.st index 2302f71..2eff3e0 100644 --- a/src/Molecule/MolComponentManager.class.st +++ b/src/Molecule/MolComponentManager.class.st @@ -47,6 +47,8 @@ MolComponentManager class >> cleanUp [ notifiers do: [ :n | n release ]. subscribers do: [ :n | n release ]. + self cleanupMolAnnouncements. + MolUtils log: 'End of the cleanUp.' ] @@ -57,6 +59,14 @@ MolComponentManager class >> cleanUp: aBoolean [ self deepCleanUp. ] +{ #category : #cleanup } +MolComponentManager class >> cleanupMolAnnouncements [ +