Skip to content

Commit

Permalink
FIx #203 + tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
LabordePierre committed Jan 31, 2025
1 parent e63dc65 commit afe7298
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 36 deletions.
100 changes: 100 additions & 0 deletions src/Molecule-IDE-Tests/MolComponentToRoassalTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"
A MolComponentToRoassalTest is a test class for testing the behavior of MolComponentToRoassal
"
Class {
#name : #MolComponentToRoassalTest,
#superclass : #TestCase,
#category : #'Molecule-IDE-Tests-Cases'
}

{ #category : #running }
MolComponentToRoassalTest >> setUp [

super setUp.
MolComponentManager cleanUp
]

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

MolComponentManager cleanUp.
super tearDown
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllConsumedEventsAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllConsumedEventsAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllConsumedEventsAndTargetsFor: component.
self assert: list isEmpty.
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllProducedEventsAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllProducedEventsAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllProducedEventsAndTargetsFor: component.
self assert: list notEmpty.
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllProvidedParametersAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllProvidedParametersAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllProvidedParametersAndTargetsFor: component.
self assert: list notEmpty.
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllProvidedServicesAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllProvidedServicesAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllProvidedServicesAndTargetsFor: component.
self assert: list notEmpty.
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllUsedParametersAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllUsedParametersAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllUsedParametersAndTargetsFor: component.
self assert: list isEmpty.
]

{ #category : #tests }
MolComponentToRoassalTest >> testAssociationsAllUsedServicesAndTargetsFor [

| list component |
component := MolCompleteComponentImpl start.
list := MolComponentToRoassal associationsAllUsedServicesAndTargetsFor: component.
self assert: list notEmpty.

component := MolCompleteComponentImpl new.
list := MolComponentToRoassal associationsAllUsedServicesAndTargetsFor: component.
self assert: list isEmpty.
]
40 changes: 40 additions & 0 deletions src/Molecule-IDE-Tests/MolPharoIDETest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"
Tests on Pharo IDE features (i.e. inspector).
"
Class {
#name : #MolPharoIDETest,
#superclass : #TestCase,
#category : #'Molecule-IDE-Tests-Cases'
}

{ #category : #running }
MolPharoIDETest >> setUp [

super setUp.
MolComponentManager cleanUp
]

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

MolComponentManager cleanUp.
super tearDown
]

{ #category : #running }
MolPharoIDETest >> testInspectComponent [

| component inspector |
component := MolBasicComponentImpl start.
self flag:'pla: this test is manual, need to test if there is an error automatically'.
inspector := (Smalltalk tools inspector inspect: component).
]

{ #category : #running }
MolPharoIDETest >> testInspectComponentWithNew [

| component inspector |
component := MolBasicComponentImpl new.
self flag:'pla: this test is manual, need to test if there is an error automatically'.
inspector := (Smalltalk tools inspector inspect: component).
]
78 changes: 42 additions & 36 deletions src/Molecule-IDE/MolComponentToRoassal.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ Class {
{ #category : #model }
MolComponentToRoassal class >> associationsAllConsumedEventsAndTargetsFor: aMolComponent [

^ aMolComponent componentConnector eventsSubscribers associations
collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self eventColor;
rsLogo: self eventLogoIn;
yourself ]
^ aMolComponent componentConnector
ifNotNil: [ :e |
e eventsSubscribers associations collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self eventColor;
rsLogo: self eventLogoIn;
yourself ] ]
ifNil: [ OrderedCollection new ]
]

{ #category : #model }
Expand Down Expand Up @@ -67,29 +69,33 @@ MolComponentToRoassal class >> associationsAllProvidedServicesAndTargetsFor: aMo
{ #category : #model }
MolComponentToRoassal class >> associationsAllUsedParametersAndTargetsFor: aMolComponent [

^ aMolComponent componentConnector parametersProviders associations
collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self parameterColor;
rsLogo: self parameterLogoIn;
yourself ]
^ aMolComponent componentConnector
ifNotNil: [ :e |
e parametersProviders associations collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self parameterColor;
rsLogo: self parameterLogoIn;
yourself ] ]
ifNil: [ OrderedCollection new ]
]

{ #category : #model }
MolComponentToRoassal class >> associationsAllUsedServicesAndTargetsFor: aMolComponent [

^ aMolComponent componentConnector servicesProviders associations
collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self serviceColor;
rsLogo: self serviceLogoIn;
yourself ]
^ aMolComponent componentConnector
ifNotNil: [ :e |
e servicesProviders associations collect: [ :asso |
MolRSContractModelTarget new
eventClass: asso key;
name: asso value;
component: aMolComponent;
color: self serviceColor;
rsLogo: self serviceLogoIn;
yourself ] ]
ifNil: [ OrderedCollection new ]
]

{ #category : #'instance creation' }
Expand Down Expand Up @@ -325,7 +331,7 @@ MolComponentToRoassal class >> eventColor [
^ Color blue muchLighter
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> eventLogo [

| rsLogoIn rsLogoOut |
Expand All @@ -347,7 +353,7 @@ MolComponentToRoassal class >> eventLogo [
rsLogoOut }
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> eventLogoIn [

| rsLogo |
Expand All @@ -356,7 +362,7 @@ MolComponentToRoassal class >> eventLogoIn [
^ rsLogo
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> eventLogoOut [

| rsLogo |
Expand All @@ -371,7 +377,7 @@ MolComponentToRoassal class >> parameterColor [
^ Color red muchLighter
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> parameterLogo [

| rsLogoIn rsLogoOut |
Expand All @@ -398,7 +404,7 @@ MolComponentToRoassal class >> parameterLogo [
rsLogoOut }
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> parameterLogoIn [

| rsLogo |
Expand All @@ -409,7 +415,7 @@ MolComponentToRoassal class >> parameterLogoIn [
^ rsLogo
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> parameterLogoOut [

| rsLogo |
Expand All @@ -426,7 +432,7 @@ MolComponentToRoassal class >> serviceColor [
^ Color green muchLighter
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> serviceLogo [

| rsLogoIn rsLogoOut |
Expand Down Expand Up @@ -455,7 +461,7 @@ MolComponentToRoassal class >> serviceLogo [
rsLogoOut }
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> serviceLogoIn [

| rsLogo |
Expand All @@ -466,7 +472,7 @@ MolComponentToRoassal class >> serviceLogoIn [
^ rsLogo
]

{ #category : #'as yet unclassified' }
{ #category : #resources }
MolComponentToRoassal class >> serviceLogoOut [

| rsLogo |
Expand Down

0 comments on commit afe7298

Please sign in to comment.