Skip to content

Commit fe80525

Browse files
Merge pull request #34 from ba-st/33-Add-time-and-event-notification-modules
Added time and event notification modules
2 parents c597f02 + 792e235 commit fe80525

19 files changed

+242
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"
2+
An EventNotificationModuleTest is a test class for testing the behavior of EventNotificationModule
3+
"
4+
Class {
5+
#name : #EventNotificationModuleTest,
6+
#superclass : #SystemBasedUserStoryTest,
7+
#category : #'Kepler-Notifications-Tests'
8+
}
9+
10+
{ #category : #'private - accessing' }
11+
EventNotificationModuleTest >> installedModuleRegistrationSystem [
12+
13+
^ rootSystem >> #InstalledModuleRegistrationSystem
14+
]
15+
16+
{ #category : #'private - configuring' }
17+
EventNotificationModuleTest >> requireEventNotificationModule [
18+
19+
self requireInstallationOf: EventNotificationModule
20+
]
21+
22+
{ #category : #'private - running' }
23+
EventNotificationModuleTest >> setUpRequirements [
24+
25+
self requireEventNotificationModule
26+
]
27+
28+
{ #category : #tests }
29+
EventNotificationModuleTest >> testAccessing [
30+
31+
| eventNotificationModule |
32+
33+
eventNotificationModule := self installedModuleRegistrationSystem
34+
installedModuleRegisteringSystemImplementing: #EventNotificationSystemInterface.
35+
36+
self
37+
assert: eventNotificationModule name equals: 'Event notification';
38+
assert: eventNotificationModule systemInterfacesToInstall
39+
equals: #(#EventNotificationSystemInterface)
40+
]

source/Kepler-Notifications-Tests/EventNotificationSystemUserStoryTest.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Class {
77
#category : 'Kepler-Notifications-Tests'
88
}
99

10-
{ #category : #tests }
10+
{ #category : #accessing }
1111
EventNotificationSystemUserStoryTest >> eventNotificationSystem [
1212

1313
^ rootSystem >> #EventNotificationSystemInterface
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"
2+
I'm system module installing the event notification system
3+
"
4+
Class {
5+
#name : #EventNotificationModule,
6+
#superclass : #SystemModule,
7+
#instVars : [
8+
'rootSystem'
9+
],
10+
#category : #'Kepler-Notifications'
11+
}
12+
13+
{ #category : #'instance creation' }
14+
EventNotificationModule class >> toInstallOn: aCompositeSystem [
15+
16+
^ self new initializeToInstallOn: aCompositeSystem
17+
]
18+
19+
{ #category : #initialization }
20+
EventNotificationModule >> initializeToInstallOn: aCompositeSystem [
21+
22+
rootSystem := aCompositeSystem
23+
]
24+
25+
{ #category : #private }
26+
EventNotificationModule >> name [
27+
28+
^ 'Event notification'
29+
]
30+
31+
{ #category : #private }
32+
EventNotificationModule >> registerEventNotificationSystemForInstallationIn: systems [
33+
34+
^ self register: [ EventNotificationSystem new ] in: systems
35+
]
36+
37+
{ #category : #private }
38+
EventNotificationModule >> rootSystem [
39+
40+
^ rootSystem
41+
]
42+
43+
{ #category : #private }
44+
EventNotificationModule >> systemInterfacesToInstall [
45+
46+
^ #(#EventNotificationSystemInterface)
47+
]

source/Kepler-Notifications/EventNotificationSystem.class.st

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"
2+
I'm SubsystemImplementation.
3+
4+
I'm an event notification system and I manage subscriptions allowing to create or revoke them. Also, I receive events and notify their subscribers.
5+
"
16
Class {
27
#name : #EventNotificationSystem,
38
#superclass : #SubsystemImplementation,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
"
2+
I'm a notifiable event.
3+
4+
The event notification system notifies subscribers that you have received me.
5+
"
16
Class {
27
#name : #NotifiableEvent,
38
#superclass : #Object,
4-
#category : 'Kepler-Notifications'
9+
#category : #'Kepler-Notifications'
510
}

source/Kepler-Notifications/Subscription.class.st

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"
2+
I'm a Subscription.
3+
4+
I know what message to send to a subscriber each time the event notification system receives an event.
5+
"
16
Class {
27
#name : #Subscription,
38
#superclass : #Object,
@@ -6,7 +11,7 @@ Class {
611
'subscriber',
712
'message'
813
],
9-
#category : 'Kepler-Notifications'
14+
#category : #'Kepler-Notifications'
1015
}
1116

1217
{ #category : #'instance creation' }

source/Kepler-SUnit-Model/SystemBasedUserStoryTest.class.st

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"
2-
I'm a TestCase extension supporting System level tests.
2+
I'm a TestCase extension supporting system level tests.
3+
34
My subclasses need to implement setUpRequirements and install here the required modules or subsystems needed for the specific case.
45
"
56
Class {
@@ -17,12 +18,27 @@ SystemBasedUserStoryTest class >> isAbstract [
1718
^self name = #SystemBasedUserStoryTest
1819
]
1920

20-
{ #category : #'private - running' }
21+
{ #category : #'private - configuring' }
22+
SystemBasedUserStoryTest >> registerInstalledModuleRegistrationSystem [
23+
24+
rootSystem
25+
systemImplementing: #InstalledModuleRegistrationSystem
26+
ifNone: [ self registerSubsystem: InstalledModuleRegistrationSystem new ]
27+
]
28+
29+
{ #category : #'private - configuring' }
2130
SystemBasedUserStoryTest >> registerSubsystem: aSubsystem [
2231

2332
rootSystem register: aSubsystem
2433
]
2534

35+
{ #category : #'private - configuring' }
36+
SystemBasedUserStoryTest >> requireInstallationOf: aModuleFactory [
37+
38+
self registerInstalledModuleRegistrationSystem.
39+
(aModuleFactory toInstallOn: rootSystem) install
40+
]
41+
2642
{ #category : #running }
2743
SystemBasedUserStoryTest >> setUp [
2844

source/Kepler-System-Tests/SampleCustomerModule.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Class {
1313
{ #category : #'instance creation' }
1414
SampleCustomerModule class >> toInstallOn: aCompositeSystem [
1515

16-
^self new initializeToInstallOn: aCompositeSystem
16+
^ self new initializeToInstallOn: aCompositeSystem
1717
]
1818

1919
{ #category : #initialization }

source/Kepler-System-Tests/SampleProjectModule.class.st

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Class {
1313
{ #category : #'instance creation' }
1414
SampleProjectModule class >> toInstallOn: aCompositeSystem [
1515

16-
^self new initializeToInstallOn: aCompositeSystem
16+
^ self new initializeToInstallOn: aCompositeSystem
1717
]
1818

1919
{ #category : #initialization }
@@ -22,6 +22,12 @@ SampleProjectModule >> initializeToInstallOn: aCompositeSystem [
2222
rootSystem := aCompositeSystem
2323
]
2424

25+
{ #category : #private }
26+
SampleProjectModule >> name [
27+
28+
^ 'Project'
29+
]
30+
2531
{ #category : #private }
2632
SampleProjectModule >> registerProjectManagementSystemForInstallationIn: systems [
2733

source/Kepler-System/SystemCommandExecutionError.class.st

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"
2+
I'm an error raised when something goes wrong during a collaboration with a system
3+
"
14
Class {
25
#name : #SystemCommandExecutionError,
36
#superclass : #Error,

source/Kepler-System/SystemInstallation.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SystemInstallation >> install: aVersionName [
2727
rootSystem := CompositeSystem installedBy: self.
2828
self registerModuleRegistrationSystemOn: rootSystem.
2929
self modulesToInstall do: [ :module | (module toInstallOn: rootSystem) install ].
30-
^rootSystem
30+
^ rootSystem
3131
]
3232

3333
{ #category : #accessing }

source/Kepler-System/SystemModule.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ SystemModule >> printOn: aStream [
5858
{ #category : #private }
5959
SystemModule >> register: aSystemCreationBlock in: systems [
6060

61-
^systems add: aSystemCreationBlock value
61+
^ systems add: aSystemCreationBlock value
6262
]
6363

6464
{ #category : #actions }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"
2+
A TimeModuleTest is a test class for testing the behavior of TimeModule
3+
"
4+
Class {
5+
#name : #TimeModuleTest,
6+
#superclass : #SystemBasedUserStoryTest,
7+
#category : #'Kepler-Time-Tests'
8+
}
9+
10+
{ #category : #'private - accessing' }
11+
TimeModuleTest >> installedModuleRegistrationSystem [
12+
13+
^ rootSystem >> #InstalledModuleRegistrationSystem
14+
]
15+
16+
{ #category : #'private - configuring' }
17+
TimeModuleTest >> requireTimeModule [
18+
19+
self requireInstallationOf: TimeModule
20+
]
21+
22+
{ #category : #'private - running' }
23+
TimeModuleTest >> setUpRequirements [
24+
25+
self requireTimeModule
26+
]
27+
28+
{ #category : #tests }
29+
TimeModuleTest >> testAccessing [
30+
31+
| eventNotificationModule |
32+
33+
eventNotificationModule := self installedModuleRegistrationSystem
34+
installedModuleRegisteringSystemImplementing: #TimeSystemInterface.
35+
36+
self
37+
assert: eventNotificationModule name equals: 'Time';
38+
assert: eventNotificationModule systemInterfacesToInstall
39+
equals: #(#TimeSystemInterface)
40+
]

source/Kepler-Time/FixedTimeSource.class.st

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"
2-
I'm FixedTimeSource.
32
I'm a TimeSource.
43
54
I provide a fixed previously given date and time. I exist only for testing purposes.
@@ -11,7 +10,7 @@ Class {
1110
#instVars : [
1211
'dateTime'
1312
],
14-
#category : 'Kepler-Time'
13+
#category : #'Kepler-Time'
1514
}
1615

1716
{ #category : #'instance creation' }

source/Kepler-Time/ManifestKeplerTime.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ I store metadata for this package. These meta data are used by other tools such
44
Class {
55
#name : #ManifestKeplerTime,
66
#superclass : #PackageManifest,
7-
#category : #'Kepler-Time'
7+
#category : #'Kepler-Time-Manifest'
88
}
99

1010
{ #category : #'class initialization' }

source/Kepler-Time/SystemTimeSource.class.st

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
"
2+
I'm a TimeSource.
3+
4+
I provide the system's current date and time.
5+
6+
"
17
Class {
28
#name : #SystemTimeSource,
39
#superclass : #TimeSource,
4-
#category : 'Kepler-Time'
10+
#category : #'Kepler-Time'
511
}
612

713
{ #category : #accessing }
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"
2+
I'm SytemModule.
3+
4+
I'm a system module installing the time system.
5+
"
6+
Class {
7+
#name : #TimeModule,
8+
#superclass : #SystemModule,
9+
#instVars : [
10+
'rootSystem'
11+
],
12+
#category : #'Kepler-Time'
13+
}
14+
15+
{ #category : #'instance creation' }
16+
TimeModule class >> toInstallOn: aCompositeSystem [
17+
18+
^ self new initializeToInstallOn: aCompositeSystem
19+
]
20+
21+
{ #category : #initialization }
22+
TimeModule >> initializeToInstallOn: aCompositeSystem [
23+
24+
rootSystem := aCompositeSystem
25+
]
26+
27+
{ #category : #private }
28+
TimeModule >> name [
29+
30+
^ 'Time'
31+
]
32+
33+
{ #category : #private }
34+
TimeModule >> registerTimeSystemForInstallationIn: systems [
35+
36+
^ self register: [ TimeSystem using: SystemTimeSource new ] in: systems
37+
]
38+
39+
{ #category : #private }
40+
TimeModule >> rootSystem [
41+
42+
^ rootSystem
43+
]
44+
45+
{ #category : #private }
46+
TimeModule >> systemInterfacesToInstall [
47+
48+
^ #(#TimeSystemInterface)
49+
]

source/Kepler-Time/TimeSource.class.st

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
"
2+
I'm a TimeSource.
3+
4+
I provide a date and time.
5+
"
16
Class {
27
#name : #TimeSource,
38
#superclass : #Object,
4-
#category : 'Kepler-Time'
9+
#category : #'Kepler-Time'
510
}
611

712
{ #category : #accessing }

source/Kepler-Time/TimeSystem.class.st

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
"
2-
A TimeSystem is a system that provides time.
3-
4-
Instance Variables
5-
timeSource: <Object>
6-
7-
timeSource
8-
- xxxxx
2+
I'm a SubsystemImplementation.
93
4+
I'm a system that provides the date, the time of day or both.
105
"
116
Class {
127
#name : #TimeSystem,

0 commit comments

Comments
 (0)