-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
198 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@kite9/da-proxy", | ||
"version": "0.0.27", | ||
"version": "0.0.29", | ||
"files": [ | ||
"dist" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Feature: Channel Listeners Support | ||
|
||
Background: Desktop Agent API | ||
Given A Desktop Agent in "api1" | ||
Given "instrumentMessageOne" is a "broadcastRequest" message on channel "channel-name" with context "fdc3.instrument" | ||
Given "countryMessageOne" is a "broadcastRequest" message on channel "channel-name" with context "fdc3.country" | ||
Given "instrumentContext" is a "fdc3.instrument" context | ||
# Scenario: Configuring two context listeners should mean they both pick up data | ||
# Given "resultHandler" pipes context to "contexts" | ||
# When I call "api1" with "getOrCreateChannel" with parameter "channel-name" | ||
# And I refer to "result" as "channel1" | ||
# And I call "channel1" with "addContextListener" with parameters "fdc3.instrument" and "{resultHandler}" | ||
# And I call "channel1" with "addContextListener" with parameters "fdc3.instrument" and "{resultHandler}" | ||
# And messaging receives "{instrumentMessageOne}" | ||
# Then "{contexts}" is an array of objects with the following contents | ||
# | id.ticker | type | name | | ||
# | AAPL | fdc3.instrument | Apple | | ||
# | AAPL | fdc3.instrument | Apple | | ||
# Scenario: I can create a listener which listens for any context type | ||
# In this version we are using the deprecated no-args approach | ||
# Given "resultHandler" pipes context to "contexts" | ||
# When I call "api1" with "getOrCreateChannel" with parameter "channel-name" | ||
# And I refer to "result" as "channel1" | ||
# And I call "channel1" with "addContextListener" with parameter "{resultHandler}" | ||
# And messaging receives "{instrumentMessageOne}" | ||
# And messaging receives "{countryMessageOne}" | ||
# Then "{contexts}" is an array of objects with the following contents | ||
# | type | name | | ||
# | fdc3.instrument | Apple | | ||
# | fdc3.country | Sweden | | ||
# Scenario: I can create a listener which listens for any context type | ||
# In this version we are using the non-deprecated 2 args approach | ||
# Given "resultHandler" pipes context to "contexts" | ||
# When I call "api1" with "getOrCreateChannel" with parameter "channel-name" | ||
# And I refer to "result" as "channel1" | ||
# And I call "channel1" with "addContextListener" with parameters "{null}" and "{resultHandler}" | ||
# And messaging receives "{instrumentMessageOne}" | ||
# And messaging receives "{countryMessageOne}" | ||
# Then "{contexts}" is an array of objects with the following contents | ||
# | type | name | | ||
# | fdc3.instrument | Apple | | ||
# | fdc3.country | Sweden | | ||
|
||
Scenario: I can't register an app channel with the same ID as a private channel | ||
When I call "api1" with "createPrivateChannel" | ||
And I refer to "result" as "privateChannel" | ||
And I call "api1" with "getOrCreateChannel" with parameter "{privateChannel.id}" | ||
Then "{result}" is an error with message "AccessDenied" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/da-proxy/test/support/responses/RegisterChannel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { AutomaticResponse, TestMessaging } from "../TestMessaging"; | ||
import { RegisterChannelAgentRequest, RegisterChannelAgentResponse } from "@kite9/fdc3-common"; | ||
import { ChannelError } from "@finos/fdc3"; | ||
|
||
type ChannelType = { [channelId: string]: 'user' | 'app' | 'private' } | ||
|
||
export class RegisterChannel implements AutomaticResponse { | ||
|
||
private type: ChannelType = {} | ||
|
||
|
||
filter(t: string) { | ||
return t == 'registerChannelRequest' | ||
} | ||
|
||
action(input: object, m: TestMessaging) { | ||
const out = this.registerChannel(input as RegisterChannelAgentRequest) | ||
|
||
setTimeout(() => { m.receive(out as any) }, 100) | ||
return Promise.resolve() | ||
} | ||
|
||
registerChannel(r: RegisterChannelAgentRequest): RegisterChannelAgentResponse { | ||
const id = r.payload.channelId | ||
const type = r.payload.type | ||
|
||
const existingType = this.type[id] | ||
|
||
if ((existingType) && (existingType != type)) { | ||
// channel already exists | ||
return { | ||
type: "registerChannelResponse", | ||
meta: r.meta, | ||
payload: { | ||
error: ChannelError.AccessDenied | ||
} | ||
} | ||
|
||
} else { | ||
this.type[id] = type | ||
return { | ||
type: "registerChannelResponse", | ||
meta: r.meta, | ||
payload: { | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 0 additions & 50 deletions
50
packages/da-proxy/test/unused-features/app-channels.feature
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@kite9/da-server", | ||
"version": "0.0.27", | ||
"version": "0.0.29", | ||
"files": [ | ||
"dist" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@kite9/fdc3-common", | ||
"version": "0.0.27", | ||
"version": "0.0.29", | ||
"files": [ | ||
"dist" | ||
], | ||
|
Oops, something went wrong.