11
11
</ head >
12
12
< body >
13
13
< div class ="container pull-left ">
14
- < br /> < br />
15
14
< div align ="center ">
16
15
< label > JMESPath Rules setup</ label >
17
16
</ div >
@@ -46,7 +45,7 @@ <h3>Rule set up</h3>
46
45
< p > Rules for object aggregation consist from JSON object with a defined structure inside it. Key in this object is rule specification and
47
46
value is JMESPath identifier. Separate rule is created for each event type that is going to take participation in creating of aggregated
48
47
object. This means that if you want to create your aggregated object from 3 event types and all rest event types discard, you will need 3
49
- set of rules. Each rule might contain some of these keys, that have not null or empty values. Explicit list of rule keys are bellow:
48
+ set of rules. Each rule might contain some of these keys, that have not null or empty values. Explicit list of rule keys are bellow:</ p >
50
49
< ul >
51
50
< li > < code > "TemplateName"</ code > - used for specifying a template group, any string you like to name your template</ li >
52
51
< li > < code > "Type"</ code > - Eiffel event < a href ="https://github.com/Ericsson/eiffel/tree/master/eiffel-vocabulary "> type</ a > ,
@@ -68,10 +67,10 @@ <h3>Rule set up</h3>
68
67
< li > < code > "MatchIdRules"</ code > - denotes the received event id of the object, example < code > "%IdentifyRules_objid%"</ code > </ li >
69
68
< li > < code > "IdentifyRules"</ code > - JMESPath identifier of event id that will be used in aggregated object. Should produce an JSON array,
70
69
for example < code > "[meta.id]"</ code > which will return the specified field in array
71
- < code > ["sb6e51h0-25ch-4dh7-b9sd-876g8e6kde47"]</ code > .< br >
70
+ < code > ["sb6e51h0-25ch-4dh7-b9sd-876g8e6kde47"]</ code > .
72
71
And other common example is
73
72
< code > "links | [?type=='CAUSE'].target"</ code > which will extract the event id from < code > links</ code > array value of
74
- < code > target</ code > , where "type" is equal "CAUSE". < br >
73
+ < code > target</ code > , where "type" is equal "CAUSE".
75
74
Links look like < code > {"links": [
76
75
{
77
76
"target": "f37d59a3-069e-4f4c-8cc5-a52e73501a75",
@@ -94,12 +93,12 @@ <h3>Rule set up</h3>
94
93
to the inner structure of aggregated object depending on MergeResolverRules.
95
94
</ li >
96
95
< li > < code > "MergeResolverRules"</ code > - JMESPath identifier of the place where to insert the JSON object form "ExtractionRules".
97
- If MergeResolverRules is < code > null</ code > ExtractionRules object will be inserted to the root of aggregated object.< br >
96
+ If MergeResolverRules is < code > null</ code > ExtractionRules object will be inserted to the root of aggregated object.
98
97
Other example is < code > "[{NONEPATH:NONE}, {test_suite: [{ test_case : [{ trigger_event_id:meta.id}]} ]} ]"</ code > which consists from
99
98
array with two fields, first is expression < code > {NONEPATH:NONE}</ code > that < strong > should not exist</ strong > in aggregated object,
100
99
actually it could be any words you like.
101
100
Second part is < code > {test_suite: [{ test_case : [{ trigger_event_id:meta.id}]}</ code > that will form a new JSON object that will be
102
- inserted to the aggregated object after evaluation of "meta.id".< br >
101
+ inserted to the aggregated object after evaluation of "meta.id".
103
102
Another example could be insertion of object obtained in "ExtractionRules" to the array element that has < code > trigger_event_id</ code >
104
103
matching the event id target field from incoming event "TEST_CASE_EXECUTION" link JSON object.
105
104
</ li >
@@ -128,17 +127,17 @@ <h3>Rule set up</h3>
128
127
< li > < code > "ProcessFunction"</ code > - Reserved for future use.</ li >
129
128
130
129
</ ul >
131
- </ p >
132
- < hr >
130
+
131
+
133
132
< h3 > The most common operation you would do</ h3 >
134
133
135
134
< h4 > Creating new aggregated object from Eiifel event</ h4 >
136
135
< p > Lets consider that aggregated object should be created on receiving the EiffelArtifactCreated event, and it should form the aggregated object
137
136
from the received event. Aggregated object should contain fields "id", "artifactId", and "temp", where id will be extracted from the received
138
- event field "id", artifactId will be extracted from the this event too and temp will be set to true.
139
- < details >
140
- < summary > EiffelArtifactCreatedEvent example, click to unfold</ summary >
141
- < pre >
137
+ event field "id", artifactId will be extracted from the this event too and temp will be set to true.</ p >
138
+ < details >
139
+ < summary > EiffelArtifactCreatedEvent example, click to unfold</ summary >
140
+ < pre >
142
141
{
143
142
"meta":{
144
143
"id":"66208918-4422-42cb-a0bf-17b15d1043d2",
@@ -189,9 +188,9 @@ <h4>Creating new aggregated object from Eiifel event</h4>
189
188
190
189
]
191
190
}</ pre >
192
- </ details >
193
- So we need to form a set of basic rules for Eiffel event that will fulfill our aggregated object.
194
- Keep in mind that we are adding to the root of aggregated object so no need to specify MergeResolverRules.
191
+ </ details >
192
+ < p > So we need to form a set of basic rules for Eiffel event that will fulfill our aggregated object.
193
+ Keep in mind that we are adding to the root of aggregated object so no need to specify MergeResolverRules.</ p >
195
194
< pre >
196
195
{
197
196
"TemplateName":"ARTIFACT_1",
@@ -217,8 +216,8 @@ <h4>Creating new aggregated object from Eiifel event</h4>
217
216
"TemplateName":"ARTIFACT_1"
218
217
}
219
218
}</ pre >
220
- </ p >
221
- < hr >
219
+
220
+
222
221
223
222
< h4 > Inserting a JSON array to aggregated object</ h4 >
224
223
< p > Lets consider that on receiving of EiffelConfidenceLevelModifiedEvent message, confidence levels array should be inserted to the aggregated
@@ -241,7 +240,7 @@ <h4>Inserting a JSON array to aggregated object</h4>
241
240
array is located. Each element of array is valid JSON object. There are key-value pairs in this array, and in one of those there is a key
242
241
< code > "type"</ code > and value is
243
242
< code > "SUBJECT"</ code > and we need to extract the value of < code > "target"</ code > which will be our id for aggreagated object.
244
- Such identifier for that is placed in < code > "IdentifyRules":"links | [?type=='SUBJECT'].target"</ code > .< br >
243
+ Such identifier for that is placed in < code > "IdentifyRules":"links | [?type=='SUBJECT'].target"</ code > .
245
244
At this point we know the needed aggregated object id and now we need to specify the desired location for confidence level information.
246
245
Lets move the data obtained in "ExtractionRules" under < code > "confidenceLevels"</ code > key in the root of aggregated object and the value
247
246
of it should be array. The identifier for such expression will be < code > {confidenceLevels: [{ eventId: meta.id }]}</ code > . To insert the
@@ -370,13 +369,13 @@ <h4>Inserting a JSON array to aggregated object</h4>
370
369
</ pre >
371
370
</ details >
372
371
373
- < hr >
372
+
374
373
< h4 > Updating array of JSON objects where the some field is pointing to Eiffel message id</ h4 >
375
374
376
375
< p > Lets consider that on receiving EiffelTestCaseStartedEvent message we need to update the array object, which has
377
376
in the < code > "TEST_CASE_EXECUTION"</ code > link type id, that
378
377
matches aggregated object and the data in that JSON object need to be updated. As a result of applying the rule, field ongoing in aggregated
379
- object will change the value from < code > {
378
+ object will change the value from < code > {
380
379
"ongoing":"false",
381
380
"test_data":null,
382
381
"trigger_event_id":"v46ef19d-20gb-4d2y-h9fa-87dada6kde47"
@@ -499,7 +498,7 @@ <h4>Updating array of JSON objects where the some field is pointing to Eiffel me
499
498
}</ pre >
500
499
</ details >
501
500
502
- < hr >
501
+
503
502
504
503
< h4 > Upstream events</ h4 >
505
504
< p > Under upstream events to some specified event in Eiffel we mean those event that were processed/issued before or were the cause to
@@ -509,7 +508,7 @@ <h4>Upstream events</h4>
509
508
EiffelSourceChangeSubmittedEvent, EiffelArtifactCreatedEvent, EiffelArtifactPublishedEvent, so the upstream event for
510
509
EiffelArtifactCreatedEvent will be EiffelSourceChangeCreatedEvent andEiffelSourceChangeSubmittedEvent.
511
510
</ p >
512
- < hr >
511
+
513
512
514
513
< h4 > Downstream events</ h4 >
515
514
< p > Under downstream events to some specified event in Eiffel we mean those event that will be issued after or were the outcome to
@@ -519,7 +518,7 @@ <h4>Downstream events</h4>
519
518
EiffelSourceChangeSubmittedEvent, EiffelArtifactCreatedEvent, EiffelArtifactPublishedEvent, so the downstream event for
520
519
EiffelArtifactCreatedEvent will be EiffelArtifactPublishedEvent.
521
520
</ p >
522
- < hr >
521
+
523
522
524
523
525
524
< p > Rule examples</ p >
0 commit comments