App Channel Tests
Basic Broadcast
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Add Context Listener | Add an untyped context listener to the channel, using: ! await testChannel.addContextListener(null,handler) |
| B | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 4. Broadcast | Broadcast an fdc3.instrument Context to the channel with: testChannel.broadcast(<fdc3.instrument>) |
| A | 5. Receive Context | The handler added in step 2 will receive the instrument context. Ensure that the instrument received by A is identical to that sent by B. |
ACBasicUsage1Perform above test.
Current Context
| App | Step | Details |
|---|---|---|
| B | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| B | 2. Broadcast | Broadcast an fdc3.instrument to the channel using: testChannel.broadcast(<fdc3.instrument>) |
| A | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel B did (test-channel) |
| A | 4. Retrieve Current Context | A gets the current context of the user channel. via: await testChannel.getCurrentContext() Ensure that the instrument received by A is identical to that sent by B |
ACBasicUsage2Perform above test
Filtered Context
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Add Context Listener | Add an typed context listener for fdc3.instrument, using: await testChannel.addContextListener("fdc3.instrument",handler) |
| B | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 4. Broadcast | B broadcasts both an fdc3.instrument context and an fdc3.contact context, using: testChannel.broadcast(<fdc3.instrument>) testChannel.broadcast(<fdc3.contact>) |
| A | 5. Receive Context | An fdc3.instrument context is received by the handler added in step 2. Ensure that the fdc3.instrument received by A is identical to that sent by B Ensure that the fdc3.contact context is NOT received. |
ACFilteredContext1: Perform above test.ACFilteredContext2: Perform above test, but add listeners for bothfdc3.instrumentandfdc3.contactin step2. Ensure that both context objects are received.ACFilteredContext3: Perform above test, except creating a different channel in app B. Check that you don't receive anything (as the channels don't match).ACFilteredContext4: Perform above test, except that after creating the channel A creates another channel with a further different channel id and adds a further context listener to it. Ensure that A is still able to receive context on the first channel (i.e. it is unaffected by the additional channel) and does NOT receive anything on the second channel.ACUnsubscribe: Perform above test, except that after creating the channel A thenunsubscribe()s the listener it added to the channel. Check that A does NOT receive anything.
Array Context Listeners
In FDC3 3.0, support for arrays of context types was added to addContextListener, allowing applications to listen for multiple specific context types with a single listener registration.
Array Context Listeners
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Add Context Listener | Add a context listener for multiple types: await testChannel.addContextListener(["fdc3.instrument", "fdc3.contact"],handler) |
| B | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 4. Broadcast | B broadcasts: 1. testChannel.broadcast(<fdc3.instrument>) 2. testChannel.broadcast(<fdc3.contact>) 3. testChannel.broadcast(<fdc3.portfolio>) |
| A | 5. Receive Context | Handler receives fdc3.instrument and fdc3.contact contexts only.Verify that fdc3.portfolio is NOT received. |
ACArrayContextListeners1: Perform above test to verify array filtering works correctly.ACArrayNullContext1: Perform above test, but in step2 useawait testChannel.addContextListener(["fdc3.instrument", null],handler)to verify arrays with null behave like direct null (receives ALL contexts).ACArrayEmptyContext1: Attempt to create a context listener with an empty arrayawait testChannel.addContextListener([],handler)and verify context is not recieved.
App Channel History
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| B | 2. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 3. Broadcast | B broadcasts both the instrument context and a contact context, using: testChannel.broadcast(<fdc3.instrument>) testChannel.broadcast(<fdc3.contact>) |
| A | 4. Add Context Listener | A adds a context listener to the channel after B has completed all its broadcasts, via: await testChannel.addContextListener("fdc3.instrument", handler) Ensure that A does NOT receive any context via these listeners (past context is only retrieved via a getCurrentContext() call on App channels). |
| A | 5. Retrieve Current Context | A is able to retrieve the most recent context of each context type from the Channel via: const instrument = await testChannel.getCurrentContext("fdc3.instrument")const contact = await testChannel.getCurrentContext("fdc3.contact")Ensure that both contexts retrieved by A are identical to those sent by B |
ACContextHistoryTyped: Perform above test.ACContextHistoryMultiple: B Broadcasts multiple history items of both types. Ensure that only the last version of each type is received by A.ACContextHistoryLast: In step 5. A retrieves the untyped current context of the channel viaconst currentContext = await testChannel.getCurrentContext(). Ensure that A receives only the very last broadcast context item of any type.
Basic Broadcast - Destructured
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Destructure Methods | Destructure channel methods using: const { addContextListener, broadcast } = testChannel |
| A | 3. Add Context Listener | Add an untyped context listener to the channel, using destructured method: await addContextListener(null,handler) |
| B | 4. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 5. Destructure & Broadcast | Destructure broadcast method and broadcast context: const { broadcast } = testChannelbroadcast(<fdc3.instrument>) |
| A | 6. Receive Context | The handler added in step 3 will receive the instrument context. Ensure that the instrument received by A is identical to that sent by B. |
ACBasicUsage1-DestructuredPerform above test to verify destructured methods work correctly.
Current Context - Destructured
| App | Step | Details |
|---|---|---|
| B | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| B | 2. Destructure & Broadcast | Destructure broadcast method and broadcast context: const { broadcast } = testChannelbroadcast(<fdc3.instrument>) |
| A | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel B did (test-channel) |
| A | 4. Destructured & Get Context | Destructure getCurrentContext and retrieve context: const { getCurrentContext } = testChannelawait getCurrentContext() Ensure that the instrument received by A is identical to that sent by B |
ACBasicUsage2-DestructuredPerform above test to verify destructured getCurrentContext works correctly.
Clearing Context
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Add Context Listener | Add a typed context listener for fdc3.instrument, using: await testChannel.addContextListener("fdc3.instrument",handler) |
| B | 3. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 4. Broadcast | B broadcasts both an fdc3.instrument context and an fdc3.contact context, using: testChannel.broadcast(<fdc3.instrument>) testChannel.broadcast(<fdc3.contact>) |
| A | 5. Receive Context | An fdc3.instrument context is received by the handler added in step 2. Ensure that the fdc3.instrument received by A is identical to that sent by B Ensure that the fdc3.contact context is NOT received. |
| A | 6. Add Event Listener | Add an event listener for contextCleared event, using: await testChannel.addEventListener("contextCleared",handler) |
| B | 7. Clear Context | B clears context using testChannel.clearContext() |
| A | 8. Received Event | A receives event added in step 6 |
ACClearContext1: Perform above test.ACClearContext2: Perform above test, but add specific type of the context type to thetestChannel.clearContext().
Multiple listeners On The Same Or Overlapping Context types
| App | Step | Details |
|---|---|---|
| A | 1. Retrieve Channel | Retrieve a Channel object representing an 'App' channel called test-channel using: const testChannel = await fdc3.getOrCreateChannel("test-channel") |
| A | 2. Add Context Listener | Add an untyped context listener to the channel, using: await testChannel.addContextListener(null, handler1) testChannel.addContextListener(null, handler1) |
| A | 3. Add Context Listener | Add a typed context listener for fdc3.instrument with a different handler, using: await testChannel.addContextListener("fdc3.instrument", handler2) testChannel.addContextListener("fdc3.instrument", handler2) |
| B | 4. Retrieve Channel | Retrieve a Channel object representing the same 'App' channel A did (test-channel) |
| B | 5. Broadcast | Broadcast an fdc3.instrument Context to the channel with: testChannel.broadcast(<fdc3.instrument context>) |
| A | 6. Receive Context | The handlers added in step 2 and 3 will receive the instrument context. Ensure that the instrument received by A is identical to that sent by B. |
- ACMultipleOverlappingListeners1: Perform above test
- ACMultipleOverlappingListeners2: Perform above test, but instead of untyped context listener, in step 2, use
fdc3.instrument(handler should remain different)