-
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
13 changed files
with
567 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AppIdentifier, AppIntent, IntentMetadata } from "@finos/fdc3"; | ||
|
||
/** | ||
* Contains the details of a single intent and application resolved | ||
* by the IntentResolver implementation | ||
*/ | ||
export interface SingleAppIntent { | ||
|
||
intent: IntentMetadata | ||
chosenApp: AppIdentifier | ||
|
||
} | ||
|
||
export interface IntentResolver { | ||
|
||
resolveIntent(appIntents: AppIntent[]) : SingleAppIntent | ||
|
||
} | ||
|
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,83 @@ | ||
Feature: Basic Intents Support | ||
|
||
Background: Desktop Agent API | ||
|
||
Given A Desktop Agent in "api" | ||
|
||
And app "chipShop/c1" resolves intent "OrderFood" with result type "void" | ||
And app "chipShop/c2" resolves intent "OrderFood" with result type "channel<fdc3.chips>" | ||
And app "library/l1" resolves intent "BorrowBooks" with result type "channel<fdc3.book>" | ||
And app "bank/b1" resolves intent "Buy" with context "fdc3.instrument" and result type "fdc3.order" | ||
And app "travelAgent/t1" resolves intent "Buy" with context "fdc3.currency" and result type "fdc3.order" | ||
|
||
And "instrumentContext" is a "fdc3.instrument" context | ||
And "crazyContext" is a "fdc3.unsupported" context | ||
|
||
Scenario: Find Intent can return the same intent with multiple apps | ||
|
||
When I call "api" with "findIntent" with parameter "Buy" | ||
Then "{result.intent}" is an object with the following contents | ||
| name | | ||
| Buy | | ||
And "{result.apps}" is an array of objects with the following contents | ||
| appId | instanceId | | ||
| bank | b1 | | ||
| travelAgent | t1 | | ||
|
||
Scenario: Find Intent can return an error when an intent doesn't match | ||
|
||
When I call "api" with "findIntent" with parameter "Bob" | ||
Then "result" is an error with message "NoAppsFound" | ||
|
||
Scenario: Find Intent can filter by a context type | ||
|
||
When I call "api" with "findIntent" with parameters "Buy" and "{instrumentContext}" | ||
Then "{result.intent}" is an object with the following contents | ||
| name | | ||
| Buy | | ||
And "{result.apps}" is an array of objects with the following contents | ||
| appId | | ||
| bank | | ||
|
||
Scenario: Find Intent can filter by generic result Type | ||
|
||
When I call "api" with "findIntent" with parameters "OrderFood" and "{empty}" and "channel<fdc3.chips>" | ||
Then "{result.intent}" is an object with the following contents | ||
| name | | ||
| OrderFood | | ||
And "{result.apps}" is an array of objects with the following contents | ||
| appId | instanceId | | ||
| chipShop | c2 | | ||
|
||
Scenario: Find Intents By Context | ||
|
||
When I call "api" with "findIntentsByContext" with parameter "{instrumentContext}" | ||
Then "{result}" is an array of objects with the following contents | ||
| intent.name | apps[0].appId | apps.length | | ||
| Buy | bank | 1 | | ||
|
||
Scenario: Find Intents By Context can return an error when an intent doesn't match | ||
|
||
When I call "api" with "findIntentsByContext" with parameter "{crazyContext}" | ||
Then "result" is an error with message "NoAppsFound" | ||
|
||
Scenario: Raising A Specific Intent to the server, returning a context object | ||
|
||
When I call "api" with "raiseIntent" with parameters "Buy" and "{instrumentContext}" and "{b1}" | ||
Then "{result}" is an object with the following contents | ||
| source.appId | source.instanceId | intent | | ||
| bank | b1 | Buy | | ||
And I call "result" with "getResult" | ||
Then "{result}" is an object with the following contents | ||
| type | name | | ||
| fdc3.order | Big Order 9 | | ||
|
||
Scenario: Raising An Invalid Intent to the server | ||
|
||
When I call "api" with "raiseIntent" with parameters "Buy" and "{instrumentContext}" and "{c1}" | ||
Then "result" is an error with message "NoAppsFound" | ||
|
||
# Scenario: Invoking the intent resolver when it's not clear which intent is required | ||
|
||
# When I call "api" with "raiseIntent" with parameters "OrderFood" and "{instrumentContext}" | ||
|
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
Oops, something went wrong.