Skip to content

Commit 2db40cf

Browse files
committed
Add stash and stuff + full example
1 parent 99c4784 commit 2db40cf

File tree

3 files changed

+162
-2
lines changed

3 files changed

+162
-2
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Class {
2+
#name : 'ExReqCapellaDocument',
3+
#superclass : 'ExReqAbstractSourceDocument',
4+
#instVars : [
5+
'name',
6+
'id'
7+
],
8+
#category : 'ExecutableRequirements-Toplo-Example',
9+
#package : 'ExecutableRequirements-Toplo-Example'
10+
}
11+
12+
{ #category : 'accessing' }
13+
ExReqCapellaDocument >> id [
14+
15+
^ id
16+
]
17+
18+
{ #category : 'accessing' }
19+
ExReqCapellaDocument >> id: anObject [
20+
21+
id := anObject
22+
]
23+
24+
{ #category : 'accessing' }
25+
ExReqCapellaDocument >> name [
26+
27+
^ name
28+
]
29+
30+
{ #category : 'accessing' }
31+
ExReqCapellaDocument >> name: anObject [
32+
33+
name := anObject
34+
]
35+
36+
{ #category : 'as yet unclassified' }
37+
ExReqCapellaDocument >> stashAccessors [
38+
39+
<stashAccessors>
40+
^ { #id . #name }
41+
]

src/ExecutableRequirements-Toplo-Example/ExReqToploLoginRequirements.class.st

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,108 @@ ExReqToploLoginRequirements >> capellaFile [
942942
'
943943
]
944944

945+
{ #category : 'requirement - generated' }
946+
ExReqToploLoginRequirements >> capella_requirement_1 [
947+
948+
<ExReqToploExample>
949+
^ ExReqRequirement new
950+
title:
951+
'Person send "preliminary informations" to Authentification app';
952+
description:
953+
'The component named "Person"[a74ca346-8ba1-430e-8ca9-06c48d702ac5] in the function "Proof of identity"[6e26d3cf-5684-4117-ac88-17f5fb63eb0e] transmit "preliminary informations"[ae5df6ac-07ff-4177-8a1d-7f73b386dea8] to the component named "Input Identity UI"[300a7f2b-c0d2-48cd-854b-d9a8fcbadc24] in the function "Authentification app"[d68548ae-78af-44d6-85de-b5e5229541b5]';
954+
sourceDocument: (ExReqCapellaDocument new
955+
id: 'ae5df6ac-07ff-4177-8a1d-7f73b386dea8';
956+
name: 'login_system';
957+
yourself);
958+
addVerification: [ :verif |
959+
verif
960+
addStepOnAST: (ExReqToploLoginWidget >> #loginAction) ast
961+
withPrecondition: [ :obj |
962+
obj usernameValue isNotEmpty and: obj passwordValue isNotEmpty ] ];
963+
yourself
964+
]
965+
966+
{ #category : 'requirement - generated' }
967+
ExReqToploLoginRequirements >> capella_requirement_2 [
968+
969+
<ExReqToploExample>
970+
^ ExReqRequirement new
971+
title: 'Authentification app send "an identity" to database';
972+
description:
973+
'The component named "Authentification app"[d68548ae-78af-44d6-85de-b5e5229541b5] in the function "Input Identity UI"[300a7f2b-c0d2-48cd-854b-d9a8fcbadc24] transmit "an identity"[eb51b009-ff4b-4825-9b77-a7509093bbcd] to the component named "Verify Identity in database"[95bc149e-bce3-42fe-8d8f-7a4f123dea05] in the function "database"[a29b6cea-941d-416a-b6c0-818e73a84368]';
974+
sourceDocument: (ExReqCapellaDocument new
975+
id: 'eb51b009-ff4b-4825-9b77-a7509093bbcd';
976+
name: 'login_system';
977+
yourself);
978+
addVerification: [ :verif |
979+
verif
980+
addStepOnAST: (ExReqToploLoginWidget >> #loginAction) ast.
981+
verif addStepOnAST: (ExReqToploLoginSimulation >> #authentificateUsername:password:) ast withPrecondition: [ :obj :args |
982+
args size = 2. ]
983+
];
984+
yourself
985+
]
986+
987+
{ #category : 'requirement - generated' }
988+
ExReqToploLoginRequirements >> capella_requirement_3 [
989+
990+
<ExReqToploExample>
991+
^ ExReqRequirement new
992+
title: 'database send "error" to Authentification app';
993+
description:
994+
'The component named "database"[a29b6cea-941d-416a-b6c0-818e73a84368] in the function "Verify Identity in database"[95bc149e-bce3-42fe-8d8f-7a4f123dea05] transmit "error"[141c2297-10ac-4e90-82c4-83fc9c7b3b14] to the component named "Input Identity UI"[300a7f2b-c0d2-48cd-854b-d9a8fcbadc24] in the function "Authentification app"[d68548ae-78af-44d6-85de-b5e5229541b5]';
995+
sourceDocument: (ExReqCapellaDocument new
996+
id: '141c2297-10ac-4e90-82c4-83fc9c7b3b14';
997+
name: 'login_system';
998+
yourself);
999+
addVerification: [ :verif |
1000+
verif
1001+
addStepOnAST: (ExReqToploLoginWidget >> #loginAction) ast withPrecondition: [ :obj | obj loginStatusContainer isVisible not ].
1002+
verif addStepOnAST: (ExReqToploLoginSimulation >> #authentificateUsername:password:) ast withPrecondition: [ :obj :args |
1003+
(obj perform: #authentificateUsername:password: withArguments: args) not. ].
1004+
verif addStepOnAST: (ExReqToploLoginWidget >> #loginAction) ast withPostcondition: [ :obj :args |
1005+
(obj loginStatusContainer isVisible). ]
1006+
];
1007+
yourself
1008+
]
1009+
9451010
{ #category : 'as yet unclassified' }
946-
ExReqToploLoginRequirements >> extractSimpleModel [
1011+
ExReqToploLoginRequirements >> compiledSourceCodeIntoRequirementMethods [
1012+
1013+
| pragma methodPrefix sourceCodes index methodString |
1014+
pragma := #ExReqToploExample2.
1015+
methodPrefix := 'new_capella_requirement_'.
1016+
index := 1.
1017+
sourceCodes := self transformRequirementsIntoSourceCode.
1018+
1019+
methodString := '<1s><2p><r><r><t>%<<3s>><r><r><t>^ <4s>'.
1020+
1021+
sourceCodes do: [ :source |
1022+
| fullMethod |
1023+
fullMethod := methodString expandMacrosWithArguments: {
1024+
methodPrefix.
1025+
index.
1026+
pragma.
1027+
source }.
1028+
index := index + 1.
1029+
self class compile: fullMethod classified: 'requirement - generated' ]
1030+
]
1031+
1032+
{ #category : 'as yet unclassified' }
1033+
ExReqToploLoginRequirements >> openOnExample [
1034+
1035+
<script: 'ExReqToploLoginRequirements new openOnExample'>
1036+
| repository |
1037+
repository := ExReqRepository new
1038+
pragmaSelector: #ExReqToploExample;
1039+
yourself.
1040+
^ ExReqUIPresenter new
1041+
repositoryReport: repository asReport;
1042+
open.
1043+
]
1044+
1045+
{ #category : 'as yet unclassified' }
1046+
ExReqToploLoginRequirements >> transformCapellaFileIntoSimpleModel [
9471047

9481048
| project simple |
9491049
project := CapellaXMLImporter new
@@ -955,6 +1055,18 @@ ExReqToploLoginRequirements >> extractSimpleModel [
9551055
simple filterFunctionsOnIds:
9561056
{ #'300a7f2b-c0d2-48cd-854b-d9a8fcbadc24' }.
9571057

958-
(CapellaSimpleProject roassalGraph: simple) inspect.
1058+
"(CapellaSimpleProject roassalGraph: simple) inspect."
9591059
^ simple
9601060
]
1061+
1062+
{ #category : 'as yet unclassified' }
1063+
ExReqToploLoginRequirements >> transformRequirementsIntoSourceCode [
1064+
1065+
^ self transformSimpleModelIntoRequirements collect: [ :each | Stash new serialize: each ]
1066+
]
1067+
1068+
{ #category : 'as yet unclassified' }
1069+
ExReqToploLoginRequirements >> transformSimpleModelIntoRequirements [
1070+
1071+
^ self transformCapellaFileIntoSimpleModel asExReqRequirements
1072+
]

src/ExecutableRequirements/ExReqRequirement.class.st

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ ExReqRequirement >> sourceDocument: anObject [
117117
sourceDocument := anObject
118118
]
119119

120+
{ #category : 'as yet unclassified' }
121+
ExReqRequirement >> stashAccessors [
122+
123+
<stashAccessors>
124+
^ { #title . #description . #sourceDocument }
125+
]
126+
120127
{ #category : 'accessing' }
121128
ExReqRequirement >> title [
122129
^ title

0 commit comments

Comments
 (0)