From 1d595b9f40726678fbfff702a9325945f65d080e Mon Sep 17 00:00:00 2001 From: Eliott-Guevel Date: Tue, 24 Oct 2023 09:59:02 +0200 Subject: [PATCH 1/9] deprecated instanciate in favor of instantiation (correct grammatical form) --- src/Molecule/MolComponentFactory.class.st | 39 +++--- src/Molecule/MolComponentImpl.trait.st | 26 +++- src/Molecule/MolComponentType.trait.st | 30 +---- src/Molecule/MolHomeServices.class.st | 144 ++++++++++++++-------- src/Molecule/MolUtils.class.st | 19 ++- 5 files changed, 158 insertions(+), 100 deletions(-) diff --git a/src/Molecule/MolComponentFactory.class.st b/src/Molecule/MolComponentFactory.class.st index ebebf079..fbcb93b5 100644 --- a/src/Molecule/MolComponentFactory.class.st +++ b/src/Molecule/MolComponentFactory.class.st @@ -575,33 +575,26 @@ MolComponentFactory >> dirtyComponents [ MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollection in: aComponent suffix: suffix [ | selector sourceCode sourceMethod method | - aCollection copy do: [ :e | | trait | + aCollection copy do: [ :trait | - "e can be another thing that a Trait, need to check nature of e before generate" - ( e notNil and:[ e isTrait and:[( e isComponentServices or:[ e isComponentParameters or:[ e isComponentEvents ]])]]) ifTrue:[ - - trait := e. - - selector := ('get' , trait printString , suffix) asSymbol. - sourceCode := self getSourceCodeFor: aSymbol trait: trait selector: selector. - (aComponent allSelectors includes: selector) ifFalse: [ - aComponent compile: sourceCode contents classified: self class protocolForComponentAccess - ] ifTrue: [ - "if the method exist inspect this source code for search any difference between the existing required services and the requested required services" - "the selector must not be a parent" - (aComponent selectors includes: selector) ifTrue: [ - method := aComponent >> selector. - sourceMethod := method sourceCode. - sourceMethod ifNotNil: [ - sourceMethod ~= sourceCode contents ifTrue: [ - "rewrite the method" - aComponent compile: sourceCode contents classified: self class protocolForComponentAccess - ]. + selector := ('get' , trait printString , suffix) asSymbol. + sourceCode := self getSourceCodeFor: aSymbol trait: trait selector: selector. + (aComponent allSelectors includes: selector) ifFalse: [ + aComponent compile: sourceCode contents classified: self class protocolForComponentAccess + ] ifTrue: [ + "if the method exist inspect this source code for search any difference between the existing required services and the requested required services" + "the selector must not be a parent" + (aComponent selectors includes: selector) ifTrue: [ + method := aComponent >> selector. + sourceMethod := method sourceCode. + sourceMethod ifNotNil: [ + sourceMethod ~= sourceCode contents ifTrue: [ + "rewrite the method" + aComponent compile: sourceCode contents classified: self class protocolForComponentAccess ]. ]. ]. - - ]. + ]. ] ] diff --git a/src/Molecule/MolComponentImpl.trait.st b/src/Molecule/MolComponentImpl.trait.st index 4f0a8618..3b522fc9 100644 --- a/src/Molecule/MolComponentImpl.trait.st +++ b/src/Molecule/MolComponentImpl.trait.st @@ -73,13 +73,37 @@ MolComponentImpl classSide >> haveOwnComponentType [ { #category : #'life cycle' } MolComponentImpl classSide >> instanciate [ + self + deprecated: 'Use instantiate' + transformWith: + '`@receiver instanciate' -> '`@receiver instantiate'. ^ MolComponentManager default homeServices instanciateComponent: self ] { #category : #'life cycle' } MolComponentImpl classSide >> instanciate: aComponentName [ - ^ MolComponentManager default homeServices instanciateComponent: self named: aComponentName + self + deprecated: 'Use instantiate:' + transformWith: '`@receiver instanciate: `@aComponentName' + -> '`@receiver instantiate: `@aComponentName'. + ^ MolComponentManager default homeServices + instanciateComponent: self + named: aComponentName +] + +{ #category : #'life cycle' } +MolComponentImpl classSide >> instantiate [ + + ^ MolComponentManager default homeServices instantiateComponent: self +] + +{ #category : #'life cycle' } +MolComponentImpl classSide >> instantiate: aComponentName [ + + ^ MolComponentManager default homeServices + instantiateComponent: self + named: aComponentName ] { #category : #testing } diff --git a/src/Molecule/MolComponentType.trait.st b/src/Molecule/MolComponentType.trait.st index 7a95aed5..cc25d409 100644 --- a/src/Molecule/MolComponentType.trait.st +++ b/src/Molecule/MolComponentType.trait.st @@ -21,84 +21,66 @@ Trait { { #category : #actions } MolComponentType classSide >> allConsumedEvents [ | collection | - - collection := (self consumedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. - + collection := Set withAll: self consumedComponentEvents. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s consumedComponentEvents ] ]. - ^ collection asOrderedCollection ] { #category : #actions } MolComponentType classSide >> allProducedEvents [ | collection | - - collection := (self producedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. - + collection := Set withAll: self producedComponentEvents. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s producedComponentEvents ] ]. - ^ collection asOrderedCollection ] { #category : #actions } MolComponentType classSide >> allProvidedParameters [ | collection | - - collection := (self providedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. - + collection := Set withAll: self providedComponentParameters. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentParameters ] ]. - ^ collection asOrderedCollection ] { #category : #actions } MolComponentType classSide >> allProvidedServices [ | collection | - - collection := (self providedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. - + collection := Set withAll: self providedComponentServices. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentServices ] ]. - ^ collection asOrderedCollection ] { #category : #actions } MolComponentType classSide >> allUsedParameters [ | collection | - - collection := (self usedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. - + collection := Set withAll: self usedComponentParameters. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentParameters ] ]. - ^ collection asOrderedCollection ] { #category : #actions } MolComponentType classSide >> allUsedServices [ | collection | - - collection := (self usedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. - + collection := Set withAll: self usedComponentServices. self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentServices ] ]. - ^ collection asOrderedCollection ] diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index 1e26654e..b48dea0d 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -49,17 +49,16 @@ MolHomeServices >> activateComponent: aComponentClass named: aName [ waitingForActivation remove: component ifAbsent: [ ^ComponentAlreadyActivatedError signal: 'Component is already activated.' ]. - + component componentConnector activateComponent. - - "Manage connexion between components" - MolComponentManager default locatorServices resolveWaitingSubscriptions: component. - component componentActivate. component triggerEvent: #activateComponent with: component. MolUtils log: aComponentClass printString , ' named: ' , aName printString , ' is activated.'. + "manage connexion between components" + MolComponentManager default locatorServices resolveWaitingSubscriptions: component. + ^ component ] @@ -71,59 +70,68 @@ MolHomeServices >> addDeployedComponent: aComponentClass [ { #category : #private } MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ + self deprecated: 'Use checkInstantiationOfComponent: named:' + transformWith: '`@receiver checkInstanciationOfComponent: `@aComponentClass named: `@aComponentName' -> '`@receiver checkInstantiationOfComponent: `@aComponentClass named: `@aComponentName'. + ^ self checkInstantiationOfComponent: aComponentClass named: aComponentName +] + +{ #category : #private } +MolHomeServices >> checkInstantiationOfComponent: aComponentClass named: aComponentName [ + | deployed component overridedTypes | - aComponentName ifNil: [ + aComponentName ifNil: [ ^ WrongComponentNameError new messageText: - 'Can not instanciate a component without name' ]. - + 'Can not instantiate a component without name' ]. + aComponentName isSymbol ifFalse: [ ^ WrongComponentNameError new messageText: - 'Can not instanciate a component with a name wish is not a symbol' ]. - - deployed := self deployedComponents at: aComponentClass ifAbsent: [ - ^ ComponentNotDeployedError new messageText: - 'Can not instanciate a non deployed component' ]. - deployed at: aComponentName ifPresent: [ :e | - e ifNotNil: [ + 'Can not instantiate a component with a name wish is not a symbol' ]. + + deployed := self deployedComponents at: aComponentClass ifAbsent: [ + ^ ComponentNotDeployedError new messageText: + 'Can not instantiate a non deployed component' ]. + deployed at: aComponentName ifPresent: [ :e | + e ifNotNil: [ ^ ComponentAlreadyExistsError new messageText: - 'Can not instanciate a component with the same name of another component, please change the name of the component' ] ]. - + 'Can not instantiate a component with the same name of another component, please change the name of the component' ] ]. + component := MolComponentManager default locatorServices - searchComponentTypeImplementorFor: aComponentClass componentType - named: aComponentName. - component ifNotNil: [ + searchComponentTypeImplementorFor: + aComponentClass componentType + named: aComponentName. + component ifNotNil: [ ^ ComponentAlreadyExistsError new messageText: - 'Can not instanciate a component with the same type and name of another component, please change the name of the component' ]. - - aComponentClass componentType allProvidedServices do: [ :e | + 'Can not instantiate a component with the same type and name of another component, please change the name of the component' ]. + + aComponentClass componentType allProvidedServices do: [ :e | (MolComponentManager default locatorServices searchServicesProviderFor: e - named: aComponentName) isNotFoundServices ifFalse: [ + named: aComponentName) isNotFoundServices ifFalse: [ ^ ComponentProvidedServicesAlreadyExistsError new messageText: - 'Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. - - aComponentClass componentType allProvidedParameters do: [ :e | + 'Can not instantiate a component with the same services and name of another component, please change the name of the component' ] ]. + + aComponentClass componentType allProvidedParameters do: [ :e | (MolComponentManager default locatorServices searchParametersProviderFor: e - named: aComponentName) isNotFoundParameters ifFalse: [ + named: aComponentName) isNotFoundParameters ifFalse: [ ^ ComponentProvidedParametersAlreadyExistsError new messageText: - 'Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ]. - - aComponentClass isOverrideComponentType ifTrue: [ + 'Can not instantiate a component with the same parameters and name of another component, please change the name of the component' ] ]. + + aComponentClass isOverrideComponentType ifTrue: [ overridedTypes := aComponentClass overridedComponentTypes. - overridedTypes do: [ :type | - type allProvidedServices do: [ :e | + overridedTypes do: [ :type | + type allProvidedServices do: [ :e | (MolComponentManager default locatorServices searchServicesProviderFor: e - named: aComponentName) isNotFoundServices ifFalse: [ + named: aComponentName) isNotFoundServices ifFalse: [ ^ ComponentProvidedServicesAlreadyExistsError new messageText: - '(Inheritance problem) Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. - type allProvidedParameters do: [ :e | + '(Inheritance problem) Can not instantiate a component with the same services and name of another component, please change the name of the component' ] ]. + type allProvidedParameters do: [ :e | (MolComponentManager default locatorServices searchParametersProviderFor: e - named: aComponentName) isNotFoundParameters ifFalse: [ + named: aComponentName) isNotFoundParameters ifFalse: [ ^ ComponentProvidedServicesAlreadyExistsError new messageText: - '(Inheritance problem) Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ]. + '(Inheritance problem) Can not instantiate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ]. ^ nil ] @@ -146,39 +154,73 @@ MolHomeServices >> instanceOf: aClass named: aName [ { #category : #'life cycle' } MolHomeServices >> instanciateAllComponents [ - self deployedComponents keysDo: [ :aClass | self instanciateComponent: aClass ] + + self deprecated: 'Use instantiateAllComponents' + transformWith: '`@receiver instanciateAllComponents' -> '`@receiver instantiateAllComponents'. + self instantiateAllComponents ] { #category : #'life cycle' } MolHomeServices >> instanciateComponent: aComponentClass [ - ^ self instanciateComponent: aComponentClass named: MolUtils defaultComponentName + self deprecated: 'Use instantiateComponent:' + transformWith: '`@receiver instanciateComponent: `@aComponentClass' -> '`@receiver instantiateComponent: `@aComponentClass'. + ^ self instantiateComponent: aComponentClass ] { #category : #'life cycle' } MolHomeServices >> instanciateComponent: aComponentClass named: aName [ + + self deprecated: 'Use instantiateComponent: named:' + transformWith: '`@receiver instanciateComponent: `@aComponentClass named: `@aName' ->'`@receiver instantiateComponent: `@aComponentClass named: `@aName'. + ^ self instantiateComponent: aComponentClass named: aName +] + +{ #category : #'life cycle' } +MolHomeServices >> instantiateAllComponents [ + + self deployedComponents keysDo: [ :aClass | + self instantiateComponent: aClass ] +] + +{ #category : #'life cycle' } +MolHomeServices >> instantiateComponent: aComponentClass [ + + ^ self instantiateComponent: aComponentClass named: MolUtils defaultComponentName +] + +{ #category : #'life cycle' } +MolHomeServices >> instantiateComponent: aComponentClass named: aName [ + | error component connector deployed | - - aComponentClass ifNil:[^nil]. - error := self checkInstanciationOfComponent: aComponentClass named: aName. - error ifNotNil:[error signal. ^nil]. - - component := aComponentClass new componentName: aName; yourself. - MolUtils log: aComponentClass printString , ' named: ' , aName printString , ' is instanciated.'. + aComponentClass ifNil: [ ^ nil ]. + error := self + checkInstantiationOfComponent: aComponentClass + named: aName. + error ifNotNil: [ + error signal. + ^ nil ]. + + component := aComponentClass new + componentName: aName; + yourself. + MolUtils log: + aComponentClass printString , ' named: ' , aName printString + , ' is instanciated.'. deployed := self deployedComponents at: aComponentClass. deployed at: component componentName put: component. - + "connect the component to the component model and initialize it" connector := MolComponentConnector new. component componentConnector: connector. component componentInitialize. component triggerEvent: #instanciateComponent with: component. - + "add the component to waiting activation list" waitingForActivation add: component. - - ^component + + ^ component ] { #category : #private } diff --git a/src/Molecule/MolUtils.class.st b/src/Molecule/MolUtils.class.st index 997008d6..89367f1c 100644 --- a/src/Molecule/MolUtils.class.st +++ b/src/Molecule/MolUtils.class.st @@ -152,11 +152,28 @@ MolUtils class >> isComponentOrComponentClass: anObject [ { #category : #testing } MolUtils class >> isInstanciateComponentOf: aClass [ - ^ self isInstanciateComponentOf: aClass named: self defaultComponentName + self deprecated: 'Use isInstantiateComponentOf:' + transformWith: '`@receiver isInstanciateComponentOf: `@aClass' -> '`@receiver isInstantiateComponentOf: `@aClass'. + ^ self isInstantiateComponentOf: aClass ] { #category : #testing } MolUtils class >> isInstanciateComponentOf: aClass named: aName [ + + self deprecated: 'Use isInstantiateComponentOf: named: ' + transformWith: '`@receiver isInstanciateComponentOf: `@aClass named: `@aName' -> '`@receiver isInstantiateComponentOf: `@aClass named: `@aName'. + ^ self isInstantiateComponentOf: aClass named: aName +] + +{ #category : #testing } +MolUtils class >> isInstantiateComponentOf: aClass [ + + ^ self isInstantiateComponentOf: aClass named: self defaultComponentName +] + +{ #category : #testing } +MolUtils class >> isInstantiateComponentOf: aClass named: aName [ + ^ (MolComponentManager default homeServices instanceOf: aClass named: aName) notNil ] From df2450ae2eae307a8293bb4d3e2a2490c5f1f963 Mon Sep 17 00:00:00 2001 From: Eliott-Guevel Date: Tue, 24 Oct 2023 10:42:35 +0200 Subject: [PATCH 2/9] old methods now redirect to new methods --- src/Molecule/MolComponentImpl.trait.st | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Molecule/MolComponentImpl.trait.st b/src/Molecule/MolComponentImpl.trait.st index 3b522fc9..7067f955 100644 --- a/src/Molecule/MolComponentImpl.trait.st +++ b/src/Molecule/MolComponentImpl.trait.st @@ -77,7 +77,7 @@ MolComponentImpl classSide >> instanciate [ deprecated: 'Use instantiate' transformWith: '`@receiver instanciate' -> '`@receiver instantiate'. - ^ MolComponentManager default homeServices instanciateComponent: self + ^ self instantiate ] { #category : #'life cycle' } @@ -87,9 +87,7 @@ MolComponentImpl classSide >> instanciate: aComponentName [ deprecated: 'Use instantiate:' transformWith: '`@receiver instanciate: `@aComponentName' -> '`@receiver instantiate: `@aComponentName'. - ^ MolComponentManager default homeServices - instanciateComponent: self - named: aComponentName + ^ self instantiate: aComponentName ] { #category : #'life cycle' } From b3c066bb4299aaf1924d5a3b42850bb37db71925 Mon Sep 17 00:00:00 2001 From: Eliott-Guevel Date: Tue, 24 Oct 2023 10:44:29 +0200 Subject: [PATCH 3/9] generateComponentAccessorsFor: fix --- src/Molecule/MolComponentFactory.class.st | 46 +++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/Molecule/MolComponentFactory.class.st b/src/Molecule/MolComponentFactory.class.st index fbcb93b5..bfe8da1c 100644 --- a/src/Molecule/MolComponentFactory.class.st +++ b/src/Molecule/MolComponentFactory.class.st @@ -572,31 +572,39 @@ MolComponentFactory >> dirtyComponents [ ] { #category : #'private - code generation' } -MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollection in: aComponent suffix: suffix [ +MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollection in: aComponent suffix: suffix [ [ | selector sourceCode sourceMethod method | - - aCollection copy do: [ :trait | - - selector := ('get' , trait printString , suffix) asSymbol. - sourceCode := self getSourceCodeFor: aSymbol trait: trait selector: selector. - (aComponent allSelectors includes: selector) ifFalse: [ - aComponent compile: sourceCode contents classified: self class protocolForComponentAccess - ] ifTrue: [ - "if the method exist inspect this source code for search any difference between the existing required services and the requested required services" - "the selector must not be a parent" - (aComponent selectors includes: selector) ifTrue: [ - method := aComponent >> selector. - sourceMethod := method sourceCode. - sourceMethod ifNotNil: [ - sourceMethod ~= sourceCode contents ifTrue: [ - "rewrite the method" - aComponent compile: sourceCode contents classified: self class protocolForComponentAccess + + aCollection copy do: [ :e | | trait | + + "e can be another thing that a Trait, need to check nature of e before generate" + ( e notNil and:[ e isTrait and:[( e isComponentServices or:[ e isComponentParameters or:[ e isComponentEvents ]])]]) ifTrue:[ + + trait := e. + + selector := ('get' , trait printString , suffix) asSymbol. + sourceCode := self getSourceCodeFor: aSymbol trait: trait selector: selector. + (aComponent allSelectors includes: selector) ifFalse: [ + aComponent compile: sourceCode contents classified: self class protocolForComponentAccess + ] ifTrue: [ + "if the method exist inspect this source code for search any difference between the existing required services and the requested required services" + "the selector must not be a parent" + (aComponent selectors includes: selector) ifTrue: [ + method := aComponent >> selector. + sourceMethod := method sourceCode. + sourceMethod ifNotNil: [ + sourceMethod ~= sourceCode contents ifTrue: [ + "rewrite the method" + aComponent compile: sourceCode contents classified: self class protocolForComponentAccess + ]. ]. ]. ]. - ]. + + ]. ] ] +] { #category : #'code generation' } MolComponentFactory >> generateOrRemoveConsumedEventsComponentAccessorsFor: aComponent [ From 4b5268307b2757f10adbf40b87a79341f683b8e8 Mon Sep 17 00:00:00 2001 From: Eliott-Guevel Date: Tue, 24 Oct 2023 10:59:56 +0200 Subject: [PATCH 4/9] these methods weren't meant to be changed --- src/Molecule/MolComponentType.trait.st | 48 ++++++++++++++----- src/Molecule/MolHomeServices.class.st | 64 ++++++++++++++++++++++++-- 2 files changed, 96 insertions(+), 16 deletions(-) diff --git a/src/Molecule/MolComponentType.trait.st b/src/Molecule/MolComponentType.trait.st index cc25d409..25066fb0 100644 --- a/src/Molecule/MolComponentType.trait.st +++ b/src/Molecule/MolComponentType.trait.st @@ -19,70 +19,94 @@ Trait { } { #category : #actions } -MolComponentType classSide >> allConsumedEvents [ +MolComponentType classSide >> allConsumedEvents [ [ | collection | - collection := Set withAll: self consumedComponentEvents. + + collection := (self consumedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s consumedComponentEvents ] ]. + ^ collection asOrderedCollection ] +] { #category : #actions } -MolComponentType classSide >> allProducedEvents [ +MolComponentType classSide >> allProducedEvents [ [ | collection | - collection := Set withAll: self producedComponentEvents. + + collection := (self producedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s producedComponentEvents ] ]. + ^ collection asOrderedCollection ] +] { #category : #actions } -MolComponentType classSide >> allProvidedParameters [ +MolComponentType classSide >> allProvidedParameters [ [ | collection | - collection := Set withAll: self providedComponentParameters. + + collection := (self providedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentParameters ] ]. + ^ collection asOrderedCollection ] +] { #category : #actions } -MolComponentType classSide >> allProvidedServices [ +MolComponentType classSide >> allProvidedServices [ [ | collection | - collection := Set withAll: self providedComponentServices. + + collection := (self providedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentServices ] ]. + ^ collection asOrderedCollection ] +] { #category : #actions } -MolComponentType classSide >> allUsedParameters [ +MolComponentType classSide >> allUsedParameters [ [ | collection | - collection := Set withAll: self usedComponentParameters. + + collection := (self usedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentParameters ] ]. + ^ collection asOrderedCollection ] +] { #category : #actions } -MolComponentType classSide >> allUsedServices [ +MolComponentType classSide >> allUsedServices [ [ | collection | - collection := Set withAll: self usedComponentServices. + + collection := (self usedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentServices ] ]. + ^ collection asOrderedCollection ] +] { #category : #'accessing - events' } MolComponentType classSide >> consumedComponentEvents [ diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index b48dea0d..2c9bb95f 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -51,6 +51,10 @@ MolHomeServices >> activateComponent: aComponentClass named: aName [ ifAbsent: [ ^ComponentAlreadyActivatedError signal: 'Component is already activated.' ]. component componentConnector activateComponent. + + "Manage connexion between components" + MolComponentManager default locatorServices resolveWaitingSubscriptions: component. + component componentActivate. component triggerEvent: #activateComponent with: component. @@ -68,11 +72,63 @@ MolHomeServices >> addDeployedComponent: aComponentClass [ ] { #category : #private } -MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ +MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ [ - self deprecated: 'Use checkInstantiationOfComponent: named:' - transformWith: '`@receiver checkInstanciationOfComponent: `@aComponentClass named: `@aComponentName' -> '`@receiver checkInstantiationOfComponent: `@aComponentClass named: `@aComponentName'. - ^ self checkInstantiationOfComponent: aComponentClass named: aComponentName + | deployed component overridedTypes | + aComponentName ifNil: [ + ^ WrongComponentNameError new messageText: + 'Can not instanciate a component without name' ]. + + aComponentName isSymbol ifFalse: [ + ^ WrongComponentNameError new messageText: + 'Can not instanciate a component with a name wish is not a symbol' ]. + + deployed := self deployedComponents at: aComponentClass ifAbsent: [ + ^ ComponentNotDeployedError new messageText: + 'Can not instanciate a non deployed component' ]. + deployed at: aComponentName ifPresent: [ :e | + e ifNotNil: [ + ^ ComponentAlreadyExistsError new messageText: + 'Can not instanciate a component with the same name of another component, please change the name of the component' ] ]. + + component := MolComponentManager default locatorServices + searchComponentTypeImplementorFor: aComponentClass componentType + named: aComponentName. + component ifNotNil: [ + ^ ComponentAlreadyExistsError new messageText: + 'Can not instanciate a component with the same type and name of another component, please change the name of the component' ]. + + aComponentClass componentType allProvidedServices do: [ :e | + (MolComponentManager default locatorServices + searchServicesProviderFor: e + named: aComponentName) isNotFoundServices ifFalse: [ + ^ ComponentProvidedServicesAlreadyExistsError new messageText: + 'Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. + + aComponentClass componentType allProvidedParameters do: [ :e | + (MolComponentManager default locatorServices + searchParametersProviderFor: e + named: aComponentName) isNotFoundParameters ifFalse: [ + ^ ComponentProvidedParametersAlreadyExistsError new messageText: + 'Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ]. + + aComponentClass isOverrideComponentType ifTrue: [ + overridedTypes := aComponentClass overridedComponentTypes. + overridedTypes do: [ :type | + type allProvidedServices do: [ :e | + (MolComponentManager default locatorServices + searchServicesProviderFor: e + named: aComponentName) isNotFoundServices ifFalse: [ + ^ ComponentProvidedServicesAlreadyExistsError new messageText: + '(Inheritance problem) Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. + type allProvidedParameters do: [ :e | + (MolComponentManager default locatorServices + searchParametersProviderFor: e + named: aComponentName) isNotFoundParameters ifFalse: [ + ^ ComponentProvidedServicesAlreadyExistsError new messageText: + '(Inheritance problem) Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ]. + ^ nil +] ] { #category : #private } From 77ab2ce1ad10535cc97d6e9e3d37a6d2464ef223 Mon Sep 17 00:00:00 2001 From: Eliott-Guevel Date: Tue, 24 Oct 2023 11:02:18 +0200 Subject: [PATCH 5/9] removed code duplication --- src/Molecule/MolHomeServices.class.st | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index 2c9bb95f..736114eb 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -60,9 +60,6 @@ MolHomeServices >> activateComponent: aComponentClass named: aName [ MolUtils log: aComponentClass printString , ' named: ' , aName printString , ' is activated.'. - "manage connexion between components" - MolComponentManager default locatorServices resolveWaitingSubscriptions: component. - ^ component ] From c36249275885690a5912efe798077a5c139b5999 Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:50:59 +0200 Subject: [PATCH 6/9] Fix method format --- src/Molecule/MolComponentFactory.class.st | 13 +++--- src/Molecule/MolComponentType.trait.st | 52 ++++++++++------------- src/Molecule/MolHomeServices.class.st | 3 +- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/Molecule/MolComponentFactory.class.st b/src/Molecule/MolComponentFactory.class.st index bfe8da1c..ebebf079 100644 --- a/src/Molecule/MolComponentFactory.class.st +++ b/src/Molecule/MolComponentFactory.class.st @@ -572,16 +572,16 @@ MolComponentFactory >> dirtyComponents [ ] { #category : #'private - code generation' } -MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollection in: aComponent suffix: suffix [ [ +MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollection in: aComponent suffix: suffix [ | selector sourceCode sourceMethod method | - + aCollection copy do: [ :e | | trait | - + "e can be another thing that a Trait, need to check nature of e before generate" ( e notNil and:[ e isTrait and:[( e isComponentServices or:[ e isComponentParameters or:[ e isComponentEvents ]])]]) ifTrue:[ - + trait := e. - + selector := ('get' , trait printString , suffix) asSymbol. sourceCode := self getSourceCodeFor: aSymbol trait: trait selector: selector. (aComponent allSelectors includes: selector) ifFalse: [ @@ -600,11 +600,10 @@ MolComponentFactory >> generateComponentAccessorsFor: aSymbol withList: aCollect ]. ]. ]. - + ]. ] ] -] { #category : #'code generation' } MolComponentFactory >> generateOrRemoveConsumedEventsComponentAccessorsFor: aComponent [ diff --git a/src/Molecule/MolComponentType.trait.st b/src/Molecule/MolComponentType.trait.st index 25066fb0..7a95aed5 100644 --- a/src/Molecule/MolComponentType.trait.st +++ b/src/Molecule/MolComponentType.trait.st @@ -19,11 +19,11 @@ Trait { } { #category : #actions } -MolComponentType classSide >> allConsumedEvents [ [ +MolComponentType classSide >> allConsumedEvents [ | collection | - + collection := (self consumedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s consumedComponentEvents @@ -31,82 +31,76 @@ MolComponentType classSide >> allConsumedEvents [ [ ^ collection asOrderedCollection ] -] { #category : #actions } -MolComponentType classSide >> allProducedEvents [ [ +MolComponentType classSide >> allProducedEvents [ | collection | - + collection := (self producedComponentEvents select:[ :e | e notNil and:[ e isTrait and:[ e isComponentEvents ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s producedComponentEvents ] ]. - + ^ collection asOrderedCollection ] -] { #category : #actions } -MolComponentType classSide >> allProvidedParameters [ [ +MolComponentType classSide >> allProvidedParameters [ | collection | - + collection := (self providedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentParameters ] ]. - + ^ collection asOrderedCollection ] -] { #category : #actions } -MolComponentType classSide >> allProvidedServices [ [ +MolComponentType classSide >> allProvidedServices [ | collection | - + collection := (self providedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s providedComponentServices ] ]. - + ^ collection asOrderedCollection ] -] { #category : #actions } -MolComponentType classSide >> allUsedParameters [ [ +MolComponentType classSide >> allUsedParameters [ | collection | - + collection := (self usedComponentParameters select:[ :e | e notNil and:[ e isTrait and:[ e isComponentParameters ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentParameters ] ]. - + ^ collection asOrderedCollection ] -] { #category : #actions } -MolComponentType classSide >> allUsedServices [ [ +MolComponentType classSide >> allUsedServices [ | collection | - + collection := (self usedComponentServices select:[ :e | e notNil and:[ e isTrait and:[ e isComponentServices ]]]) asSet. - + self allSuperclassesDo: [ :s | (s allTraits includes: MolComponentType) ifTrue: [ collection addAll: s usedComponentServices ] ]. - + ^ collection asOrderedCollection ] -] { #category : #'accessing - events' } MolComponentType classSide >> consumedComponentEvents [ diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index 736114eb..e102022e 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -69,7 +69,7 @@ MolHomeServices >> addDeployedComponent: aComponentClass [ ] { #category : #private } -MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ [ +MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ | deployed component overridedTypes | aComponentName ifNil: [ @@ -126,7 +126,6 @@ MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aCompon '(Inheritance problem) Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ]. ^ nil ] -] { #category : #private } MolHomeServices >> checkInstantiationOfComponent: aComponentClass named: aComponentName [ From 24ec9fd5ad4ecd70ab1e67d264ad9a21dd8ce556 Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:04:33 +0200 Subject: [PATCH 7/9] Clean not used method --- src/Molecule/MolHomeServices.class.st | 63 +-------------------------- 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index e102022e..84e1e812 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -68,65 +68,6 @@ MolHomeServices >> addDeployedComponent: aComponentClass [ self deployedComponents at: aComponentClass ifAbsentPut: [Dictionary new] ] -{ #category : #private } -MolHomeServices >> checkInstanciationOfComponent: aComponentClass named: aComponentName [ - - | deployed component overridedTypes | - aComponentName ifNil: [ - ^ WrongComponentNameError new messageText: - 'Can not instanciate a component without name' ]. - - aComponentName isSymbol ifFalse: [ - ^ WrongComponentNameError new messageText: - 'Can not instanciate a component with a name wish is not a symbol' ]. - - deployed := self deployedComponents at: aComponentClass ifAbsent: [ - ^ ComponentNotDeployedError new messageText: - 'Can not instanciate a non deployed component' ]. - deployed at: aComponentName ifPresent: [ :e | - e ifNotNil: [ - ^ ComponentAlreadyExistsError new messageText: - 'Can not instanciate a component with the same name of another component, please change the name of the component' ] ]. - - component := MolComponentManager default locatorServices - searchComponentTypeImplementorFor: aComponentClass componentType - named: aComponentName. - component ifNotNil: [ - ^ ComponentAlreadyExistsError new messageText: - 'Can not instanciate a component with the same type and name of another component, please change the name of the component' ]. - - aComponentClass componentType allProvidedServices do: [ :e | - (MolComponentManager default locatorServices - searchServicesProviderFor: e - named: aComponentName) isNotFoundServices ifFalse: [ - ^ ComponentProvidedServicesAlreadyExistsError new messageText: - 'Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. - - aComponentClass componentType allProvidedParameters do: [ :e | - (MolComponentManager default locatorServices - searchParametersProviderFor: e - named: aComponentName) isNotFoundParameters ifFalse: [ - ^ ComponentProvidedParametersAlreadyExistsError new messageText: - 'Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ]. - - aComponentClass isOverrideComponentType ifTrue: [ - overridedTypes := aComponentClass overridedComponentTypes. - overridedTypes do: [ :type | - type allProvidedServices do: [ :e | - (MolComponentManager default locatorServices - searchServicesProviderFor: e - named: aComponentName) isNotFoundServices ifFalse: [ - ^ ComponentProvidedServicesAlreadyExistsError new messageText: - '(Inheritance problem) Can not instanciate a component with the same services and name of another component, please change the name of the component' ] ]. - type allProvidedParameters do: [ :e | - (MolComponentManager default locatorServices - searchParametersProviderFor: e - named: aComponentName) isNotFoundParameters ifFalse: [ - ^ ComponentProvidedServicesAlreadyExistsError new messageText: - '(Inheritance problem) Can not instanciate a component with the same parameters and name of another component, please change the name of the component' ] ] ] ]. - ^ nil -] - { #category : #private } MolHomeServices >> checkInstantiationOfComponent: aComponentClass named: aComponentName [ @@ -258,7 +199,7 @@ MolHomeServices >> instantiateComponent: aComponentClass named: aName [ yourself. MolUtils log: aComponentClass printString , ' named: ' , aName printString - , ' is instanciated.'. + , ' is instantiated.'. deployed := self deployedComponents at: aComponentClass. deployed at: component componentName put: component. @@ -267,7 +208,7 @@ MolHomeServices >> instantiateComponent: aComponentClass named: aName [ connector := MolComponentConnector new. component componentConnector: connector. component componentInitialize. - component triggerEvent: #instanciateComponent with: component. + component triggerEvent: #instantiateComponent with: component. "add the component to waiting activation list" waitingForActivation add: component. From 66e1c76a57548485b025e8d48f41a696a0e26d6c Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:16:26 +0200 Subject: [PATCH 8/9] Fix deprecated methods --- src/Molecule/MolHomeServices.class.st | 6 ++--- src/Molecule/MolUtils.class.st | 32 +++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Molecule/MolHomeServices.class.st b/src/Molecule/MolHomeServices.class.st index 84e1e812..55a4f1e5 100644 --- a/src/Molecule/MolHomeServices.class.st +++ b/src/Molecule/MolHomeServices.class.st @@ -42,7 +42,7 @@ MolHomeServices >> activateComponent: aComponentClass named: aName [ "get to be activated component instance" component := self instanceOf: aComponentClass named: aName. component ifNil:[ - ^ComponentNotFoundError signal: 'Can not activate a non instanciated component'. + ^ComponentNotFoundError signal: 'Can not activate a non instantiated component'. ]. "remove from waiting activation list" @@ -262,7 +262,7 @@ MolHomeServices >> passivateComponent: aComponentClass named: aName [ "get to be passivated component instance" component := self instanceOf: aComponentClass named: aName. component ifNil: [ - ^ComponentNotFoundError signal: 'Can not passivate a non instanciated component'. + ^ComponentNotFoundError signal: 'Can not passivate a non instantiated component'. ]. (self isWaitingForActivation: aComponentClass named: aName) ifTrue:[ @@ -311,7 +311,7 @@ MolHomeServices >> removeComponent: aComponentClass named: aName [ "Get to be removed component instance" removedComponent := self instanceOf: aComponentClass named: aName. - removedComponent ifNil:[ ComponentNotFoundError signal: 'Can not remove a non instanciated component'. ^nil ]. + removedComponent ifNil:[ ComponentNotFoundError signal: 'Can not remove a non instantiated component'. ^nil ]. "Passivation of the component if activated" (self isWaitingForActivation: aComponentClass named: aName) ifFalse: [ self passivateComponent: aComponentClass named: aName ]. diff --git a/src/Molecule/MolUtils.class.st b/src/Molecule/MolUtils.class.st index 89367f1c..32bca2bf 100644 --- a/src/Molecule/MolUtils.class.st +++ b/src/Molecule/MolUtils.class.st @@ -69,12 +69,12 @@ MolUtils class >> consumedComponentEvents: anObject [ { #category : #'quick creation' } MolUtils class >> createAllComponents [ - "instanciate and activate all deployed components" + "instantiate and activate all deployed components" + | homeServices components | - homeServices := MolComponentManager default homeServices. components := homeServices deployedComponents. - components keysDo: [ :aClass | homeServices instanciateComponent: aClass ]. + components keysDo: [ :aClass | homeServices instantiateComponent: aClass ]. components keysDo: [ :aClass | homeServices activateComponent: aClass ] ] @@ -87,30 +87,30 @@ MolUtils class >> defaultComponentName [ { #category : #'quick lifecycle' } MolUtils class >> deployAndInitializeComponent: aComponentClass named: aName [ - "auto deploy, and instanciate quickly a component and return the instance" + "auto deploy, and instantiate quickly a component and return the instance" - (MolComponentManager default deploymentServices isDeployedComponentImplementation: aComponentClass) ifFalse:[ - MolComponentManager default deploymentServices deployComponentImplementation: aComponentClass. + (MolComponentManager default deploymentServices isDeployedComponentImplementation: aComponentClass) ifFalse: [ + MolComponentManager default deploymentServices deployComponentImplementation: aComponentClass ]. - ^ MolComponentManager default homeServices instanciateComponent: aComponentClass named: aName + ^ MolComponentManager default homeServices instantiateComponent: aComponentClass named: aName ] { #category : #'quick lifecycle' } MolUtils class >> deployAndInitializeComponents: aComponentClassList [ - "deploy and instanciate quickly a list of components and return all instances" - | components | + "deploy and instantiate quickly a list of components and return all instances" - components := OrderedCollection new. - aComponentClassList ifNil:[^components]. - aComponentClassList do:[ :componentClass | - MolComponentManager default deploymentServices deployComponentImplementation: componentClass. + | components | + components := OrderedCollection new. + aComponentClassList ifNil: [ ^ components ]. + aComponentClassList do: [ :componentClass | + MolComponentManager default deploymentServices deployComponentImplementation: componentClass ]. - aComponentClassList do:[ :componentClass | - (MolComponentManager default homeServices instanciateComponent: componentClass) ifNotNil:[ :c | components add: c]. + aComponentClassList do: [ :componentClass | + (MolComponentManager default homeServices instantiateComponent: componentClass) ifNotNil: [ :c | components add: c ] ]. - ^components + ^ components ] { #category : #accessing } From 8b574280681888f410153b447b0061b54b936925 Mon Sep 17 00:00:00 2001 From: Pierre Laborde <49183340+labordep@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:27:46 +0200 Subject: [PATCH 9/9] Rewrite test without deprecated methods --- .../MolComponentImplTest.class.st | 10 +- .../MolComponentManagerTest.class.st | 49 +- src/Molecule-Tests/MolEventsTest.class.st | 317 ++++---- .../MolHomeServicesTest.class.st | 694 +++++++++++------- .../MolInheritanceTests.class.st | 20 +- .../MolLocatorServicesTest.class.st | 94 ++- src/Molecule-Tests/MolParametersTest.class.st | 105 ++- src/Molecule-Tests/MolServicesTest.class.st | 165 +++-- .../MolTestComponentTreeLevel0Impl.class.st | 17 +- .../MolTestComponentTreeLevel1Impl.class.st | 17 +- src/Molecule-Tests/MolUtilsTest.class.st | 327 ++++++--- 11 files changed, 1124 insertions(+), 691 deletions(-) diff --git a/src/Molecule-Tests/MolComponentImplTest.class.st b/src/Molecule-Tests/MolComponentImplTest.class.st index 992779f6..24c7d91f 100644 --- a/src/Molecule-Tests/MolComponentImplTest.class.st +++ b/src/Molecule-Tests/MolComponentImplTest.class.st @@ -586,14 +586,15 @@ MolComponentImplTest >> testServicesProviders [ { #category : #'test - component creation' } MolComponentImplTest >> testStart [ + MolCompleteComponentImpl deploy. - MolCompleteComponentImpl instanciate. + MolCompleteComponentImpl instantiate. self assert: (MolUtils instanceOf: MolCompleteComponentImpl) notNil. MolCompleteComponentImpl activate. MolCompleteComponentImpl passivate. MolCompleteComponentImpl remove. self assert: (MolUtils instanceOf: MolCompleteComponentImpl) isNil. - MolCompleteComponentImpl undeploy. + MolCompleteComponentImpl undeploy ] { #category : #'test - component creation' } @@ -612,14 +613,15 @@ MolComponentImplTest >> testStart2 [ { #category : #'test - component creation' } MolComponentImplTest >> testStartWithName [ + MolCompleteComponentImpl deploy. - MolCompleteComponentImpl instanciate: #myComponent. + MolCompleteComponentImpl instantiate: #myComponent. self assert: (MolUtils instanceOf: MolCompleteComponentImpl named: #myComponent) notNil. MolCompleteComponentImpl activate: #myComponent. MolCompleteComponentImpl passivate: #myComponent. MolCompleteComponentImpl remove: #myComponent. self assert: (MolUtils instanceOf: MolCompleteComponentImpl named: #myComponent) isNil. - MolCompleteComponentImpl undeploy. + MolCompleteComponentImpl undeploy ] { #category : #'test - component creation' } diff --git a/src/Molecule-Tests/MolComponentManagerTest.class.st b/src/Molecule-Tests/MolComponentManagerTest.class.st index 3a989a02..b45e5348 100644 --- a/src/Molecule-Tests/MolComponentManagerTest.class.st +++ b/src/Molecule-Tests/MolComponentManagerTest.class.st @@ -43,19 +43,27 @@ MolComponentManagerTest >> testCleanUpIgnoreErrors [ { #category : #'tests - component start & stop' } MolComponentManagerTest >> testComponentTree [ "Start a component Tree : a component which is starting sub components, etc." + | nb | - MolComponentManager default deploymentServices deployComponentImplementation: MolTestComponentTreeLevel0Impl. - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel0Impl. - MolComponentManager default homeServices activateComponent: MolTestComponentTreeLevel0Impl. - + MolComponentManager default deploymentServices + deployComponentImplementation: MolTestComponentTreeLevel0Impl. + MolComponentManager default homeServices instantiateComponent: + MolTestComponentTreeLevel0Impl. + MolComponentManager default homeServices activateComponent: + MolTestComponentTreeLevel0Impl. + "Check started components" nb := 0. - MolComponentManager default homeServices deployedComponents valuesDo:[ :compList | nb := nb + (compList size) ]. + MolComponentManager default homeServices deployedComponents + valuesDo: [ :compList | nb := nb + compList size ]. self assert: nb equals: 13. - - MolComponentManager default homeServices passivateComponent: MolTestComponentTreeLevel0Impl. - MolComponentManager default homeServices removeComponent: MolTestComponentTreeLevel0Impl. - MolComponentManager default deploymentServices undeployComponentImplementation: MolTestComponentTreeLevel2Impl. + + MolComponentManager default homeServices passivateComponent: + MolTestComponentTreeLevel0Impl. + MolComponentManager default homeServices removeComponent: + MolTestComponentTreeLevel0Impl. + MolComponentManager default deploymentServices + undeployComponentImplementation: MolTestComponentTreeLevel2Impl ] { #category : #tests } @@ -196,20 +204,25 @@ MolComponentManagerTest >> testIsRunningComponents [ { #category : #'tests - general' } MolComponentManagerTest >> testIsRunningComponentsAllSteps [ - MolComponentManager default deploymentServices deployComponentImplementation: MolCompleteComponentImpl. + MolComponentManager default deploymentServices + deployComponentImplementation: MolCompleteComponentImpl. self assert: MolComponentManager isRunningComponents equals: false. - - MolComponentManager default homeServices instanciateComponent: MolCompleteComponentImpl. + + MolComponentManager default homeServices instantiateComponent: + MolCompleteComponentImpl. self assert: MolComponentManager isRunningComponents equals: true. - - MolComponentManager default homeServices activateComponent: MolCompleteComponentImpl. + + MolComponentManager default homeServices activateComponent: + MolCompleteComponentImpl. self assert: MolComponentManager isRunningComponents equals: true. - - MolComponentManager default homeServices passivateComponent: MolCompleteComponentImpl. + + MolComponentManager default homeServices passivateComponent: + MolCompleteComponentImpl. self assert: MolComponentManager isRunningComponents equals: true. - MolComponentManager default homeServices removeComponent: MolCompleteComponentImpl. - self assert: MolComponentManager isRunningComponents equals: false. + MolComponentManager default homeServices removeComponent: + MolCompleteComponentImpl. + self assert: MolComponentManager isRunningComponents equals: false ] { #category : #tests } diff --git a/src/Molecule-Tests/MolEventsTest.class.st b/src/Molecule-Tests/MolEventsTest.class.st index c3c614c8..6a91677a 100644 --- a/src/Molecule-Tests/MolEventsTest.class.st +++ b/src/Molecule-Tests/MolEventsTest.class.st @@ -24,145 +24,154 @@ MolEventsTest >> tearDown [ { #category : #tests } MolEventsTest >> testSeveralListeners [ + | warner listener1 listener2 | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #warner. - listener1 := MolMyListenerComponentImpl instanciate: #listener1. - listener2 := MolMyListenerComponentImpl instanciate: #listener2. - + warner := MolMyWarnerComponentImpl instantiate: #warner. + listener1 := MolMyListenerComponentImpl instantiate: #listener1. + listener2 := MolMyListenerComponentImpl instantiate: #listener2. + "Subscriptions" listener1 forEvents: MolMyStateChangeEvents useProducer: #warner. listener2 forEvents: MolMyStateChangeEvents useProducer: #warner. - + "Activation" MolMyWarnerComponentImpl activate: #warner. MolMyListenerComponentImpl activate: #listener1. - + "Tests" warner operationalEvent. self assert: listener1 currentState equals: #operational. self assert: listener2 currentState equals: nil. - + MolMyListenerComponentImpl activate: #listener2. warner maintenanceEvent. self assert: listener1 currentState equals: #maintenance. self assert: listener2 currentState equals: #maintenance. - + MolMyListenerComponentImpl passivate: #listener1. warner failureEvent. self assert: listener1 currentState equals: #maintenance. - self assert: listener2 currentState equals: #failure. + self assert: listener2 currentState equals: #failure ] { #category : #tests } MolEventsTest >> testSeveralWarners [ + | warner1 warner2 listener subscriptions subscribers | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner1 := MolMyWarnerComponentImpl instanciate: #warner1. - warner2 := MolMyWarnerComponentImpl instanciate: #warner2. - listener := MolMyListenerComponentImpl instanciate: #listener. - + warner1 := MolMyWarnerComponentImpl instantiate: #warner1. + warner2 := MolMyWarnerComponentImpl instantiate: #warner2. + listener := MolMyListenerComponentImpl instantiate: #listener. + "Subscriptions" - subscriptions := (Array with: #warner1 with: #warner2). - listener forEvents: MolMyStateChangeEvents useAllProducers: subscriptions. + subscriptions := Array with: #warner1 with: #warner2. + listener + forEvents: MolMyStateChangeEvents + useAllProducers: subscriptions. - subscribers := listener eventsSubscribers. + subscribers := listener eventsSubscribers. self assert: subscribers size equals: 1. self assert: (subscribers at: MolMyStateChangeEvents) size equals: 2. - self assert: ((subscribers at: MolMyStateChangeEvents) at: 1) equals: #warner1. - self assert: ((subscribers at: MolMyStateChangeEvents) at: 2) equals: #warner2. - + self + assert: ((subscribers at: MolMyStateChangeEvents) at: 1) + equals: #warner1. + self + assert: ((subscribers at: MolMyStateChangeEvents) at: 2) + equals: #warner2. + "Activation" MolMyWarnerComponentImpl activate: #warner1. MolMyListenerComponentImpl activate: #listener. - + "Tests" warner1 operationalEvent. self assert: listener currentState equals: #operational. warner2 failureEvent. "warner 2 is not active, so he can't send an event" self assert: listener currentState equals: #operational. - + MolMyWarnerComponentImpl activate: #warner2. warner1 maintenanceEvent. self assert: listener currentState equals: #maintenance. warner2 failureEvent. self assert: listener currentState equals: #failure. - + MolMyWarnerComponentImpl passivate: #warner1. warner1 operationalEvent. "warner 1 is not active, so he can't send an event" - self assert: listener currentState equals: #failure. + self assert: listener currentState equals: #failure ] { #category : #tests } MolEventsTest >> testSimpleListenerNotActivated [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate. - listener := MolMyListenerComponentImpl instanciate. - + warner := MolMyWarnerComponentImpl instantiate. + listener := MolMyListenerComponentImpl instantiate. + "Activation / Passivation" MolMyWarnerComponentImpl activate. - + warner operationalEvent. self assert: listener currentState equals: nil. - + MolMyListenerComponentImpl activate. warner failureEvent. self assert: listener currentState equals: #failure. - + MolMyListenerComponentImpl passivate. warner maintenanceEvent. self assert: listener currentState equals: #failure. - + MolMyListenerComponentImpl activate. warner operationalEvent. - self assert: listener currentState equals: #operational. - + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSimpleListenerNotActivatedNamed [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Subscription" listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. - + "Activation" MolMyWarnerComponentImpl activate: #myWarner. - + warner operationalEvent. self assert: listener currentState equals: nil. - + MolMyListenerComponentImpl activate: #myListener. warner failureEvent. self assert: listener currentState equals: #failure. - + MolMyListenerComponentImpl passivate: #myListener. warner maintenanceEvent. self assert: listener currentState equals: #failure. - + MolMyListenerComponentImpl activate: #myListener. warner operationalEvent. - self assert: listener currentState equals: #operational. + self assert: listener currentState equals: #operational ] { #category : #tests } @@ -180,255 +189,257 @@ MolEventsTest >> testSimpleWarnerDuringActivation [ { #category : #tests } MolEventsTest >> testSimpleWarnerNotActivated [ "A component not activated send events." + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate. - listener := MolMyListenerComponentImpl instanciate. - + warner := MolMyWarnerComponentImpl instantiate. + listener := MolMyListenerComponentImpl instantiate. + "Activation" MolMyListenerComponentImpl activate. - + "Tests" warner operationalEvent. self assert: listener currentState isNil. - + MolMyWarnerComponentImpl activate. warner failureEvent. self assert: listener currentState equals: #failure. - + MolMyWarnerComponentImpl passivate. warner maintenanceEvent. self assert: listener currentState equals: #failure. - + MolMyWarnerComponentImpl activate. warner operationalEvent. - self assert: listener currentState equals: #operational. - + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSimpleWarnerNotActivatedNamed [ "A component not activated send events." + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Subscription" listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. - + "Activation" MolMyListenerComponentImpl activate: #myListener. - + "Tests" warner maintenanceEvent. self assert: listener currentState isNil. - + MolMyWarnerComponentImpl activate: #myWarner. warner failureEvent. self assert: listener currentState equals: #failure. - + MolMyWarnerComponentImpl passivate: #myWarner. warner maintenanceEvent. self assert: listener currentState equals: #failure. - + MolMyWarnerComponentImpl activate: #myWarner. warner operationalEvent. - self assert: listener currentState equals: #operational. - + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSimpleWarningSystem [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation : by default, components name is #default" - warner := MolMyWarnerComponentImpl instanciate. - listener := MolMyListenerComponentImpl instanciate. - + warner := MolMyWarnerComponentImpl instantiate. + listener := MolMyListenerComponentImpl instantiate. + "Subscription : by default, a component is subscribed to events from component #default." "It will be effective after activation" - + "Activation : by default, components are activated with name default" MolMyWarnerComponentImpl activate. MolMyListenerComponentImpl activate. - + "Tests" self assert: listener currentState equals: nil. - + warner operationalEvent. self assert: listener currentState equals: #operational. - + warner failureEvent. self assert: listener currentState equals: #failure. - self assert: listener failureLevel notNil. - + self assert: listener failureLevel notNil ] { #category : #tests } MolEventsTest >> testSimpleWarningSystemNamed [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Subscription : it should be done in SCMMyListenerComponentImpl > componentInitialize" listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. - + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. - + "Tests" self assert: listener currentState equals: nil. - + warner operationalEvent. self assert: listener currentState equals: #operational. - + warner failureEvent. self assert: listener currentState equals: #failure. - self assert: listener failureLevel notNil. - + self assert: listener failureLevel notNil ] { #category : #tests } MolEventsTest >> testSimpleWarningSystemNamedDelayed [ -"Test subscription after activation" + "Test subscription after activation" + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Initialization and activation of listener" - listener := MolMyListenerComponentImpl instanciate: #myListener. + listener := MolMyListenerComponentImpl instantiate: #myListener. listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. "Warner does not exist." MolMyListenerComponentImpl activate: #myListener. - + "Initialization and activation of warner" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. + warner := MolMyWarnerComponentImpl instantiate: #myWarner. MolMyWarnerComponentImpl activate: #myWarner. - + "Tests" warner operationalEvent. - self assert: listener currentState equals: #operational. - + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSubscribeAndAddProviderAfter [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. "Subscription : it should be done in SCMMyListenerComponentImpl > componentInitialize, this is done after subscription so the new provider should be automaticaly received by all listeners" listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. - + "Tests" self assert: listener currentState equals: nil. - + warner operationalEvent. self assert: listener currentState equals: #operational. - + warner failureEvent. self assert: listener currentState equals: #failure. - self assert: listener failureLevel notNil. - + self assert: listener failureLevel notNil ] { #category : #tests } MolEventsTest >> testSubscribeAndRemoveProviderAfter [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. "Subscription : it should be done in SCMMyListenerComponentImpl > componentInitialize, this is done after subscription so the new provider should be automaticaly received by all listeners" - listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. + listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. listener forEvents: MolMyStateChangeEvents removeProducer: #myWarner. - + warner operationalEvent. self assert: listener currentState equals: nil. - + "Re add the provider" - listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. - + listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. + warner operationalEvent. - self assert: listener currentState equals: #operational. + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSubscribeAndUseProviderAfter [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. "Subscription : it should be done in SCMMyListenerComponentImpl > componentInitialize, this is done after subscription so the new provider should be automaticaly received by all listeners" listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. - + "Tests" self assert: listener currentState equals: nil. - + warner operationalEvent. self assert: listener currentState equals: #operational. - + warner failureEvent. self assert: listener currentState equals: #failure. - self assert: listener failureLevel notNil. - + self assert: listener failureLevel notNil ] { #category : #tests } MolEventsTest >> testSubscribeAndUseProviderAfter2 [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. @@ -436,85 +447,85 @@ MolEventsTest >> testSubscribeAndUseProviderAfter2 [ "Subscription : it should be done in SCMMyListenerComponentImpl > componentInitialize, this is done after subscription so the new provider should be automaticaly received by all listeners" listener forEvents: MolMyStateChangeEvents useProducer: nil. listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. - + "Tests" self assert: listener currentState equals: nil. - + warner operationalEvent. self assert: listener currentState equals: #operational. - + warner failureEvent. self assert: listener currentState equals: #failure. - self assert: listener failureLevel notNil. - + self assert: listener failureLevel notNil ] { #category : #tests } MolEventsTest >> testSubscribeNothing [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. - + warner operationalEvent. - self assert: listener currentState equals: nil. - + self assert: listener currentState equals: nil ] { #category : #tests } MolEventsTest >> testSubscribeStopAndRestartProvider [ + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Instanciation" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. - listener := MolMyListenerComponentImpl instanciate: #myListener. - + warner := MolMyWarnerComponentImpl instantiate: #myWarner. + listener := MolMyListenerComponentImpl instantiate: #myListener. + "Activation" MolMyWarnerComponentImpl activate: #myWarner. MolMyListenerComponentImpl activate: #myListener. - listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. + listener forEvents: MolMyStateChangeEvents addProducer: #myWarner. "Stop and restart, the Listner should be automaticaly reconnected" MolMyWarnerComponentImpl stop: #myWarner. - - warner := MolMyWarnerComponentImpl instanciate: #myWarner. + + warner := MolMyWarnerComponentImpl instantiate: #myWarner. MolMyWarnerComponentImpl activate: #myWarner. warner operationalEvent. - self assert: listener currentState equals: #operational. + self assert: listener currentState equals: #operational ] { #category : #tests } MolEventsTest >> testSubscriptionBeforeInstanciation [ "A component not activated send events." + | warner listener | "Deployment" MolMyWarnerComponentImpl deploy. MolMyListenerComponentImpl deploy. - + "Creation and subscription of listener" - listener := MolMyListenerComponentImpl instanciate: #myListener. + listener := MolMyListenerComponentImpl instantiate: #myListener. listener forEvents: MolMyStateChangeEvents useProducer: #myWarner. MolMyListenerComponentImpl activate: #myListener. - + "Creation of warner" - warner := MolMyWarnerComponentImpl instanciate: #myWarner. + warner := MolMyWarnerComponentImpl instantiate: #myWarner. MolMyWarnerComponentImpl activate: #myWarner. - + "Test" warner maintenanceEvent. - self assert: listener currentState equals: #maintenance. - + self assert: listener currentState equals: #maintenance ] diff --git a/src/Molecule-Tests/MolHomeServicesTest.class.st b/src/Molecule-Tests/MolHomeServicesTest.class.st index 44244043..7937ddf0 100644 --- a/src/Molecule-Tests/MolHomeServicesTest.class.st +++ b/src/Molecule-Tests/MolHomeServicesTest.class.st @@ -31,390 +31,513 @@ MolHomeServicesTest >> tearDown [ { #category : #tests } MolHomeServicesTest >> testActivateComponent [ "Test Component properties after activation" + | manager component | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + component := manager homeServices instantiateComponent: + MolCompleteComponentImpl. manager homeServices activateComponent: MolCompleteComponentImpl. - - self assert: component componentName equals: MolUtils defaultComponentName. - self assert: (component componentConnector isKindOf: MolComponentConnector). + + self + assert: component componentName + equals: MolUtils defaultComponentName. + self assert: + (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #tests } MolHomeServicesTest >> testActivateComponentAugmentedClass [ "Test Component properties after activation" + | manager component | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolAugmentedClassToAComponent. - component := manager homeServices instanciateComponent: MolAugmentedClassToAComponent. + manager deploymentServices deployComponentImplementation: + MolAugmentedClassToAComponent. + component := manager homeServices instantiateComponent: + MolAugmentedClassToAComponent. manager homeServices activateComponent: MolAugmentedClassToAComponent. - - self assert: component componentName equals: MolUtils defaultComponentName. - self assert: (component componentConnector isKindOf: MolComponentConnector). + + self + assert: component componentName + equals: MolUtils defaultComponentName. + self assert: + (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. self assert: component servicesProviders notEmpty. - - component forServices: MolServicesTest useProvider: MolUtils defaultComponentName. - component forEvents: MolEventsTest useProducer: MolUtils defaultComponentName. - component forParameters: MolParametersTest useProvider: MolUtils defaultComponentName. + + component + forServices: MolServicesTest + useProvider: MolUtils defaultComponentName. + component + forEvents: MolEventsTest + useProducer: MolUtils defaultComponentName. + component + forParameters: MolParametersTest + useProvider: MolUtils defaultComponentName ] { #category : #tests } MolHomeServicesTest >> testActivateComponentNamed [ "Test Component properties after activation" + | manager component | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl named: #testComponent. - manager homeServices activateComponent: MolCompleteComponentImpl named: #testComponent. - + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + component := manager homeServices + instantiateComponent: MolCompleteComponentImpl + named: #testComponent. + manager homeServices + activateComponent: MolCompleteComponentImpl + named: #testComponent. + self assert: component componentName equals: #testComponent. - self assert: (component componentConnector isKindOf: MolComponentConnector). + self assert: + (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #tests } -MolHomeServicesTest >> testInstanciateComponent [ - "Test Component properties after instanciation" +MolHomeServicesTest >> testInstantiateComponent [ + "Test Component properties after instantiation" + | manager component | manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl. - + component := manager homeServices instantiateComponent: MolCompleteComponentImpl. + self assert: component componentName equals: MolUtils defaultComponentName. self assert: (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #tests } -MolHomeServicesTest >> testInstanciateComponentNamed [ +MolHomeServicesTest >> testInstantiateComponentNamed [ "Test Component properties after instanciation" + | manager component | manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl named: #testComponent. - + component := manager homeServices instantiateComponent: MolCompleteComponentImpl named: #testComponent. + self assert: component componentName equals: #testComponent. self assert: (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #'test - errors' } -MolHomeServicesTest >> testInstanciateComponentWithOverridedInstanciateTypeAndSameName [ +MolHomeServicesTest >> testInstantiateComponentWithOverridedInstanciateTypeAndSameName [ "Test exception appear" - | manager error | + | manager error | error := nil. manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. manager deploymentServices deployComponentImplementation: MolCompleteComponentChildImpl. "normal case" - manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolCompleteComponentChildImpl named: #compB] on: Error do:[ :e | - error := e. - ]. + [ + manager homeServices instantiateComponent: MolCompleteComponentChildImpl named: #compB ] + on: Error + do: [ :e | error := e ]. self assert: error isNil. - manager homeServices removeComponent: MolCompleteComponentImpl. - manager homeServices removeComponent: MolCompleteComponentChildImpl named: #compB. - + manager homeServices removeComponent: MolCompleteComponentImpl. + manager homeServices removeComponent: MolCompleteComponentChildImpl named: #compB. + "error case" - manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolCompleteComponentChildImpl] on: Error do:[ :e | - error := e. - ]. - self assert: (error isKindOf: ComponentProvidedServicesAlreadyExistsError). + [ + manager homeServices instantiateComponent: MolCompleteComponentChildImpl ] + on: Error + do: [ :e | error := e ]. + self assert: + (error isKindOf: ComponentProvidedServicesAlreadyExistsError) ] { #category : #'test - errors' } -MolHomeServicesTest >> testInstanciateComponentWithSameNameAndServices [ +MolHomeServicesTest >> testInstantiateComponentWithSameNameAndServices [ "Test exception appear" - | manager error | + | manager error | error := nil. manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. manager deploymentServices deployComponentImplementation: MolCompleteComponent2Impl. - + "normal case" - manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolCompleteComponent2Impl named: #compB] on: Error do:[ :e | - error := e. - ]. + [ + manager homeServices instantiateComponent: MolCompleteComponent2Impl named: #compB ] + on: Error + do: [ :e | error := e ]. self assert: error isNil. - manager homeServices removeComponent: MolCompleteComponentImpl. - manager homeServices removeComponent: MolCompleteComponent2Impl named: #compB. - + manager homeServices removeComponent: MolCompleteComponentImpl. + manager homeServices removeComponent: MolCompleteComponent2Impl named: #compB. + "error case" - manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolCompleteComponent2Impl] on: Error do:[ :e | - error := e. - ]. - self assert: (error isKindOf: ComponentProvidedServicesAlreadyExistsError). + [ + manager homeServices instantiateComponent: MolCompleteComponent2Impl ] + on: Error + do: [ :e | error := e ]. + self assert: + (error isKindOf: ComponentProvidedServicesAlreadyExistsError) ] { #category : #'test - errors' } -MolHomeServicesTest >> testInstanciateComponentWithSameNameAndType [ +MolHomeServicesTest >> testInstantiateComponentWithSameNameAndType [ "Test exception appear" - | manager error | + | manager error | error := nil. manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. manager deploymentServices deployComponentImplementation: MolBasicComponentImpl2. - + "normal case" - manager homeServices instanciateComponent: MolBasicComponentImpl. + manager homeServices instantiateComponent: MolBasicComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolBasicComponentImpl2 named: #compB] on: Error do:[ :e | - error := e. - ]. + [ + manager homeServices instantiateComponent: MolBasicComponentImpl2 named: #compB ] + on: Error + do: [ :e | error := e ]. self assert: error isNil. - manager homeServices removeComponent: MolBasicComponentImpl. - manager homeServices removeComponent: MolBasicComponentImpl2 named: #compB. - + manager homeServices removeComponent: MolBasicComponentImpl. + manager homeServices removeComponent: MolBasicComponentImpl2 named: #compB. + "error case" - manager homeServices instanciateComponent: MolBasicComponentImpl. + manager homeServices instantiateComponent: MolBasicComponentImpl. error := nil. - [manager homeServices instanciateComponent: MolBasicComponentImpl2] on: Error do:[ :e | - error := e. - ]. - self assert: (error isKindOf: ComponentAlreadyExistsError). + [ manager homeServices instantiateComponent: MolBasicComponentImpl2 ] + on: Error + do: [ :e | error := e ]. + self assert: (error isKindOf: ComponentAlreadyExistsError) ] { #category : #tests } MolHomeServicesTest >> testPassivateComponent [ "Test Component properties after passivation" + | manager component | manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl. + component := manager homeServices instantiateComponent: MolCompleteComponentImpl. manager homeServices activateComponent: MolCompleteComponentImpl. manager homeServices passivateComponent: MolCompleteComponentImpl. - + self assert: component componentName equals: MolUtils defaultComponentName. self assert: (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #tests } MolHomeServicesTest >> testPassivateComponentNamed [ "Test Component properties after passivation" + | manager component | manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl named: #testComponent. + component := manager homeServices instantiateComponent: MolCompleteComponentImpl named: #testComponent. manager homeServices activateComponent: MolCompleteComponentImpl named: #testComponent. manager homeServices passivateComponent: MolCompleteComponentImpl named: #testComponent. - + self assert: component componentName equals: #testComponent. self assert: (component componentConnector isKindOf: MolComponentConnector). self assert: component eventsNotifiers notEmpty. self assert: component eventsSubscribers notEmpty. self assert: component parametersProviders notEmpty. - self assert: component servicesProviders notEmpty. + self assert: component servicesProviders notEmpty ] { #category : #tests } MolHomeServicesTest >> testRemoveAllComponents [ "Test Component release on a remove" + | manager | manager := MolComponentManager default. manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - manager homeServices instanciateComponent: MolCompleteComponentImpl named: #comp1. - manager homeServices instanciateComponent: MolCompleteComponentImpl named: #comp2. - manager homeServices instanciateComponent: MolCompleteComponentImpl named: #comp3. + manager homeServices instantiateComponent: MolCompleteComponentImpl named: #comp1. + manager homeServices instantiateComponent: MolCompleteComponentImpl named: #comp2. + manager homeServices instantiateComponent: MolCompleteComponentImpl named: #comp3. manager homeServices activateComponent: MolCompleteComponentImpl named: #comp1. manager homeServices activateComponent: MolCompleteComponentImpl named: #comp2. manager homeServices passivateComponent: MolCompleteComponentImpl named: #comp2. - + self assert: (manager homeServices isDeployedComponent: MolCompleteComponentImpl) equals: true. self assert: (manager homeServices deployedComponents at: MolCompleteComponentImpl) notEmpty. self assert: manager homeServices waitingForActivation notEmpty. - + manager homeServices removeAllComponents. - + self assert: (manager homeServices isDeployedComponent: MolCompleteComponentImpl) equals: true. self assert: (manager homeServices deployedComponents at: MolCompleteComponentImpl) isEmpty. - self assert: manager homeServices waitingForActivation isEmpty. + self assert: manager homeServices waitingForActivation isEmpty ] { #category : #tests } MolHomeServicesTest >> testRemoveComponent [ "Test Component release on a remove" + | manager component | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl. + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + component := manager homeServices instantiateComponent: + MolCompleteComponentImpl. manager homeServices activateComponent: MolCompleteComponentImpl. manager homeServices passivateComponent: MolCompleteComponentImpl. manager homeServices removeComponent: MolCompleteComponentImpl. "Check all components properties" self assert: component componentName isNil. - self assert: component componentConnector isNil. - self assert: component eventsNotifiers equals: MolComponentConnector defaultEventsNotifiers. - self assert: component eventsSubscribers equals: MolComponentConnector defaultEventsSubscribers. - self assert: component parametersProviders equals: MolComponentConnector defaultParametersProviders. - self assert: component servicesProviders equals: MolComponentConnector defaultServicesProviders. + self assert: component componentConnector isNil. + self + assert: component eventsNotifiers + equals: MolComponentConnector defaultEventsNotifiers. + self + assert: component eventsSubscribers + equals: MolComponentConnector defaultEventsSubscribers. + self + assert: component parametersProviders + equals: MolComponentConnector defaultParametersProviders. + self + assert: component servicesProviders + equals: MolComponentConnector defaultServicesProviders ] { #category : #tests } MolHomeServicesTest >> testRemoveComponentNamed [ "Test Component release on a remove" + | manager component | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - component := manager homeServices instanciateComponent: MolCompleteComponentImpl named: #testComponent. - manager homeServices activateComponent: MolCompleteComponentImpl named: #testComponent. - manager homeServices passivateComponent: MolCompleteComponentImpl named: #testComponent. - manager homeServices removeComponent: MolCompleteComponentImpl named: #testComponent. + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + component := manager homeServices + instantiateComponent: MolCompleteComponentImpl + named: #testComponent. + manager homeServices + activateComponent: MolCompleteComponentImpl + named: #testComponent. + manager homeServices + passivateComponent: MolCompleteComponentImpl + named: #testComponent. + manager homeServices + removeComponent: MolCompleteComponentImpl + named: #testComponent. "Check all components properties" self assert: component componentName isNil. - self assert: component componentConnector isNil. - self assert: component eventsNotifiers equals: MolComponentConnector defaultEventsNotifiers. - self assert: component eventsSubscribers equals: MolComponentConnector defaultEventsSubscribers. - self assert: component parametersProviders equals: MolComponentConnector defaultParametersProviders. - self assert: component servicesProviders equals: MolComponentConnector defaultServicesProviders. + self assert: component componentConnector isNil. + self + assert: component eventsNotifiers + equals: MolComponentConnector defaultEventsNotifiers. + self + assert: component eventsSubscribers + equals: MolComponentConnector defaultEventsSubscribers. + self + assert: component parametersProviders + equals: MolComponentConnector defaultParametersProviders. + self + assert: component servicesProviders + equals: MolComponentConnector defaultServicesProviders ] { #category : #tests } MolHomeServicesTest >> testSeveralComponentsLifecycle [ "Test life cycle of several components" - | manager | + | manager | manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. "Test method instanciateAllComponents" - manager homeServices instanciateAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolCompleteComponentImpl). + manager homeServices instantiateAllComponents. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: + MolCompleteComponentImpl). "Test method activateAllComponents" manager homeServices activateAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl) not. - self assert: (manager homeServices isWaitingForActivation: MolCompleteComponentImpl) not. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl) + not. + self assert: + (manager homeServices isWaitingForActivation: + MolCompleteComponentImpl) not. "Test method passivateAllComponents" manager homeServices passivateAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolCompleteComponentImpl). - + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: + MolCompleteComponentImpl). + "Test method removeAllComponents" manager homeServices removeAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) not. - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl) not. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl) not. - self assert: (manager homeServices isWaitingForActivation: MolCompleteComponentImpl) not. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) not. + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl) not. + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl) + not. + self assert: + (manager homeServices isWaitingForActivation: + MolCompleteComponentImpl) not ] { #category : #tests } MolHomeServicesTest >> testSeveralComponentsLifecycleWithName [ -"Test life cycle of several components with names" + "Test life cycle of several components with names" + | manager | - manager := MolComponentManager default. - - "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl2. - manager homeServices instanciateComponent: MolBasicComponentImpl named: #component1. - manager homeServices instanciateComponent: MolBasicComponentImpl. - manager homeServices instanciateComponent: MolBasicComponentImpl2 named: #component2. + "Deployment" + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl2. + + manager homeServices + instantiateComponent: MolBasicComponentImpl + named: #component1. + manager homeServices instantiateComponent: MolBasicComponentImpl. + manager homeServices + instantiateComponent: MolBasicComponentImpl2 + named: #component2. "Test method activateAllComponents" manager homeServices activateAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #component1). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl2 named: #component2). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #component1) not. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl) not. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl2 named: #component2) not. - + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #component1). + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl2 + named: #component2). + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #component1) not. + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl) + not. + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl2 + named: #component2) not. + "Test method passivateAllComponents" manager homeServices passivateAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #component1). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl2 named: #component2). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #component1). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl2 named: #component2). - + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #component1). + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl2 + named: #component2). + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #component1). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl). + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl2 + named: #component2). + manager homeServices removeAllComponents. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #component1) not. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) not. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl2 named: #component2) not. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #component1) not. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) not. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl2 + named: #component2) not ] { #category : #'test - errors' } MolHomeServicesTest >> testStartAndStopComponentsAlreadyExists [ "Test exception appear" - | manager error | + | manager error | error := nil. manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. - - manager homeServices instanciateComponent: MolBasicComponentImpl. - [manager homeServices instanciateComponent: MolBasicComponentImpl] on: Error do:[ :e | - error := e. - ]. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. + + manager homeServices instantiateComponent: MolBasicComponentImpl. + [ manager homeServices instantiateComponent: MolBasicComponentImpl ] + on: Error + do: [ :e | error := e ]. self assert: (error isKindOf: ComponentAlreadyExistsError). - + manager homeServices activateComponent: MolBasicComponentImpl. - [manager homeServices activateComponent: MolBasicComponentImpl] on: Error do:[ :e | - error := e. - ]. + [ manager homeServices activateComponent: MolBasicComponentImpl ] + on: Error + do: [ :e | error := e ]. self assert: (error isKindOf: ComponentAlreadyActivatedError). - + manager homeServices passivateComponent: MolBasicComponentImpl. - [manager homeServices passivateComponent: MolBasicComponentImpl] on: Error do:[ :e | - error := e. - ]. + [ manager homeServices passivateComponent: MolBasicComponentImpl ] + on: Error + do: [ :e | error := e ]. self assert: (error isKindOf: ComponentAlreadyPassivatedError). - + error := nil. manager homeServices removeComponent: MolBasicComponentImpl. - [manager homeServices removeComponent: MolBasicComponentImpl] on: Error do:[ :e | - error := e. - ]. - self assert: (error isKindOf: ComponentNotFoundError). + [ manager homeServices removeComponent: MolBasicComponentImpl ] + on: Error + do: [ :e | error := e ]. + self assert: (error isKindOf: ComponentNotFoundError) ] { #category : #'test - errors' } @@ -448,151 +571,212 @@ MolHomeServicesTest >> testStartAndStopComponentsNoExist [ { #category : #'test - errors' } MolHomeServicesTest >> testStartNotDeployedComponent [ "Test exception appear" - | manager error | + | manager error | error := nil. manager := MolComponentManager default. - + error := nil. - [manager homeServices instanciateComponent: MolBasicComponentImpl] on: Error do:[ :e | - error := e. - ]. + [ manager homeServices instantiateComponent: MolBasicComponentImpl ] + on: Error + do: [ :e | error := e ]. - self assert: (error isKindOf: ComponentNotDeployedError). + self assert: (error isKindOf: ComponentNotDeployedError) ] { #category : #tests } MolHomeServicesTest >> testSubComponentLifecycle [ -"test life cycle of a component using AbstractComponentImpl as super class" + "test life cycle of a component using AbstractComponentImpl as super class" + | manager component | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. self assert: manager homeServices deployedComponents notEmpty. - + "Instanciation" - component := manager homeServices instanciateComponent: MolBasicComponentImpl. + component := manager homeServices instantiateComponent: + MolBasicComponentImpl. self assert: component class equals: MolBasicComponentImpl. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl). - + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl). + "Activation" manager homeServices activateComponent: MolBasicComponentImpl. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl) not. - + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl) + not. + "Passivation" manager homeServices passivateComponent: MolBasicComponentImpl. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl). - + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl). + "Deletion" manager homeServices removeComponent: MolBasicComponentImpl. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) not. - + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) not. + "Undeployment" - manager deploymentServices undeployComponentImplementation: MolBasicComponentImpl. - self assert: manager homeServices deployedComponents isEmpty. + manager deploymentServices undeployComponentImplementation: + MolBasicComponentImpl. + self assert: manager homeServices deployedComponents isEmpty ] { #category : #tests } MolHomeServicesTest >> testSubComponentLifecycleWithName [ -"test life cycle of a component using AbstractComponentImpl as super class with a name" + "test life cycle of a component using AbstractComponentImpl as super class with a name" + | manager | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. self assert: manager homeServices deployedComponents notEmpty. - + "Instanciation" - manager homeServices instanciateComponent: MolBasicComponentImpl named: #myComp. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComp). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComp). - + manager homeServices + instantiateComponent: MolBasicComponentImpl + named: #myComp. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComp). + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComp). + "Activation" - manager homeServices activateComponent: MolBasicComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComp) not. - + manager homeServices + activateComponent: MolBasicComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComp) not. + "Passivation" - manager homeServices passivateComponent: MolBasicComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComp). - + manager homeServices + passivateComponent: MolBasicComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComp). + "Deletion" - manager homeServices removeComponent: MolBasicComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComp) not. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComp) not. - + manager homeServices + removeComponent: MolBasicComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComp) not. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComp) not. + "Undeployment" - manager deploymentServices undeployComponentImplementation: MolBasicComponentImpl. - self assert: manager homeServices deployedComponents isEmpty. + manager deploymentServices undeployComponentImplementation: + MolBasicComponentImpl. + self assert: manager homeServices deployedComponents isEmpty ] { #category : #tests } MolHomeServicesTest >> testTraitComponentLifecycle [ -"test life cycle of a component using ComponentImpl trait" + "test life cycle of a component using ComponentImpl trait" + | manager | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicTraitComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicTraitComponentImpl. self assert: manager homeServices deployedComponents notEmpty. - + "Instanciation" - manager homeServices instanciateComponent: MolBasicTraitComponentImpl. - self assert: (MolUtils isInstanciateComponentOf: MolBasicTraitComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl). - + manager homeServices instantiateComponent: MolBasicTraitComponentImpl. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicTraitComponentImpl). + self assert: (manager homeServices isWaitingForActivation: + MolBasicTraitComponentImpl). + "Activation" manager homeServices activateComponent: MolBasicTraitComponentImpl. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl) not. - + self assert: (manager homeServices isWaitingForActivation: + MolBasicTraitComponentImpl) not. + "Passivation" manager homeServices passivateComponent: MolBasicTraitComponentImpl. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl). - + self assert: (manager homeServices isWaitingForActivation: + MolBasicTraitComponentImpl). + "Deletion" manager homeServices removeComponent: MolBasicTraitComponentImpl. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl) not. - self assert: (MolUtils isInstanciateComponentOf: MolBasicTraitComponentImpl) not. - + self assert: (manager homeServices isWaitingForActivation: + MolBasicTraitComponentImpl) not. + self assert: + (MolUtils isInstantiateComponentOf: MolBasicTraitComponentImpl) not. + "Undeployment" - manager deploymentServices undeployComponentImplementation: MolBasicTraitComponentImpl. - self assert: manager homeServices deployedComponents isEmpty. + manager deploymentServices undeployComponentImplementation: + MolBasicTraitComponentImpl. + self assert: manager homeServices deployedComponents isEmpty ] { #category : #tests } MolHomeServicesTest >> testTraitComponentLifecycleWithName [ -"test life cycle of a component using ComponentImpl trait with a name" + "test life cycle of a component using ComponentImpl trait with a name" + | manager | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolBasicTraitComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicTraitComponentImpl. self assert: manager homeServices deployedComponents notEmpty. - + "Instanciation" - manager homeServices instanciateComponent: MolBasicTraitComponentImpl named: #myComp. - self assert: (MolUtils isInstanciateComponentOf: MolBasicTraitComponentImpl named: #myComp). - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl named: #myComp). - + manager homeServices + instantiateComponent: MolBasicTraitComponentImpl + named: #myComp. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicTraitComponentImpl + named: #myComp). + self assert: (manager homeServices + isWaitingForActivation: MolBasicTraitComponentImpl + named: #myComp). + "Activation" - manager homeServices activateComponent: MolBasicTraitComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl named: #myComp) not. - + manager homeServices + activateComponent: MolBasicTraitComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicTraitComponentImpl + named: #myComp) not. + "Passivation" - manager homeServices passivateComponent: MolBasicTraitComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl named: #myComp). - + manager homeServices + passivateComponent: MolBasicTraitComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicTraitComponentImpl + named: #myComp). + "Deletion" - manager homeServices removeComponent: MolBasicTraitComponentImpl named: #myComp. - self assert: (manager homeServices isWaitingForActivation: MolBasicTraitComponentImpl named: #myComp) not. - self assert: (MolUtils isInstanciateComponentOf: MolBasicTraitComponentImpl named: #myComp) not. - + manager homeServices + removeComponent: MolBasicTraitComponentImpl + named: #myComp. + self assert: (manager homeServices + isWaitingForActivation: MolBasicTraitComponentImpl + named: #myComp) not. + self assert: (MolUtils + isInstantiateComponentOf: MolBasicTraitComponentImpl + named: #myComp) not. + "Undeployment" - manager deploymentServices undeployComponentImplementation: MolBasicTraitComponentImpl. - self assert: manager homeServices deployedComponents isEmpty. + manager deploymentServices undeployComponentImplementation: + MolBasicTraitComponentImpl. + self assert: manager homeServices deployedComponents isEmpty ] diff --git a/src/Molecule-Tests/MolInheritanceTests.class.st b/src/Molecule-Tests/MolInheritanceTests.class.st index 25af48ab..3d9e8013 100644 --- a/src/Molecule-Tests/MolInheritanceTests.class.st +++ b/src/Molecule-Tests/MolInheritanceTests.class.st @@ -9,25 +9,25 @@ Class { } { #category : #running } -MolInheritanceTests >> setUp [ +MolInheritanceTests >> setUp [ + | manager | MolComponentManager cleanUp. manager := MolComponentManager default. - + "Deploy components" manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. manager deploymentServices deployComponentImplementation: MolCompleteComponentChildImpl. - + "Instanciate componenets" - motherComponent := manager homeServices instanciateComponent: MolCompleteComponentImpl. - childComponent := manager homeServices instanciateComponent: MolCompleteComponentChildImpl named: #compB. - + motherComponent := manager homeServices instantiateComponent: MolCompleteComponentImpl. + childComponent := manager homeServices instantiateComponent: MolCompleteComponentChildImpl named: #compB. + motherComponent forServices: MolUsedServices useProvider: #compB. - - "Activate components" - manager homeServices activateComponent: MolCompleteComponentImpl. - manager homeServices activateComponent: MolCompleteComponentChildImpl named: #compB. + "Activate components" + manager homeServices activateComponent: MolCompleteComponentImpl. + manager homeServices activateComponent: MolCompleteComponentChildImpl named: #compB ] { #category : #running } diff --git a/src/Molecule-Tests/MolLocatorServicesTest.class.st b/src/Molecule-Tests/MolLocatorServicesTest.class.st index b5da4442..a69a4260 100644 --- a/src/Molecule-Tests/MolLocatorServicesTest.class.st +++ b/src/Molecule-Tests/MolLocatorServicesTest.class.st @@ -75,32 +75,42 @@ MolLocatorServicesTest >> testNotReadySearchEventSubscriberFor [ { #category : #test } MolLocatorServicesTest >> testSearchComponentTypeImplementorFor [ + | manager component myComponent | manager := MolComponentManager default. - component := manager locatorServices searchComponentTypeImplementorFor: MolCompleteComponent. + component := manager locatorServices + searchComponentTypeImplementorFor: MolCompleteComponent. self assert: component isNil. - - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - myComponent := manager homeServices instanciateComponent: MolCompleteComponentImpl. - component := manager locatorServices searchComponentTypeImplementorFor: MolCompleteComponent. - + + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + myComponent := manager homeServices instantiateComponent: + MolCompleteComponentImpl. + component := manager locatorServices + searchComponentTypeImplementorFor: MolCompleteComponent. + self assert: component notNil. - self assert: component identicalTo: myComponent. + self assert: component identicalTo: myComponent ] { #category : #test } MolLocatorServicesTest >> testSearchComponentTypeImplementorForNamed [ + | manager component myComponent | manager := MolComponentManager default. - component := manager locatorServices searchComponentTypeImplementorFor: MolCompleteComponent. + component := manager locatorServices + searchComponentTypeImplementorFor: MolCompleteComponent. self assert: component isNil. - - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - myComponent := manager homeServices instanciateComponent: MolCompleteComponentImpl. - component := manager locatorServices searchComponentTypeImplementorFor: MolCompleteComponent. - + + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + myComponent := manager homeServices instantiateComponent: + MolCompleteComponentImpl. + component := manager locatorServices + searchComponentTypeImplementorFor: MolCompleteComponent. + self assert: component notNil. - self assert: component identicalTo: myComponent. + self assert: component identicalTo: myComponent ] { #category : #tests } @@ -133,52 +143,60 @@ MolLocatorServicesTest >> testSearchEventsSubscriberForNamed [ { #category : #tests } MolLocatorServicesTest >> testSearchParametersProviderFor [ + | manager parametersProvider | - manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - manager homeServices instanciateComponent: MolCompleteComponentImpl. - parametersProvider := manager locatorServices searchParametersProviderFor: MolUsedParameters. - + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. + parametersProvider := manager locatorServices + searchParametersProviderFor: MolUsedParameters. + self assert: parametersProvider isNotFoundParameters not. - self assert: (parametersProvider isKindOf: MolCompleteComponentImpl). + self assert: (parametersProvider isKindOf: MolCompleteComponentImpl) ] { #category : #tests } MolLocatorServicesTest >> testSearchParametersProviderForNamed [ + | manager parametersProvider | - manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - manager homeServices instanciateComponent: MolCompleteComponentImpl. - parametersProvider := manager locatorServices searchParametersProviderFor: MolUsedParameters. - + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. + parametersProvider := manager locatorServices + searchParametersProviderFor: MolUsedParameters. + self assert: parametersProvider isNotFoundParameters not. - self assert: (parametersProvider isKindOf: MolCompleteComponentImpl). + self assert: (parametersProvider isKindOf: MolCompleteComponentImpl) ] { #category : #tests } MolLocatorServicesTest >> testSearchServicesProviderFor [ - | manager servicesProvider | + | manager servicesProvider | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - manager homeServices instanciateComponent: MolCompleteComponentImpl. - servicesProvider := manager locatorServices searchServicesProviderFor: MolUsedServices. - + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. + servicesProvider := manager locatorServices + searchServicesProviderFor: MolUsedServices. + self assert: servicesProvider isNotFoundServices not. - self assert: (servicesProvider isKindOf: MolCompleteComponentImpl). + self assert: (servicesProvider isKindOf: MolCompleteComponentImpl) ] { #category : #tests } MolLocatorServicesTest >> testSearchServicesProviderForNamed [ - | manager servicesProvider | + | manager servicesProvider | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. - manager homeServices instanciateComponent: MolCompleteComponentImpl. - servicesProvider := manager locatorServices searchServicesProviderFor: MolUsedServices. - + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. + manager homeServices instantiateComponent: MolCompleteComponentImpl. + servicesProvider := manager locatorServices + searchServicesProviderFor: MolUsedServices. + self assert: servicesProvider isNotFoundServices not. - self assert: (servicesProvider isKindOf: MolCompleteComponentImpl). + self assert: (servicesProvider isKindOf: MolCompleteComponentImpl) ] diff --git a/src/Molecule-Tests/MolParametersTest.class.st b/src/Molecule-Tests/MolParametersTest.class.st index fd3fcec3..e7b1df29 100644 --- a/src/Molecule-Tests/MolParametersTest.class.st +++ b/src/Molecule-Tests/MolParametersTest.class.st @@ -22,58 +22,75 @@ MolParametersTest >> tearDown [ { #category : #tests } MolParametersTest >> testClientSetParameters [ + | manager socket client | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMySocketComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyClientComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMySocketComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyClientComponentImpl. + "Instanciation" - socket := manager homeServices instanciateComponent: MolMySocketComponentImpl. - client := manager homeServices instanciateComponent: MolMyClientComponentImpl. - + socket := manager homeServices instantiateComponent: + MolMySocketComponentImpl. + client := manager homeServices instantiateComponent: + MolMyClientComponentImpl. + "Activation" manager homeServices activateComponent: MolMySocketComponentImpl. manager homeServices activateComponent: MolMyClientComponentImpl. - + "Tests" self assert: client getMolMySocketParametersProvider equals: socket. client setIp: '127.0.0.1'. client setPort: 1234. client setProtocol: #tcp. client connect. - client send: 'ping'. - + client send: 'ping' ] { #category : #tests } MolParametersTest >> testClientSetParametersFromSeveralClient [ - | manager socket client1 client2 | + | manager socket client1 client2 | manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMySocketComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyClientComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMySocketComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyClientComponentImpl. + "Instanciation" - socket := manager homeServices instanciateComponent: MolMySocketComponentImpl named: #socket. - client1 := manager homeServices instanciateComponent: MolMyClientComponentImpl named: #client1. - client2 := manager homeServices instanciateComponent: MolMyClientComponentImpl named: #client2. - + socket := manager homeServices + instantiateComponent: MolMySocketComponentImpl + named: #socket. + client1 := manager homeServices + instantiateComponent: MolMyClientComponentImpl + named: #client1. + client2 := manager homeServices + instantiateComponent: MolMyClientComponentImpl + named: #client2. + "Subscription : it should be done in SCMMyClientComponentImpl > componentInitialize" client1 forParameters: MolMySocketParameters useProvider: #socket. client2 forParameters: MolMySocketParameters useProvider: #socket. client1 forServices: MolMySocketServices useProvider: #socket. client2 forServices: MolMySocketServices useProvider: #socket. - + "Activation" - manager homeServices activateComponent: MolMySocketComponentImpl named: #socket. - manager homeServices activateComponent: MolMyClientComponentImpl named: #client1. - manager homeServices activateComponent: MolMyClientComponentImpl named: #client2. - + manager homeServices + activateComponent: MolMySocketComponentImpl + named: #socket. + manager homeServices + activateComponent: MolMyClientComponentImpl + named: #client1. + manager homeServices + activateComponent: MolMyClientComponentImpl + named: #client2. + "Tests" self assert: client1 getMolMySocketParametersProvider equals: socket. self assert: client2 getMolMySocketParametersProvider equals: socket. @@ -83,36 +100,46 @@ MolParametersTest >> testClientSetParametersFromSeveralClient [ client1 connect. client1 disconnect. client2 setIp: '10.0.0.2'. - client2 connect. + client2 connect ] { #category : #tests } MolParametersTest >> testClientSetParametersNamed [ + | manager socket client | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMySocketComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyClientComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMySocketComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyClientComponentImpl. + "Instanciation" - socket := manager homeServices instanciateComponent: MolMySocketComponentImpl named: #socket. - client := manager homeServices instanciateComponent: MolMyClientComponentImpl named: #client. - + socket := manager homeServices + instantiateComponent: MolMySocketComponentImpl + named: #socket. + client := manager homeServices + instantiateComponent: MolMyClientComponentImpl + named: #client. + "Subscription : it should be done in SCMMyClientComponentImpl > componentInitialize" client forParameters: MolMySocketParameters useProvider: #socket. client forServices: MolMySocketServices useProvider: #socket. - + "Activation" - manager homeServices activateComponent: MolMySocketComponentImpl named: #socket. - manager homeServices activateComponent: MolMyClientComponentImpl named: #client. - + manager homeServices + activateComponent: MolMySocketComponentImpl + named: #socket. + manager homeServices + activateComponent: MolMyClientComponentImpl + named: #client. + "Tests" self assert: client getMolMySocketParametersProvider equals: socket. client setIp: '127.0.0.1'. client setPort: 1234. client setProtocol: #tcp. client connect. - client send: 'ping'. + client send: 'ping' ] diff --git a/src/Molecule-Tests/MolServicesTest.class.st b/src/Molecule-Tests/MolServicesTest.class.st index 676e11c1..8f9e4fb4 100644 --- a/src/Molecule-Tests/MolServicesTest.class.st +++ b/src/Molecule-Tests/MolServicesTest.class.st @@ -22,136 +22,175 @@ MolServicesTest >> tearDown [ { #category : #tests } MolServicesTest >> testTableProvideServices [ + | manager table user | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMyTableComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyUserComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMyTableComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyUserComponentImpl. + "Instanciation" - table := manager homeServices instanciateComponent: MolMyTableComponentImpl. - user := manager homeServices instanciateComponent: MolMyUserComponentImpl. - + table := manager homeServices instantiateComponent: + MolMyTableComponentImpl. + user := manager homeServices instantiateComponent: + MolMyUserComponentImpl. + "Activation" manager homeServices activateComponent: MolMyTableComponentImpl. manager homeServices activateComponent: MolMyUserComponentImpl. - + "Tests" self assert: user getMolMyTableServicesProvider equals: table. - user getMolMyTableServicesProvider getContent. + user getMolMyTableServicesProvider getContent ] { #category : #tests } MolServicesTest >> testTableProvideServicesNamed [ + | manager table user | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMyTableComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyUserComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMyTableComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyUserComponentImpl. + "Instanciation" - table := manager homeServices instanciateComponent: MolMyTableComponentImpl named: #myTable. - user := manager homeServices instanciateComponent: MolMyUserComponentImpl named: #myUser. - + table := manager homeServices + instantiateComponent: MolMyTableComponentImpl + named: #myTable. + user := manager homeServices + instantiateComponent: MolMyUserComponentImpl + named: #myUser. + "Subscription : it should be done in SCMMyUserComponentImpl > componentInitialize" user forServices: MolMyTableServices useProvider: #myTable. - + "Activation" - manager homeServices activateComponent: MolMyTableComponentImpl named: #myTable. - manager homeServices activateComponent: MolMyUserComponentImpl named: #myUser. - + manager homeServices + activateComponent: MolMyTableComponentImpl + named: #myTable. + manager homeServices + activateComponent: MolMyUserComponentImpl + named: #myUser. + "Tests" - self assert: user getMolMyTableServicesProvider equals: table. + self assert: user getMolMyTableServicesProvider equals: table ] { #category : #tests } MolServicesTest >> testTableProvideServicesNotActivated [ + | manager table user | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMyTableComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyUserComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMyTableComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyUserComponentImpl. + "Instanciation" - table := manager homeServices instanciateComponent: MolMyTableComponentImpl. - user := manager homeServices instanciateComponent: MolMyUserComponentImpl. - + table := manager homeServices instantiateComponent: + MolMyTableComponentImpl. + user := manager homeServices instantiateComponent: + MolMyUserComponentImpl. + "Tests : service is provided when component is not activated" self assert: user getMolMyTableServicesProvider equals: table. user getMolMyTableServicesProvider getContent. - + manager homeServices activateComponent: MolMyTableComponentImpl. self assert: user getMolMyTableServicesProvider equals: table. user getMolMyTableServicesProvider getContent. - + manager homeServices passivateComponent: MolMyTableComponentImpl. self assert: user getMolMyTableServicesProvider equals: table. - user getMolMyTableServicesProvider getContent. + user getMolMyTableServicesProvider getContent ] { #category : #tests } MolServicesTest >> testTableProvideServicesNotActivatedNamed [ + | manager table user | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMyTableComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyUserComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMyTableComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyUserComponentImpl. + "Instanciation" - table := manager homeServices instanciateComponent: MolMyTableComponentImpl named: #myTable. - user := manager homeServices instanciateComponent: MolMyUserComponentImpl named: #myUser. - + table := manager homeServices + instantiateComponent: MolMyTableComponentImpl + named: #myTable. + user := manager homeServices + instantiateComponent: MolMyUserComponentImpl + named: #myUser. + "Subscription : it should be done in SCMMyUserComponentImpl > componentInitialize" user forServices: MolMyTableServices useProvider: #myTable. - + "Tests" self assert: user getMolMyTableServicesProvider equals: table. user getMolMyTableServicesProvider getContent. - - manager homeServices activateComponent: MolMyTableComponentImpl named: #myTable. + + manager homeServices + activateComponent: MolMyTableComponentImpl + named: #myTable. self assert: user getMolMyTableServicesProvider equals: table. user getMolMyTableServicesProvider getContent. - - manager homeServices passivateComponent: MolMyTableComponentImpl named: #myTable. + + manager homeServices + passivateComponent: MolMyTableComponentImpl + named: #myTable. self assert: user getMolMyTableServicesProvider equals: table. - user getMolMyTableServicesProvider getContent. + user getMolMyTableServicesProvider getContent ] { #category : #tests } MolServicesTest >> testTableProvideServicesToSeveralUsers [ + | manager table user1 user2 | - manager := MolComponentManager default. - + "Deployment" - manager deploymentServices deployComponentImplementation: MolMyTableComponentImpl. - manager deploymentServices deployComponentImplementation: MolMyUserComponentImpl. - + manager deploymentServices deployComponentImplementation: + MolMyTableComponentImpl. + manager deploymentServices deployComponentImplementation: + MolMyUserComponentImpl. + "Instanciation" - table := manager homeServices instanciateComponent: MolMyTableComponentImpl. - user1 := manager homeServices instanciateComponent: MolMyUserComponentImpl named: #user1. - user2 := manager homeServices instanciateComponent: MolMyUserComponentImpl named: #user2. - + table := manager homeServices instantiateComponent: + MolMyTableComponentImpl. + user1 := manager homeServices + instantiateComponent: MolMyUserComponentImpl + named: #user1. + user2 := manager homeServices + instantiateComponent: MolMyUserComponentImpl + named: #user2. + "Auto subscriptions, because of using default component name" - + "Activation" manager homeServices activateComponent: MolMyTableComponentImpl. - manager homeServices activateComponent: MolMyUserComponentImpl named: #user1. - + manager homeServices + activateComponent: MolMyUserComponentImpl + named: #user1. + "Tests" self assert: user1 getMolMyTableServicesProvider equals: table. user1 getMolMyTableServicesProvider getContent. - - manager homeServices activateComponent: MolMyUserComponentImpl named: #user2. + + manager homeServices + activateComponent: MolMyUserComponentImpl + named: #user2. self assert: user2 getMolMyTableServicesProvider equals: table. self assert: user1 getMolMyTableServicesProvider equals: table. - user2 getMolMyTableServicesProvider getContent. + user2 getMolMyTableServicesProvider getContent ] diff --git a/src/Molecule-Tests/MolTestComponentTreeLevel0Impl.class.st b/src/Molecule-Tests/MolTestComponentTreeLevel0Impl.class.st index 034600c7..c1bdf263 100644 --- a/src/Molecule-Tests/MolTestComponentTreeLevel0Impl.class.st +++ b/src/Molecule-Tests/MolTestComponentTreeLevel0Impl.class.st @@ -18,14 +18,21 @@ MolTestComponentTreeLevel0Impl >> componentActivate [ ] { #category : #'component life cycle' } -MolTestComponentTreeLevel0Impl >> componentInitialize [ +MolTestComponentTreeLevel0Impl >> componentInitialize [ - MolComponentManager default deploymentServices deployComponentImplementation: MolTestComponentTreeLevel1Impl. + MolComponentManager default deploymentServices + deployComponentImplementation: MolTestComponentTreeLevel1Impl. "start three others components to make a tree" - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel1Impl named: #level1element1. - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel1Impl named: #level1element2. - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel1Impl named: #level1element3. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel1Impl + named: #level1element1. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel1Impl + named: #level1element2. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel1Impl + named: #level1element3 ] { #category : #'component life cycle' } diff --git a/src/Molecule-Tests/MolTestComponentTreeLevel1Impl.class.st b/src/Molecule-Tests/MolTestComponentTreeLevel1Impl.class.st index 2c4ccba2..8ceaa614 100644 --- a/src/Molecule-Tests/MolTestComponentTreeLevel1Impl.class.st +++ b/src/Molecule-Tests/MolTestComponentTreeLevel1Impl.class.st @@ -15,14 +15,21 @@ MolTestComponentTreeLevel1Impl >> componentActivate [ ] { #category : #'component life cycle' } -MolTestComponentTreeLevel1Impl >> componentInitialize [ +MolTestComponentTreeLevel1Impl >> componentInitialize [ - MolComponentManager default deploymentServices deployComponentImplementation: MolTestComponentTreeLevel2Impl. + MolComponentManager default deploymentServices + deployComponentImplementation: MolTestComponentTreeLevel2Impl. "start three others components to make a tree" - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel2Impl named: (self componentName, #level2element1) asSymbol. - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel2Impl named: (self componentName, #level2element2) asSymbol. - MolComponentManager default homeServices instanciateComponent: MolTestComponentTreeLevel2Impl named: (self componentName, #level2element3) asSymbol. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel2Impl + named: (self componentName , #level2element1) asSymbol. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel2Impl + named: (self componentName , #level2element2) asSymbol. + MolComponentManager default homeServices + instantiateComponent: MolTestComponentTreeLevel2Impl + named: (self componentName , #level2element3) asSymbol ] { #category : #'component life cycle' } diff --git a/src/Molecule-Tests/MolUtilsTest.class.st b/src/Molecule-Tests/MolUtilsTest.class.st index c0b21941..0cee9db5 100644 --- a/src/Molecule-Tests/MolUtilsTest.class.st +++ b/src/Molecule-Tests/MolUtilsTest.class.st @@ -23,15 +23,23 @@ MolUtilsTest >> tearDown [ MolUtilsTest >> testActivateComponentNamed [ | homeServices deploymentServices | - - MolUtils deployAndInitializeComponent: MolBasicComponentImpl named: #myComponent. + MolUtils + deployAndInitializeComponent: MolBasicComponentImpl + named: #myComponent. MolUtils activateComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: false. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent). + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: false ] { #category : #tests } @@ -98,61 +106,88 @@ MolUtilsTest >> testConsumedComponentEvents [ { #category : #tests } MolUtilsTest >> testCreateAllComponents [ -"MolUtils>createAllComponents instanciate and activate all deployed components" + "MolUtils>createAllComponents instanciate and activate all deployed components" | manager | manager := MolComponentManager default. - manager deploymentServices deployComponentImplementation: MolBasicComponentImpl. - manager deploymentServices deployComponentImplementation: MolCompleteComponentImpl. + manager deploymentServices deployComponentImplementation: + MolBasicComponentImpl. + manager deploymentServices deployComponentImplementation: + MolCompleteComponentImpl. MolUtils createAllComponents. - - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (manager homeServices isWaitingForActivation: MolBasicComponentImpl) not. - self assert: (manager homeServices isWaitingForActivation: MolCompleteComponentImpl) not. - + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self assert: + (manager homeServices isWaitingForActivation: MolBasicComponentImpl) + not. + self assert: + (manager homeServices isWaitingForActivation: + MolCompleteComponentImpl) not ] { #category : #tests } MolUtilsTest >> testDeployAndInitializeComponentNamed [ | homeServices deploymentServices | - MolUtils deployAndInitializeComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: true. + MolUtils + deployAndInitializeComponent: MolBasicComponentImpl + named: #myComponent. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent). + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: true ] { #category : #tests } MolUtilsTest >> testDeployAndInitializeComponents [ | homeServices deploymentServices componentList | - componentList := OrderedCollection with: MolBasicComponentImpl with: MolCompleteComponentImpl. + componentList := OrderedCollection + with: MolBasicComponentImpl + with: MolCompleteComponentImpl. MolUtils deployAndInitializeComponents: componentList. - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (deploymentServices isDeployedComponentImplementation: MolCompleteComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: true. - self assert: (homeServices isWaitingForActivation: MolCompleteComponentImpl) equals: true. + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: (deploymentServices isDeployedComponentImplementation: + MolCompleteComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: true. + self + assert: + (homeServices isWaitingForActivation: MolCompleteComponentImpl) + equals: true ] { #category : #tests } MolUtilsTest >> testInstanceKindOf [ -"Test method instanceKindOf: of Utils" + "Test method instanceKindOf: of Utils" | homeServices | - MolComponentManager default deploymentServices deployComponentImplementation: MolBasicSubComponentImpl. + MolComponentManager default deploymentServices + deployComponentImplementation: MolBasicSubComponentImpl. homeServices := MolComponentManager default homeServices. - homeServices instanciateComponent: MolBasicSubComponentImpl. - self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) notNil. + homeServices instantiateComponent: MolBasicSubComponentImpl. + self assert: (MolUtils instanceKindOf: MolBasicComponentImpl) notNil ] { #category : #tests } @@ -208,15 +243,25 @@ MolUtilsTest >> testLog2 [ MolUtilsTest >> testPassivateComponentNamed [ | homeServices deploymentServices | - MolUtils startComponent: MolBasicComponentImpl named: #myComponent. - MolUtils passivateComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent) equals: true. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: true. + MolUtils + passivateComponent: MolBasicComponentImpl + named: #myComponent. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self + assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent) + equals: true. + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: true ] { #category : #tests } @@ -293,30 +338,50 @@ MolUtilsTest >> testProvidedComponentServices [ MolUtilsTest >> testRemoveComponentNamed [ | homeServices deploymentServices | - MolUtils startComponent: MolBasicComponentImpl named: #myComponent. MolUtils removeComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent) equals: false. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: false. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self + assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent) + equals: false. + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: false ] { #category : #tests } MolUtilsTest >> testRemoveComponents [ | homeServices componentList | - componentList := OrderedCollection with: MolBasicComponentImpl with: MolCompleteComponentImpl. + componentList := OrderedCollection + with: MolBasicComponentImpl + with: MolCompleteComponentImpl. MolUtils startComponents: componentList. MolUtils removeComponents: componentList. - homeServices := MolComponentManager default homeServices. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) equals: false. - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl) equals: false. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: false. - self assert: (homeServices isWaitingForActivation: MolCompleteComponentImpl) equals: false. + homeServices := MolComponentManager default homeServices. + self + assert: (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) + equals: false. + self + assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl) + equals: false. + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: false. + self + assert: + (homeServices isWaitingForActivation: MolCompleteComponentImpl) + equals: false ] { #category : #tests } @@ -334,11 +399,15 @@ MolUtilsTest >> testStartComponent [ | homeServices deploymentServices | MolUtils startComponent: MolBasicComponentImpl. - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: false. + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: false ] { #category : #tests } @@ -346,29 +415,47 @@ MolUtilsTest >> testStartComponentNamed [ | homeServices deploymentServices | MolUtils startComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: false. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent). + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: false ] { #category : #tests } MolUtilsTest >> testStartComponents [ | homeServices deploymentServices componentList | - componentList := OrderedCollection with: MolBasicComponentImpl with: MolCompleteComponentImpl. + componentList := OrderedCollection + with: MolBasicComponentImpl + with: MolCompleteComponentImpl. MolUtils startComponents: componentList. - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl). - self assert: (deploymentServices isDeployedComponentImplementation: MolCompleteComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl). - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl). - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: false. - self assert: (homeServices isWaitingForActivation: MolCompleteComponentImpl) equals: false. + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl). + self assert: (deploymentServices isDeployedComponentImplementation: + MolCompleteComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolBasicComponentImpl). + self assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl). + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: false. + self + assert: + (homeServices isWaitingForActivation: MolCompleteComponentImpl) + equals: false ] { #category : #tests } @@ -376,13 +463,20 @@ MolUtilsTest >> testStopComponent [ | homeServices deploymentServices | MolUtils startComponent: MolBasicComponentImpl. - MolUtils stopComponent: MolBasicComponentImpl. + MolUtils stopComponent: MolBasicComponentImpl. - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl) equals: true. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) equals: false. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: false. + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self + assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl) + equals: true. + self + assert: (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) + equals: false. + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: false ] { #category : #tests } @@ -391,30 +485,61 @@ MolUtilsTest >> testStopComponentNamed [ | homeServices deploymentServices | MolUtils startComponent: MolBasicComponentImpl named: #myComponent. MolUtils stopComponent: MolBasicComponentImpl named: #myComponent. - - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl) equals: true. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl named: #myComponent) equals: false. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl named: #myComponent) equals: false. + + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self + assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl) + equals: true. + self + assert: (MolUtils + isInstantiateComponentOf: MolBasicComponentImpl + named: #myComponent) + equals: false. + self + assert: (homeServices + isWaitingForActivation: MolBasicComponentImpl + named: #myComponent) + equals: false ] { #category : #tests } MolUtilsTest >> testStopComponents [ | homeServices deploymentServices componentList | - MolUtils startComponent: MolBasicComponentImpl; startComponent: MolCompleteComponentImpl. - componentList := OrderedCollection with: MolBasicComponentImpl with: MolCompleteComponentImpl. - MolUtils stopComponents: componentList. + MolUtils + startComponent: MolBasicComponentImpl; + startComponent: MolCompleteComponentImpl. + componentList := OrderedCollection + with: MolBasicComponentImpl + with: MolCompleteComponentImpl. + MolUtils stopComponents: componentList. - homeServices := MolComponentManager default homeServices. - deploymentServices := MolComponentManager default deploymentServices. - self assert: (deploymentServices isDeployedComponentImplementation: MolBasicComponentImpl) equals: true. - self assert: (deploymentServices isDeployedComponentImplementation: MolCompleteComponentImpl) equals: true. - self assert: (MolUtils isInstanciateComponentOf: MolBasicComponentImpl) equals: false. - self assert: (MolUtils isInstanciateComponentOf: MolCompleteComponentImpl) equals: false. - self assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) equals: false. -self assert: (homeServices isWaitingForActivation: MolCompleteComponentImpl) equals: false. + homeServices := MolComponentManager default homeServices. + deploymentServices := MolComponentManager default deploymentServices. + self + assert: (deploymentServices isDeployedComponentImplementation: + MolBasicComponentImpl) + equals: true. + self + assert: (deploymentServices isDeployedComponentImplementation: + MolCompleteComponentImpl) + equals: true. + self + assert: (MolUtils isInstantiateComponentOf: MolBasicComponentImpl) + equals: false. + self + assert: + (MolUtils isInstantiateComponentOf: MolCompleteComponentImpl) + equals: false. + self + assert: (homeServices isWaitingForActivation: MolBasicComponentImpl) + equals: false. + self + assert: + (homeServices isWaitingForActivation: MolCompleteComponentImpl) + equals: false ] { #category : #tests }