-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathbroadcast.feature
More file actions
111 lines (98 loc) · 9.84 KB
/
Copy pathbroadcast.feature
File metadata and controls
111 lines (98 loc) · 9.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Feature: Relaying Broadcast messages
Background:
Given schemas loaded
And A newly instantiated FDC3 Server
And "App1/a1" is opened with connection id "a1"
And "App2/a2" is opened with connection id "a2"
Scenario: Broadcast message to no-one
When "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type |
| broadcastResponse |
And messaging will have 1 posts
Scenario: Broadcast message sent to one listener
When "App2/a2" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type | msg.payload.context.id.ticker | msg.payload.metadata.source.appId | msg.payload.metadata.source.instanceId |
| addContextListenerResponse | {null} | {null} | {null} | {null} | {null} |
| broadcastEvent | one | fdc3.instrument | AAPL | App1 | a1 |
| broadcastResponse | {null} | {null} | {null} | {null} | {null} |
Scenario: Broadcast message sent but listener has unsubscribed
When "App2/a2" adds a context listener on "one" with type "fdc3.instrument"
And "App2/a2" removes context listener with id "uuid3"
And "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type | to.appId | to.instanceId | msg.payload.listenerUUID |
| addContextListenerResponse | App2 | a2 | uuid3 |
| contextListenerUnsubscribeResponse | App2 | a2 | {null} |
| broadcastResponse | App1 | a1 | {null} |
Scenario: Broadcasting app does not receive its own broadcast by default
When "App1/a1" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type |
| addContextListenerResponse | {null} | {null} |
| broadcastResponse | {null} | {null} |
Scenario: Broadcasting app receives its own broadcast when opted in
When "App1/a1" has opted in to "receiveOwnBroadcasts"
And "App1/a1" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type | msg.payload.context.id.ticker | to.instanceId | msg.payload.metadata.source.instanceId |
| addContextListenerResponse | {null} | {null} | {null} | a1 | {null} |
| broadcastEvent | one | fdc3.instrument | AAPL | a1 | a1 |
| broadcastResponse | {null} | {null} | {null} | a1 | {null} |
Scenario: Opting in to own broadcasts does not affect other apps receiving them
When "App1/a1" has opted in to "receiveOwnBroadcasts"
And "App2/a2" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one"
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type | to.instanceId | msg.payload.metadata.source.instanceId |
| addContextListenerResponse | {null} | {null} | a2 | {null} |
| broadcastEvent | one | fdc3.instrument | a2 | a1 |
| broadcastResponse | {null} | {null} | a1 | {null} |
Scenario: Retrieve an existing user channel via getOrCreateChannel
When "App1/a1" creates or gets an app channel called "one"
Then messaging will have outgoing posts
| msg.matches_type | to.instanceId | msg.payload.channel.id | msg.payload.channel.type | msg.payload.error |
| getOrCreateChannelResponse | a1 | one | user | {null} |
Scenario: Retrieve a new app channel via getOrCreateChannel
When "App1/a1" creates or gets an app channel called "myAppChannel"
Then messaging will have outgoing posts
| msg.matches_type | to.instanceId | msg.payload.channel.id | msg.payload.channel.type | msg.payload.error |
| getOrCreateChannelResponse | a1 | myAppChannel | app | {null} |
Scenario: Get The Latest Context From A Channel
Given "App1/a1" broadcasts "fdc3.instrument" on "one"
And "App1/a1" asks for the latest context on "one" with type "fdc3.instrument"
Then messaging will have outgoing posts
| msg.matches_type | to.appId | to.instanceId | msg.payload.context.id.ticker | msg.payload.context.type |
| getCurrentContextResponse | App1 | a1 | AAPL | fdc3.instrument |
Scenario: Broadcast with app-provided metadata forwards traceId, signature, antiReplay and custom
When "App2/a2" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one" with metadata traceId "my-trace" signature "my-sig" antiReplay claims "1234/2345/anti-replay-123" and custom key "EMEA"
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type | msg.payload.metadata.source.appId | msg.payload.metadata.traceId | msg.payload.metadata.signature.signature |msg.payload.metadata.signature.protected | msg.payload.metadata.antiReplay.exp | msg.payload.metadata.antiReplay.iat | msg.payload.metadata.antiReplay.jti | msg.payload.metadata.custom.region |
| addContextListenerResponse | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} |
| broadcastEvent | one | fdc3.instrument | App1 | my-trace | my-sig (signature part) | my-sig (protected part) | 2345 | 1234 | anti-replay-123 | EMEA |
| broadcastResponse | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} | {null} |
Scenario: Broadcast without app-provided traceId gets a DA-generated traceId
When "App2/a2" adds a context listener on "one" with type "fdc3.instrument"
And we wait for a period of "100" ms
And "App1/a1" broadcasts "fdc3.instrument" on "one" without metadata
Then messaging will have outgoing posts
| msg.matches_type | msg.payload.channelId | msg.payload.context.type | msg.payload.metadata.source.appId |
| addContextListenerResponse | {null} | {null} | {null} |
| broadcastEvent | one | fdc3.instrument | App1 |
| broadcastResponse | {null} | {null} | {null} |
Scenario: getCurrentContext returns stored metadata after broadcast with app-provided metadata
Given "App1/a1" broadcasts "fdc3.instrument" on "one" with metadata traceId "stored-trace" signature "stored-sig" antiReplay claims "1234/2345/anti-replay-123" and custom key "APAC"
And "App1/a1" asks for the latest context on "one" with type "fdc3.instrument"
Then messaging will have outgoing posts
| msg.matches_type | to.appId | to.instanceId | msg.payload.context.id.ticker | msg.payload.context.type | msg.payload.metadata.traceId | msg.payload.metadata.signature.signature | msg.payload.metadata.signature.protected | msg.payload.metadata.antiReplay.exp | msg.payload.metadata.antiReplay.iat | msg.payload.metadata.antiReplay.jti | msg.payload.metadata.custom.region |
| getCurrentContextResponse | App1 | a1 | AAPL | fdc3.instrument | stored-trace | stored-sig (signature part) | stored-sig (protected part) | 2345 | 1234 | anti-replay-123 | APAC |