forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core-amqp] Update async methods to support cancellation (Azure#13835)
* [core-amqp] make CbsClient.negotiateClaim() cancellable * [core-amqp] make RequestResponseLink.create cancellable * [core-amqp] make CbsClient.init cancellable * [core-amqp] fix lint error * [core-amqp] update API review * [core-amqp] update 2.2.0 changelog with notes for issue 9988 * [core-amqp] update package.json version to 2.2.0 * [core-amqp] pass abortSignal to connection.open() * [core-amqp] rename RequestResponseLink.create(..., options) to RequestResponseLink.create(..., createOptions) * [core-amqp] rename RequestResponseLink.create(..., options) to RequestResponseLink.create(..., createOptions) - API review file
- Loading branch information
Showing
8 changed files
with
239 additions
and
17 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
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
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,31 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import EventEmitter from "events"; | ||
import { Connection } from "rhea-promise"; | ||
import { stub } from "sinon"; | ||
|
||
/** | ||
* Creates a stubbed rhea-promise Connection object. | ||
*/ | ||
export function createConnectionStub(): Connection { | ||
const connectionStub = new Connection(); | ||
stub(connectionStub, "open").resolves({} as any); | ||
stub(connectionStub, "createSession").resolves({ | ||
connection: { | ||
id: "connection-1" | ||
}, | ||
createSender: () => { | ||
const sender = new EventEmitter() as any; | ||
sender.send = () => { | ||
/* no-op */ | ||
}; | ||
return Promise.resolve(sender); | ||
}, | ||
createReceiver: () => { | ||
return Promise.resolve(new EventEmitter()); | ||
} | ||
} as any); | ||
stub(connectionStub, "id").get(() => "connection-1"); | ||
return connectionStub; | ||
} |