Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ namespace Azure { namespace Messaging { namespace EventHubs {
/// Returns the partition ID associated with this ProcessorPartitionClient.
std::string PartitionId() const { return m_partitionId; }

/** Closes the partition client. */
void Close(Core::Context const& context)
/** @brief Closes the partition client.
*
* @param context The context to pass to the close operation.
*/
void Close(Core::Context const& context = {})
{
if (m_cleanupFunc)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,6 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test {
std::move(perCallpolicies));
}

Azure::Core::Json::_internal::json ParseAzureCliOutput(std::string const& cliOutput)
{
GTEST_LOG_(INFO) << "Azure CLI output: " << cliOutput;
std::string jsonOutput = cliOutput;
if (jsonOutput.find("WARNING:") == 0)
{
// Erase the warning from the CLI.
jsonOutput = jsonOutput.erase(0, cliOutput.find('\n') + 1);
}
if (jsonOutput.find("DEBUG:") == 0)
{
// Erase the warning from the CLI.
GTEST_LOG_(WARNING) << "Azure CLI debug output: " << jsonOutput;
jsonOutput = jsonOutput.erase(0, cliOutput.find('\n') + 1);
}
if (jsonOutput.find("ERROR:") == 0)
{
throw std::runtime_error("Error processing Azure CLI: " + jsonOutput);
}
if (jsonOutput.empty())
{
return {};
}
else
{
return Azure::Core::Json::_internal::json::parse(jsonOutput);
}
}

EventHubsManagement::EventHubsCreateOrUpdateOperation EventHubsManagement::CreateNamespace(
std::string const& namespaceName,
EventHubsPricingTier pricingTier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,17 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test {
while (!partitionClients.empty())
{
auto partitionClientIterator = partitionClients.begin();
auto partitionClient = partitionClientIterator->second;
std::shared_ptr<ProcessorPartitionClient> partitionClient;
if (partitionClientIterator != partitionClients.end())
{
partitionClient = partitionClientIterator->second;
partitionClients.erase(partitionClientIterator);
}
partitionClient->Close(context);
// Don't re-use the context variable here, because it's been canceled.
if (partitionClient)
{
partitionClient->Close();
}
}

processor.Stop();
Expand Down