diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/connection.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/connection.hpp index f609c077f5e..97efd257869 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/connection.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/connection.hpp @@ -26,7 +26,7 @@ namespace Azure { namespace Core { namespace Amqp { uint32_t MaxFrameSize{512}; uint16_t MaxSessions{65535}; - Azure::Core::Amqp::Models::Value Properties; + Azure::Core::Amqp::Models::AmqpValue Properties; std::chrono::seconds Timeout{0}; @@ -78,7 +78,7 @@ namespace Azure { namespace Core { namespace Amqp { { virtual void OnEndpointFrameReceived( Connection const& connection, - Azure::Core::Amqp::Models::Value const& value, + Azure::Core::Amqp::Models::AmqpValue const& value, uint32_t framePayloadSize, uint8_t* payloadBytes) = 0; @@ -120,7 +120,7 @@ namespace Azure { namespace Core { namespace Amqp { void Close( std::string const& condition, std::string const& description, - Azure::Core::Amqp::Models::Value info); + Azure::Core::Amqp::Models::AmqpValue info); void Poll() const; @@ -133,8 +133,8 @@ namespace Azure { namespace Core { namespace Amqp { void SetIdleTimeout(std::chrono::milliseconds timeout); void SetRemoteIdleTimeoutEmptyFrameSendRatio(double idleTimeoutEmptyFrameSendRatio); - void SetProperties(Azure::Core::Amqp::Models::Value properties); - Azure::Core::Amqp::Models::Value GetProperties() const; + void SetProperties(Azure::Core::Amqp::Models::AmqpValue properties); + Azure::Core::Amqp::Models::AmqpValue GetProperties() const; uint64_t HandleDeadlines(); // ??? Endpoint CreateEndpoint(); void StartEndpoint(Endpoint const& endpoint); diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/link.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/link.hpp index 93f060a963a..e25ffe18cb7 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/link.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/link.hpp @@ -103,7 +103,7 @@ namespace Azure { namespace Core { namespace Amqp { uint64_t GetPeerMaxMessageSize() const; - void SetAttachProperties(Azure::Core::Amqp::Models::Value attachProperties); + void SetAttachProperties(Azure::Core::Amqp::Models::AmqpValue attachProperties); void SetMaxLinkCredit(uint32_t maxLinkCredit); std::string GetName() const; @@ -119,7 +119,7 @@ namespace Azure { namespace Core { namespace Amqp { bool close, std::string const& errorCondition, std::string const& errorDescription, - Azure::Core::Amqp::Models::Value& info); + Azure::Core::Amqp::Models::AmqpValue& info); private: std::shared_ptr m_impl; diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_receiver.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_receiver.hpp index 16eee5098c5..358d12157b0 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_receiver.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_receiver.hpp @@ -58,7 +58,7 @@ namespace Azure { namespace Core { namespace Amqp { std::chrono::seconds ExpiryTimeout{std::chrono::seconds(0)}; // LinkFilter bool ManualCredits{}; - Azure::Core::Amqp::Models::Value Properties; + Azure::Core::Amqp::Models::AmqpValue Properties; std::vector SenderCapabilities; LinkDurability SenderDurability{}; @@ -72,7 +72,7 @@ namespace Azure { namespace Core { namespace Amqp { MessageReceiverState newState, MessageReceiverState oldState) = 0; - virtual Azure::Core::Amqp::Models::Value OnMessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message message) = 0; }; @@ -126,7 +126,7 @@ namespace Azure { namespace Core { namespace Amqp { void SendMessageDisposition( const char* linkName, uint32_t messageNumber, - Azure::Core::Amqp::Models::Value deliveryState); + Azure::Core::Amqp::Models::AmqpValue deliveryState); void SetTrace(bool traceEnabled); Azure::Core::Amqp::Models::Message WaitForIncomingMessage( diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp index 05b65718297..cfffc009d2b 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/message_sender.hpp @@ -71,7 +71,7 @@ namespace Azure { namespace Core { namespace Amqp { std::chrono::seconds ExpiryTimeout{std::chrono::seconds(0)}; bool IgnoreDispositionErrors{false}; - Azure::Core::Amqp::Models::Value Properties; + Azure::Core::Amqp::Models::AmqpValue Properties; ReceiverSettleMode RequestedReceiverSettleMode{}; @@ -85,7 +85,7 @@ namespace Azure { namespace Core { namespace Amqp { public: using MessageSendCompleteCallback = std::function; + Azure::Core::Amqp::Models::AmqpValue const& deliveryState)>; MessageSender( Session const& session, @@ -134,7 +134,7 @@ namespace Azure { namespace Core { namespace Amqp { void Open(); void Close(); - std::tuple Send( + std::tuple Send( Azure::Core::Amqp::Models::Message const& message, Azure::Core::Context context = {}); void SendAsync( diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_message.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_message.hpp index c8315f7f51b..56bcf10febc 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_message.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_message.hpp @@ -39,37 +39,37 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { void SetHeader(Header const& header); Header const GetHeader() const; - void SetFooter(Value const& header); - Value const GetFooter() const; + void SetFooter(AmqpValue const& header); + AmqpValue const GetFooter() const; - void SetDeliveryAnnotations(Value const& annotations); - Value const GetDeliveryAnnotations() const; + void SetDeliveryAnnotations(AmqpValue const& annotations); + AmqpValue const GetDeliveryAnnotations() const; void SetFormat(uint32_t messageFormat); uint32_t GetFormat() const; - void SetMessageAnnotations(Value const& annotations); - Value const GetMessageAnnotations() const; + void SetMessageAnnotations(AmqpValue const& annotations); + AmqpValue const GetMessageAnnotations() const; void SetProperties(Properties const& properties); Properties const GetProperties() const; - void SetApplicationProperties(Value const& value); - Value const GetApplicationProperties() const; + void SetApplicationProperties(AmqpValue const& value); + AmqpValue const GetApplicationProperties() const; MessageBodyType GetBodyType() const; - void AddBodyAmqpSequence(Value const& value); + void AddBodyAmqpSequence(AmqpValue const& value); size_t GetBodyAmqpSequenceCount() const; - Value const GetBodyAmqpSequence(uint32_t index) const; + AmqpValue const GetBodyAmqpSequence(uint32_t index) const; void AddBodyAmqpData(BinaryData binaryData); BinaryData GetBodyAmqpData(size_t index) const; size_t GetBodyAmqpDataCount() const; - void SetBodyAmqpValue(Value value); - Value GetBodyAmqpValue() const; + void SetBodyAmqpValue(AmqpValue value); + AmqpValue GetBodyAmqpValue() const; friend std::ostream& operator<<(std::ostream&, Message const&); }; diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_properties.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_properties.hpp index ce0b3eb9933..a7e169a81ee 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_properties.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_properties.hpp @@ -26,23 +26,23 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { ~Properties(); - Value GetMessageId() const; - void SetMessageId(Value const& messageId); + AmqpValue GetMessageId() const; + void SetMessageId(AmqpValue const& messageId); - Value GetCorrelationId() const; - void SetCorrelationId(Value const& correlationId); + AmqpValue GetCorrelationId() const; + void SetCorrelationId(AmqpValue const& correlationId); BinaryData GetUserId() const; void SetUserId(BinaryData const& userId); - Value GetTo() const; - void SetTo(Value replyTo); + AmqpValue GetTo() const; + void SetTo(AmqpValue replyTo); std::string GetSubject() const; void SetSubject(std::string const& replyTo); - Value GetReplyTo() const; - void SetReplyTo(Value replyTo); + AmqpValue GetReplyTo() const; + void SetReplyTo(AmqpValue replyTo); std::string GetContentType() const; void SetContentType(std::string const& contentType); @@ -68,9 +68,4 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { friend std::ostream& operator<<(std::ostream&, Properties const&); }; -#if 0 - - // Move to AMQPValue: - -#endif }}}} // namespace Azure::Core::Amqp::Models diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_value.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_value.hpp index bab870781c4..016d27de7f8 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_value.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/amqp_value.hpp @@ -70,44 +70,42 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { Unknown }; - class Value { - AMQP_VALUE_DATA_TAG* m_value; - + class AmqpValue { public: - ~Value(); - - Value(bool bool_value); - Value(unsigned char byte_value); - Value(char value); - Value(uint16_t value); - Value(int16_t value); - Value(uint32_t value); - Value(int32_t value); - Value(uint64_t value); - Value(int64_t value); - Value(float value); - Value(double value); + ~AmqpValue(); + + AmqpValue(bool bool_AmqpValue); + AmqpValue(unsigned char byte_value); + AmqpValue(char value); + AmqpValue(uint16_t value); + AmqpValue(int16_t value); + AmqpValue(uint32_t value); + AmqpValue(int32_t value); + AmqpValue(uint64_t value); + AmqpValue(int64_t value); + AmqpValue(float value); + AmqpValue(double value); /* ???? */ - // AMQPValue(uint32_t value) : m_value{amqpvalue_create_char(value)} {} - // AMQPValue(timestamp value) : m_value{amqpvalue_create_timestamp(value)} {} - // AMQPValue(std::string const& value) : m_value{amqpvalue_create_symbol(value.c_str())} {} + // AmqpValue(uint32_t value) : m_value{amqpvalue_create_char(value)} {} + // AmqpValue(timestamp value) : m_value{amqpvalue_create_timestamp(value)} {} + // AmqpValue(std::string const& value) : m_value{amqpvalue_create_symbol(value.c_str())} {} - Value(Uuid value); - Value(BinaryData value); - explicit Value(std::string value); - Value(const char* value); + AmqpValue(Uuid value); + AmqpValue(BinaryData value); + explicit AmqpValue(std::string value); + AmqpValue(const char* value); - Value(); - Value(Value const& that) throw(); - Value(Value&& that) throw(); + AmqpValue(); + AmqpValue(AmqpValue const& that) throw(); + AmqpValue(AmqpValue&& that) throw(); // Interoperability functions for uAMQP operator AMQP_VALUE_DATA_TAG*() const; - Value(AMQP_VALUE_DATA_TAG* value); + AmqpValue(AMQP_VALUE_DATA_TAG* value); - Value& operator=(Value const& that); - Value& operator=(Value&& that) throw(); + AmqpValue& operator=(AmqpValue const& that); + AmqpValue& operator=(AmqpValue&& that) throw(); bool IsNull() const; @@ -140,112 +138,77 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { operator Uuid(); operator Uuid() const; - bool operator==(Value const& that) const; + bool operator==(AmqpValue const& that) const; AmqpValueType GetType() const; // List Operations. - static Value CreateList(); + static AmqpValue CreateList(); void SetListItemCount(uint32_t count); uint32_t GetListItemCount() const; - void SetListItem(uint32_t index, Value item); - Value GetListItem(size_t index) const; - // AMQPValue GetListItemInPlace(size_t index) const; + void SetListItem(uint32_t index, AmqpValue item); + AmqpValue GetListItem(size_t index) const; + // AMQPAmqpValue GetListItemInPlace(size_t index) const; // Map operations. - static Value CreateMap(); - void SetMapValue(Value key, Value value); - Value GetMapValue(Value key) const; - std::pair GetMapKeyAndValue(uint32_t index) const; + static AmqpValue CreateMap(); + void SetMapValue(AmqpValue key, AmqpValue value); + AmqpValue GetMapValue(AmqpValue key) const; + std::pair GetMapKeyAndValue(uint32_t index) const; size_t GetMapValueCount() const; // Array operations - note that all array items must be of the same type. - static Value CreateArray(); - void AddArrayItem(Value itemValue); - Value GetArrayItem(uint32_t index) const; + static AmqpValue CreateArray(); + void AddArrayItem(AmqpValue itemAmqpValue); + AmqpValue GetArrayItem(uint32_t index) const; uint32_t GetArrayItemCount() const; // Char - static Value CreateChar(uint32_t value); + static AmqpValue CreateChar(uint32_t value); uint32_t GetChar() const; // Timestamps - static Value CreateTimestamp(std::chrono::milliseconds value); + static AmqpValue CreateTimestamp(std::chrono::milliseconds value); std::chrono::milliseconds GetTimestamp() const; // Symbols - static Value CreateSymbol(std::string const& value); + static AmqpValue CreateSymbol(std::string const& value); std::string GetSymbol() const; // Composite values - A composite value is functionally a list with a fixed size. - static Value CreateComposite(Value descriptor, uint32_t listSize); - void SetCompositeItem(uint32_t index, Value itemValue); - Value GetCompositeItem(uint32_t index); - // AMQPValue GetCompositeItemInPlace(size_t index) const; + static AmqpValue CreateComposite(AmqpValue descriptor, uint32_t listSize); + void SetCompositeItem(uint32_t index, AmqpValue itemAmqpValue); + AmqpValue GetCompositeItem(uint32_t index); + // AMQPAmqpValue GetCompositeItemInPlace(size_t index) const; size_t GetCompositeItemCount() const; - static Value CreateDescribed(Value descriptor, Value value); - static Value CreateCompositeWithDescriptor(uint64_t descriptor); + static AmqpValue CreateDescribed(AmqpValue descriptor, AmqpValue value); + static AmqpValue CreateCompositeWithDescriptor(uint64_t descriptor); // Descriptors - Value GetDescriptor() const; - Value GetDescribedValue() const; + AmqpValue GetDescriptor() const; + AmqpValue GetDescribedValue() const; // Headers. bool IsHeaderTypeByDescriptor() const; Header GetHeaderFromValue() const; - static Value CreateHeader(Header const& header); + static AmqpValue CreateHeader(Header const& header); // Properties. bool IsPropertiesTypeByDescriptor() const; Properties GetPropertiesFromValue() const; - static Value CreateProperties(Properties const& properties); + static AmqpValue CreateProperties(Properties const& properties); + + friend std::ostream& operator<<(std::ostream& os, AmqpValue const& value); - friend std::ostream& operator<<(std::ostream& os, Value const& value); + protected: + AMQP_VALUE_DATA_TAG* m_value; }; -#if 0 - /* type handling */ - - /* encoding */ - typedef int (*AMQPVALUE_ENCODER_OUTPUT)(void* context, const unsigned char* bytes, size_t length); - - MOCKABLE_FUNCTION( - , - int, - amqpvalue_encode, - AMQP_VALUE, - value, - AMQPVALUE_ENCODER_OUTPUT, - encoder_output, - void*, - context); - MOCKABLE_FUNCTION(, int, amqpvalue_get_encoded_size, AMQP_VALUE, value, size_t*, encoded_size); - - /* decoding */ - typedef struct AMQPVALUE_DECODER_HANDLE_DATA_TAG* AMQPVALUE_DECODER_HANDLE; - typedef void (*ON_VALUE_DECODED)(void* context, AMQP_VALUE decoded_value); - - MOCKABLE_FUNCTION( - , - AMQPVALUE_DECODER_HANDLE, - amqpvalue_decoder_create, - ON_VALUE_DECODED, - on_value_decoded, - void*, - callback_context); - MOCKABLE_FUNCTION(, void, amqpvalue_decoder_destroy, AMQPVALUE_DECODER_HANDLE, handle); - MOCKABLE_FUNCTION( - , - int, - amqpvalue_decode_bytes, - AMQPVALUE_DECODER_HANDLE, - handle, - const unsigned char*, - buffer, - size_t, - size); - -#endif + /** @brief An AmqpMap represents an AMQP "map" type. which maps a key to a value. + * + */ + class AmqpMap : public AmqpValue {}; + }}}} // namespace Azure::Core::Amqp::Models diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_source.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_source.hpp index 36956d8991e..229bcf33eb3 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_source.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_source.hpp @@ -22,16 +22,16 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace MessageSource(SOURCE_INSTANCE_TAG* message); // Create a described source from an AMQP Value - used in the OnLinkAttached. - MessageSource(Azure::Core::Amqp::Models::Value const& value); + MessageSource(Azure::Core::Amqp::Models::AmqpValue const& value); MessageSource(std::string const& value); MessageSource(char const* value); operator SOURCE_INSTANCE_TAG*() const { return m_source; } - operator const Azure::Core::Amqp::Models::Value() const; + operator const Azure::Core::Amqp::Models::AmqpValue() const; - Azure::Core::Amqp::Models::Value GetAddress() const; - void SetAddress(Azure::Core::Amqp::Models::Value const& address); + Azure::Core::Amqp::Models::AmqpValue GetAddress() const; + void SetAddress(Azure::Core::Amqp::Models::AmqpValue const& address); Azure::Core::Amqp::Models::TerminusDurability GetTerminusDurability() const; void SetTerminusDurability(Azure::Core::Amqp::Models::TerminusDurability terminusDurability); @@ -45,23 +45,23 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace bool GetDynamic() const; void SetDynamic(bool dynamic); - Azure::Core::Amqp::Models::Value GetDynamicNodeProperties() const; - void SetDynamicNodeProperties(Azure::Core::Amqp::Models::Value const& dynamicNodeProperties); + Azure::Core::Amqp::Models::AmqpValue GetDynamicNodeProperties() const; + void SetDynamicNodeProperties(Azure::Core::Amqp::Models::AmqpValue const& dynamicNodeProperties); std::string GetDistributionMode() const; void SetDistributionMode(std::string const& distributionMode); - Azure::Core::Amqp::Models::Value GetFilter() const; - void SetFilter(Azure::Core::Amqp::Models::Value const& filter); + Azure::Core::Amqp::Models::AmqpValue GetFilter() const; + void SetFilter(Azure::Core::Amqp::Models::AmqpValue const& filter); - Azure::Core::Amqp::Models::Value GetDefaultOutcome() const; - void SetDefaultOutcome(Azure::Core::Amqp::Models::Value const& defaultOutcome); + Azure::Core::Amqp::Models::AmqpValue GetDefaultOutcome() const; + void SetDefaultOutcome(Azure::Core::Amqp::Models::AmqpValue const& defaultOutcome); - Azure::Core::Amqp::Models::Value GetOutcomes() const; - void SetOutcomes(Azure::Core::Amqp::Models::Value const& outcomes); + Azure::Core::Amqp::Models::AmqpValue GetOutcomes() const; + void SetOutcomes(Azure::Core::Amqp::Models::AmqpValue const& outcomes); - Azure::Core::Amqp::Models::Value GetCapabilities() const; - void SetCapabilities(Azure::Core::Amqp::Models::Value const& capabilities); + Azure::Core::Amqp::Models::AmqpValue GetCapabilities() const; + void SetCapabilities(Azure::Core::Amqp::Models::AmqpValue const& capabilities); friend std::ostream& operator<<(std::ostream&, MessageSource const&); diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_target.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_target.hpp index 9362a6c2e6e..889c4be790b 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_target.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/message_target.hpp @@ -24,13 +24,13 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace MessageTarget(std::string const& value); MessageTarget(char const* value); - MessageTarget(Azure::Core::Amqp::Models::Value const& value); - operator const Azure::Core::Amqp::Models::Value() const; + MessageTarget(Azure::Core::Amqp::Models::AmqpValue const& value); + operator const Azure::Core::Amqp::Models::AmqpValue() const; operator TARGET_INSTANCE_TAG*() const { return m_target; } - Azure::Core::Amqp::Models::Value GetAddress() const; - void SetAddress(Azure::Core::Amqp::Models::Value const& address); + Azure::Core::Amqp::Models::AmqpValue GetAddress() const; + void SetAddress(Azure::Core::Amqp::Models::AmqpValue const& address); Azure::Core::Amqp::Models::TerminusDurability GetTerminusDurability() const; void SetTerminusDurability(Azure::Core::Amqp::Models::TerminusDurability terminusDurability); @@ -44,11 +44,11 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace bool GetDynamic() const; void SetDynamic(bool dynamic); - Azure::Core::Amqp::Models::Value GetDynamicNodeProperties() const; - void SetDynamicNodeProperties(Azure::Core::Amqp::Models::Value const& dynamicNodeProperties); + Azure::Core::Amqp::Models::AmqpValue GetDynamicNodeProperties() const; + void SetDynamicNodeProperties(Azure::Core::Amqp::Models::AmqpValue const& dynamicNodeProperties); - Azure::Core::Amqp::Models::Value GetCapabilities() const; - void SetCapabilities(Azure::Core::Amqp::Models::Value const& capabilities); + Azure::Core::Amqp::Models::AmqpValue GetCapabilities() const; + void SetCapabilities(Azure::Core::Amqp::Models::AmqpValue const& capabilities); friend std::ostream& operator<<(std::ostream&, MessageTarget const&); diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/messaging_values.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/messaging_values.hpp index 4abc293ea87..5a1ffc62121 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/messaging_values.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/models/messaging_values.hpp @@ -7,20 +7,20 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace _internal { struct Messaging { - static Azure::Core::Amqp::Models::Value CreateSource(std::string const& address); - static Azure::Core::Amqp::Models::Value CreateTarget(std::string const& address); - static Azure::Core::Amqp::Models::Value DeliveryReceived( + static Azure::Core::Amqp::Models::AmqpValue CreateSource(std::string const& address); + static Azure::Core::Amqp::Models::AmqpValue CreateTarget(std::string const& address); + static Azure::Core::Amqp::Models::AmqpValue DeliveryReceived( uint32_t sectionNumber, uint64_t sectionOffset); - static Azure::Core::Amqp::Models::Value DeliveryAccepted(); - static Azure::Core::Amqp::Models::Value DeliveryRejected( + static Azure::Core::Amqp::Models::AmqpValue DeliveryAccepted(); + static Azure::Core::Amqp::Models::AmqpValue DeliveryRejected( std::string const& errorCondition, std::string const& errorDescription); - static Azure::Core::Amqp::Models::Value DeliveryReleased(); - static Azure::Core::Amqp::Models::Value DeliveryModified( + static Azure::Core::Amqp::Models::AmqpValue DeliveryReleased(); + static Azure::Core::Amqp::Models::AmqpValue DeliveryModified( bool deliveryFailed, bool undeliverableHere, - Azure::Core::Amqp::Models::Value annotations); + Azure::Core::Amqp::Models::AmqpValue annotations); }; }}}}} // namespace Azure::Core::Amqp::Models::_internal diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/connection_impl.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/connection_impl.hpp index c9529afe53e..90af402a706 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/connection_impl.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/connection_impl.hpp @@ -53,7 +53,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { void Close( std::string const& condition, std::string const& description, - Azure::Core::Amqp::Models::Value info); + Azure::Core::Amqp::Models::AmqpValue info); void Poll() const; @@ -66,8 +66,8 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { void SetIdleTimeout(std::chrono::milliseconds timeout); void SetRemoteIdleTimeoutEmptyFrameSendRatio(double idleTimeoutEmptyFrameSendRatio); - void SetProperties(Azure::Core::Amqp::Models::Value properties); - Azure::Core::Amqp::Models::Value GetProperties() const; + void SetProperties(Azure::Core::Amqp::Models::AmqpValue properties); + Azure::Core::Amqp::Models::AmqpValue GetProperties() const; uint64_t HandleDeadlines(); // ??? _internal::Endpoint CreateEndpoint(); void StartEndpoint(_internal::Endpoint const& endpoint); diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/link_impl.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/link_impl.hpp index 5c868c3db96..549bd9f59d5 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/link_impl.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/link_impl.hpp @@ -52,7 +52,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { uint64_t GetPeerMaxMessageSize() const; - void SetAttachProperties(Azure::Core::Amqp::Models::Value attachProperties); + void SetAttachProperties(Azure::Core::Amqp::Models::AmqpValue attachProperties); void SetMaxLinkCredit(uint32_t maxLinkCredit); std::string GetName() const; @@ -70,7 +70,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { bool close, std::string const& errorCondition, std::string const& errorDescription, - Azure::Core::Amqp::Models::Value& info); + Azure::Core::Amqp::Models::AmqpValue& info); private: LINK_HANDLE m_link; diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_receiver_impl.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_receiver_impl.hpp index 3737b60eeaf..5e32a3fee4d 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_receiver_impl.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_receiver_impl.hpp @@ -57,7 +57,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { void SendMessageDisposition( const char* linkName, uint32_t messageNumber, - Azure::Core::Amqp::Models::Value deliveryState); + Azure::Core::Amqp::Models::AmqpValue deliveryState); void SetTrace(bool traceEnabled); // Models::Message WaitForIncomingMessage(); @@ -92,7 +92,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { static AMQP_VALUE OnMessageReceivedFn(const void* context, MESSAGE_HANDLE message); - virtual Azure::Core::Amqp::Models::Value OnMessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message message); static void OnMessageReceiverStateChangedFn( diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_sender_impl.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_sender_impl.hpp index 40f7e6f3695..9bff4144b25 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_sender_impl.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/private/message_sender_impl.hpp @@ -49,7 +49,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { void Open(); void Close(); - std::tuple<_internal::MessageSendResult, Azure::Core::Amqp::Models::Value> Send( + std::tuple<_internal::MessageSendResult, Azure::Core::Amqp::Models::AmqpValue> Send( Azure::Core::Amqp::Models::Message const& message, Azure::Core::Context context); void SendAsync( diff --git a/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp b/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp index f6593c4aef8..bba17b56c79 100644 --- a/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp +++ b/sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp @@ -128,9 +128,9 @@ namespace Azure { namespace Core { namespace Amqp { LinkEndpoint& newLink, std::string const& name, SessionRole role, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value properties) + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue properties) = 0; }; diff --git a/sdk/core/azure-core-amqp/samples/local_server_sample/local_server_sample.cpp b/sdk/core/azure-core-amqp/samples/local_server_sample/local_server_sample.cpp index e13dedeab7c..3f2c0300b8a 100644 --- a/sdk/core/azure-core-amqp/samples/local_server_sample/local_server_sample.cpp +++ b/sdk/core/azure-core-amqp/samples/local_server_sample/local_server_sample.cpp @@ -161,7 +161,7 @@ class SampleEvents : public ConnectionEvents, virtual void OnEndpointFrameReceived( Connection const& connection, - Azure::Core::Amqp::Models::Value const& value, + Azure::Core::Amqp::Models::AmqpValue const& value, uint32_t framePayloadSize, uint8_t* payloadBytes) override { @@ -173,9 +173,9 @@ class SampleEvents : public ConnectionEvents, LinkEndpoint& newLink, std::string const& name, Azure::Core::Amqp::_internal::SessionRole, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value) override + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue) override { Azure::Core::Amqp::Models::_internal::MessageSource messageSource(source); Azure::Core::Amqp::Models::_internal::MessageTarget messageTarget(target); @@ -212,7 +212,7 @@ class SampleEvents : public ConnectionEvents, << " now: " << MessageStateToString(newState) << std::endl; (void)receiver; } - virtual Azure::Core::Amqp::Models::Value OnMessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message message) override { m_messageQueue.CompleteOperation(message); diff --git a/sdk/core/azure-core-amqp/src/amqp/connection.cpp b/sdk/core/azure-core-amqp/src/amqp/connection.cpp index a6c56c80cf9..d83a958edaf 100644 --- a/sdk/core/azure-core-amqp/src/amqp/connection.cpp +++ b/sdk/core/azure-core-amqp/src/amqp/connection.cpp @@ -58,7 +58,7 @@ namespace Azure { namespace Core { namespace Amqp { void Connection::Close( std::string const& condition, std::string const& description, - Azure::Core::Amqp::Models::Value value) + Azure::Core::Amqp::Models::AmqpValue value) { m_impl->Close(condition, description, value); } @@ -83,11 +83,11 @@ namespace Azure { namespace Core { namespace Amqp { return m_impl->SetRemoteIdleTimeoutEmptyFrameSendRatio(idleTimeoutEmptyFrameSendRatio); } - void Connection::SetProperties(Azure::Core::Amqp::Models::Value properties) + void Connection::SetProperties(Azure::Core::Amqp::Models::AmqpValue properties) { m_impl->SetProperties(properties); } - Azure::Core::Amqp::Models::Value Connection::GetProperties() const + Azure::Core::Amqp::Models::AmqpValue Connection::GetProperties() const { return m_impl->GetProperties(); } @@ -296,7 +296,7 @@ namespace Azure { namespace Core { namespace Amqp { void ConnectionImpl::Close( const std::string& condition, const std::string& description, - Azure::Core::Amqp::Models::Value info) + Azure::Core::Amqp::Models::AmqpValue info) { if (!m_connection) { @@ -365,14 +365,14 @@ namespace Azure { namespace Core { namespace Amqp { return std::chrono::milliseconds(ms); } - void ConnectionImpl::SetProperties(Azure::Core::Amqp::Models::Value value) + void ConnectionImpl::SetProperties(Azure::Core::Amqp::Models::AmqpValue value) { if (connection_set_properties(m_connection, value)) { throw std::runtime_error("COuld not set properties."); // LCOV_EXCL_LINE } } - Azure::Core::Amqp::Models::Value ConnectionImpl::GetProperties() const + Azure::Core::Amqp::Models::AmqpValue ConnectionImpl::GetProperties() const { AMQP_VALUE value; if (connection_get_properties(m_connection, &value)) diff --git a/sdk/core/azure-core-amqp/src/amqp/link.cpp b/sdk/core/azure-core-amqp/src/amqp/link.cpp index 7dcadab9d68..4883d04f2e1 100644 --- a/sdk/core/azure-core-amqp/src/amqp/link.cpp +++ b/sdk/core/azure-core-amqp/src/amqp/link.cpp @@ -68,7 +68,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { } uint64_t Link::GetMaxMessageSize() const { return m_impl->GetMaxMessageSize(); } uint64_t Link::GetPeerMaxMessageSize() const { return m_impl->GetPeerMaxMessageSize(); } - void Link::SetAttachProperties(Azure::Core::Amqp::Models::Value attachProperties) + void Link::SetAttachProperties(Azure::Core::Amqp::Models::AmqpValue attachProperties) { m_impl->SetAttachProperties(attachProperties); } @@ -83,7 +83,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { bool close, std::string const& errorCondition, std::string const& errorDescription, - Azure::Core::Amqp::Models::Value& info) + Azure::Core::Amqp::Models::AmqpValue& info) { return m_impl->Detach(close, errorCondition, errorDescription, info); } @@ -279,7 +279,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { throw std::runtime_error("Could not set initial delivery count."); // LCOV_EXCL_LINE } } - void LinkImpl::SetAttachProperties(Azure::Core::Amqp::Models::Value properties) + void LinkImpl::SetAttachProperties(Azure::Core::Amqp::Models::AmqpValue properties) { if (link_set_attach_properties(m_link, properties)) { @@ -305,7 +305,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail { bool close, std::string const& condition, std::string const& description, - Azure::Core::Amqp::Models::Value& info) + Azure::Core::Amqp::Models::AmqpValue& info) { if (link_detach( m_link, diff --git a/sdk/core/azure-core-amqp/src/amqp/message_receiver.cpp b/sdk/core/azure-core-amqp/src/amqp/message_receiver.cpp index 2792dfb02b5..9578625c7e3 100644 --- a/sdk/core/azure-core-amqp/src/amqp/message_receiver.cpp +++ b/sdk/core/azure-core-amqp/src/amqp/message_receiver.cpp @@ -188,7 +188,7 @@ namespace Azure { namespace Core { namespace Amqp { MessageReceiverImpl* receiver = static_cast(const_cast(context)); Azure::Core::Amqp::Models::Message incomingMessage(message); - Azure::Core::Amqp::Models::Value rv; + Azure::Core::Amqp::Models::AmqpValue rv; if (receiver->m_eventHandler) { rv = receiver->m_eventHandler->OnMessageReceived(incomingMessage); @@ -200,7 +200,7 @@ namespace Azure { namespace Core { namespace Amqp { return amqpvalue_clone(rv); } - Azure::Core::Amqp::Models::Value MessageReceiverImpl::OnMessageReceived( + Azure::Core::Amqp::Models::AmqpValue MessageReceiverImpl::OnMessageReceived( Azure::Core::Amqp::Models::Message message) { m_messageQueue.CompleteOperation(message); diff --git a/sdk/core/azure-core-amqp/src/amqp/message_sender.cpp b/sdk/core/azure-core-amqp/src/amqp/message_sender.cpp index acb89fe1262..4e51743995a 100644 --- a/sdk/core/azure-core-amqp/src/amqp/message_sender.cpp +++ b/sdk/core/azure-core-amqp/src/amqp/message_sender.cpp @@ -71,7 +71,7 @@ namespace Azure { namespace Core { namespace Amqp { void MessageSender::Open() { m_impl->Open(); } void MessageSender::Close() { m_impl->Close(); } - std::tuple MessageSender::Send( + std::tuple MessageSender::Send( Azure::Core::Amqp::Models::Message const& message, Azure::Core::Context context) { @@ -369,18 +369,18 @@ namespace Azure { namespace Core { namespace Amqp { (void)context; } - std::tuple MessageSenderImpl::Send( + std::tuple MessageSenderImpl::Send( Azure::Core::Amqp::Models::Message const& message, Azure::Core::Context context) { Azure::Core::Amqp::Common::_internal::AsyncOperationQueue< Azure::Core::Amqp::_internal::MessageSendResult, - Azure::Core::Amqp::Models::Value> + Azure::Core::Amqp::Models::AmqpValue> sendCompleteQueue; SendAsync( message, [&](Azure::Core::Amqp::_internal::MessageSendResult sendResult, - Azure::Core::Amqp::Models::Value deliveryStatus) { + Azure::Core::Amqp::Models::AmqpValue deliveryStatus) { // std::cout << "Send Complete!" << std::endl; sendCompleteQueue.CompleteOperation(sendResult, deliveryStatus); }, diff --git a/sdk/core/azure-core-amqp/src/models/amqp_message.cpp b/sdk/core/azure-core-amqp/src/models/amqp_message.cpp index da44d6a6734..fc52eb0a849 100644 --- a/sdk/core/azure-core-amqp/src/models/amqp_message.cpp +++ b/sdk/core/azure-core-amqp/src/models/amqp_message.cpp @@ -72,7 +72,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return header; } - void Message::SetFooter(Value const& header) + void Message::SetFooter(AmqpValue const& header) { if (message_set_footer(m_message, header)) { @@ -80,7 +80,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value const Message::GetFooter() const + AmqpValue const Message::GetFooter() const { annotations footer; if (message_get_footer(m_message, &footer)) @@ -90,14 +90,14 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return footer; } - void Message::SetDeliveryAnnotations(Value const& annotations) + void Message::SetDeliveryAnnotations(AmqpValue const& annotations) { if (message_set_delivery_annotations(m_message, annotations)) { throw std::runtime_error("Could not set delivery annotations"); // LCOV_EXCL_LINE } } - Value const Message::GetDeliveryAnnotations() const + AmqpValue const Message::GetDeliveryAnnotations() const { annotations value; if (message_get_delivery_annotations(m_message, &value)) @@ -122,14 +122,14 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return format; } - void Message::SetMessageAnnotations(Value const& annotations) + void Message::SetMessageAnnotations(AmqpValue const& annotations) { if (message_set_message_annotations(m_message, annotations)) { throw std::runtime_error("Could not set message annotations"); // LCOV_EXCL_LINE } } - Value const Message::GetMessageAnnotations() const + AmqpValue const Message::GetMessageAnnotations() const { message_annotations annotations; if (message_get_message_annotations(m_message, &annotations)) @@ -155,14 +155,14 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return properties; } - void Message::SetApplicationProperties(Value const& value) + void Message::SetApplicationProperties(AmqpValue const& value) { if (message_set_application_properties(m_message, value)) { throw std::runtime_error("Could not set application properties."); } } - Value const Message::GetApplicationProperties() const + AmqpValue const Message::GetApplicationProperties() const { AMQP_VALUE properties; if (message_get_application_properties(m_message, &properties)) @@ -203,7 +203,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return count; } - Value const Message::GetBodyAmqpSequence(uint32_t index) const + AmqpValue const Message::GetBodyAmqpSequence(uint32_t index) const { AMQP_VALUE value; if (message_get_body_amqp_sequence_in_place(m_message, index, &value)) @@ -213,7 +213,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return amqpvalue_clone(value); } - void Message::AddBodyAmqpSequence(Value const& value) + void Message::AddBodyAmqpSequence(AmqpValue const& value) { if (message_add_body_amqp_sequence(m_message, value)) { @@ -221,12 +221,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Message::GetBodyAmqpValue() const + AmqpValue Message::GetBodyAmqpValue() const { AMQP_VALUE value; if (message_get_body_amqp_value_in_place(m_message, &value)) { - throw std::runtime_error("Could not get Body Value."); // LCOV_EXCL_LINE + throw std::runtime_error("Could not get Body AmqpValue."); // LCOV_EXCL_LINE } return amqpvalue_clone(value); } @@ -261,7 +261,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return count; } - void Message::SetBodyAmqpValue(Value value) + void Message::SetBodyAmqpValue(AmqpValue value) { if (message_set_body_amqp_value(m_message, value)) { @@ -319,7 +319,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { os << "]"; break; case MessageBodyType::Value: - os << "Value: " << message.GetBodyAmqpValue(); + os << "AmqpValue: " << message.GetBodyAmqpValue(); break; } os << "]"; diff --git a/sdk/core/azure-core-amqp/src/models/amqp_properties.cpp b/sdk/core/azure-core-amqp/src/models/amqp_properties.cpp index 145c55d84e9..cb76f4af8b9 100644 --- a/sdk/core/azure-core-amqp/src/models/amqp_properties.cpp +++ b/sdk/core/azure-core-amqp/src/models/amqp_properties.cpp @@ -30,7 +30,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Properties::GetMessageId() const + AmqpValue Properties::GetMessageId() const { AMQP_VALUE value; if (properties_get_message_id(m_properties, &value)) @@ -40,7 +40,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return amqpvalue_clone(value); } - void Properties::SetMessageId(Value const& messageId) + void Properties::SetMessageId(AmqpValue const& messageId) { if (properties_set_message_id(m_properties, messageId)) { @@ -48,18 +48,18 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Properties::GetCorrelationId() const + AmqpValue Properties::GetCorrelationId() const { AMQP_VALUE value; if (properties_get_correlation_id(m_properties, &value)) { - return Value(); + return AmqpValue(); } // properties_get_correlation_id returns an in-place value. return amqpvalue_clone(value); } - void Properties::SetCorrelationId(Value const& correlationId) + void Properties::SetCorrelationId(AmqpValue const& correlationId) { if (properties_set_correlation_id(m_properties, correlationId)) { @@ -86,7 +86,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Properties::GetTo() const + AmqpValue Properties::GetTo() const { AMQP_VALUE value; if (properties_get_to(m_properties, &value)) @@ -96,7 +96,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return amqpvalue_clone(value); } - void Properties::SetTo(Value replyTo) + void Properties::SetTo(AmqpValue replyTo) { if (properties_set_to(m_properties, replyTo)) { @@ -122,7 +122,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Properties::GetReplyTo() const + AmqpValue Properties::GetReplyTo() const { AMQP_VALUE value; if (properties_get_reply_to(m_properties, &value)) @@ -132,7 +132,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return amqpvalue_clone(value); } - void Properties::SetReplyTo(Value replyTo) + void Properties::SetReplyTo(AmqpValue replyTo) { if (properties_set_reply_to(m_properties, replyTo)) { @@ -311,15 +311,15 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } { - AMQP_VALUE value; // Value is returned in-place, so doesn't need to be freed. + AMQP_VALUE value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_to(properties.m_properties, &value)) { - os << ", To: " << Value(value); + os << ", To: " << AmqpValue(value); } } { - const char* value; // Value is returned in-place, so doesn't need to be freed. + const char* value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_subject(properties.m_properties, &value)) { os << ", Subject: " << value; @@ -327,22 +327,22 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } { - AMQP_VALUE value; // Value is returned in-place, so doesn't need to be freed. + AMQP_VALUE value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_reply_to(properties.m_properties, &value)) { - os << ", ReplyTo: " << Value(value); + os << ", ReplyTo: " << AmqpValue(value); } } { - AMQP_VALUE value; // Value is returned in-place, so doesn't need to be freed. + AMQP_VALUE value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_correlation_id(properties.m_properties, &value)) { - os << ", CorrelationId: " << Value(value); + os << ", CorrelationId: " << AmqpValue(value); } } { - const char* value; // Value is returned in-place, so doesn't need to be freed. + const char* value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_content_type(properties.m_properties, &value)) { os << ", ContentType: " << value; @@ -350,7 +350,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } { - const char* value; // Value is returned in-place, so doesn't need to be freed. + const char* value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_content_encoding(properties.m_properties, &value)) { os << ", ContentEncoding: " << value; @@ -378,7 +378,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } { - const char* value; // Value is returned in-place, so doesn't need to be freed. + const char* value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_group_id(properties.m_properties, &value)) { os << ", GroupId: " << value; @@ -395,7 +395,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } { - const char* value; // Value is returned in-place, so doesn't need to be freed. + const char* value; // AmqpValue is returned in-place, so doesn't need to be freed. if (!properties_get_reply_to_group_id(properties.m_properties, &value)) { os << ", " diff --git a/sdk/core/azure-core-amqp/src/models/amqp_value.cpp b/sdk/core/azure-core-amqp/src/models/amqp_value.cpp index d95506f2a81..fd05759a846 100644 --- a/sdk/core/azure-core-amqp/src/models/amqp_value.cpp +++ b/sdk/core/azure-core-amqp/src/models/amqp_value.cpp @@ -19,45 +19,45 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { - Value::~Value() + AmqpValue::~AmqpValue() { if (m_value) { amqpvalue_destroy(m_value); } } - Value::Value(bool bool_value) : m_value{amqpvalue_create_boolean(bool_value)} {} - Value::Value(unsigned char byte_value) : m_value{amqpvalue_create_ubyte(byte_value)} {} - Value::Value(char value) : m_value{amqpvalue_create_byte(value)} {} - Value::Value(uint16_t value) : m_value{amqpvalue_create_ushort(value)} {} - Value::Value(int16_t value) : m_value{amqpvalue_create_short(value)} {} - Value::Value(uint32_t value) : m_value{amqpvalue_create_uint(value)} {} - Value::Value(int32_t value) : m_value{amqpvalue_create_int(value)} {} - Value::Value(uint64_t value) : m_value{amqpvalue_create_ulong(value)} {} - Value::Value(int64_t value) : m_value{amqpvalue_create_long(value)} {} - Value::Value(float value) : m_value{amqpvalue_create_float(value)} {} - Value::Value(double value) : m_value{amqpvalue_create_double(value)} {} + AmqpValue::AmqpValue(bool bool_value) : m_value{amqpvalue_create_boolean(bool_value)} {} + AmqpValue::AmqpValue(unsigned char byte_value) : m_value{amqpvalue_create_ubyte(byte_value)} {} + AmqpValue::AmqpValue(char value) : m_value{amqpvalue_create_byte(value)} {} + AmqpValue::AmqpValue(uint16_t value) : m_value{amqpvalue_create_ushort(value)} {} + AmqpValue::AmqpValue(int16_t value) : m_value{amqpvalue_create_short(value)} {} + AmqpValue::AmqpValue(uint32_t value) : m_value{amqpvalue_create_uint(value)} {} + AmqpValue::AmqpValue(int32_t value) : m_value{amqpvalue_create_int(value)} {} + AmqpValue::AmqpValue(uint64_t value) : m_value{amqpvalue_create_ulong(value)} {} + AmqpValue::AmqpValue(int64_t value) : m_value{amqpvalue_create_long(value)} {} + AmqpValue::AmqpValue(float value) : m_value{amqpvalue_create_float(value)} {} + AmqpValue::AmqpValue(double value) : m_value{amqpvalue_create_double(value)} {} /* ???? */ // AMQPValue(uint32_t value) : m_value{amqpvalue_create_char(value)} {} // AMQPValue(timestamp value) : m_value{amqpvalue_create_timestamp(value)} {} // AMQPValue(std::string const& value) : m_value{amqpvalue_create_symbol(value.c_str())} {} - Value::Value(Uuid value) : m_value{amqpvalue_create_uuid(value.data())} {} - Value::Value(BinaryData value) + AmqpValue::AmqpValue(Uuid value) : m_value{amqpvalue_create_uuid(value.data())} {} + AmqpValue::AmqpValue(BinaryData value) { amqp_binary amqpValue; amqpValue.bytes = value.bytes; amqpValue.length = static_cast(value.length); m_value = amqpvalue_create_binary(amqpValue); } - Value::Value(std::string value) : m_value{amqpvalue_create_string(value.c_str())} {} - Value::Value(const char* value) : m_value{amqpvalue_create_string(value)} {} + AmqpValue::AmqpValue(std::string value) : m_value{amqpvalue_create_string(value.c_str())} {} + AmqpValue::AmqpValue(const char* value) : m_value{amqpvalue_create_string(value)} {} - Value::Value() : m_value{amqpvalue_create_null()} {} - Value::Value(Value const& that) throw() : m_value{amqpvalue_clone(that.m_value)} {} - Value::Value(Value&& that) throw() : m_value{that.m_value} { that.m_value = nullptr; } - Value::Value(AMQP_VALUE_DATA_TAG* value) + AmqpValue::AmqpValue() : m_value{amqpvalue_create_null()} {} + AmqpValue::AmqpValue(AmqpValue const& that) throw() : m_value{amqpvalue_clone(that.m_value)} {} + AmqpValue::AmqpValue(AmqpValue&& that) throw() : m_value{that.m_value} { that.m_value = nullptr; } + AmqpValue::AmqpValue(AMQP_VALUE_DATA_TAG* value) { // We shouldn't take ownership of the incoming value, so instead we clone it. // if no value is provided, treat it as null. @@ -71,21 +71,21 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value::operator AMQP_VALUE_DATA_TAG*() const { return m_value; } + AmqpValue::operator AMQP_VALUE_DATA_TAG*() const { return m_value; } - Value& Value::operator=(Value const& that) + AmqpValue& AmqpValue::operator=(AmqpValue const& that) { m_value = amqpvalue_clone(that.m_value); return *this; } - Value& Value::operator=(Value&& that) throw() + AmqpValue& AmqpValue::operator=(AmqpValue&& that) throw() { m_value = that.m_value; that.m_value = nullptr; return *this; } - Value::operator bool() const + AmqpValue::operator bool() const { bool value; if (amqpvalue_get_boolean(m_value, &value) != 0) @@ -94,7 +94,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator bool() + AmqpValue::operator bool() { bool value; if (amqpvalue_get_boolean(m_value, &value) != 0) @@ -103,7 +103,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator unsigned char() const + AmqpValue::operator unsigned char() const { unsigned char value; if (amqpvalue_get_ubyte(m_value, &value) != 0) @@ -112,7 +112,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator unsigned char() + AmqpValue::operator unsigned char() { unsigned char value; if (amqpvalue_get_ubyte(m_value, &value) != 0) @@ -121,7 +121,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator char() const + AmqpValue::operator char() const { char value; if (amqpvalue_get_byte(m_value, &value) != 0) @@ -130,7 +130,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator char() + AmqpValue::operator char() { char value; if (amqpvalue_get_byte(m_value, &value) != 0) @@ -139,7 +139,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint16_t() const + AmqpValue::operator uint16_t() const { uint16_t value; if (amqpvalue_get_ushort(m_value, &value) != 0) @@ -148,7 +148,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint16_t() + AmqpValue::operator uint16_t() { uint16_t value; if (amqpvalue_get_ushort(m_value, &value) != 0) @@ -157,7 +157,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int16_t() const + AmqpValue::operator int16_t() const { int16_t value; if (amqpvalue_get_short(m_value, &value) != 0) @@ -166,7 +166,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int16_t() + AmqpValue::operator int16_t() { int16_t value; if (amqpvalue_get_short(m_value, &value) != 0) @@ -175,7 +175,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint32_t() const + AmqpValue::operator uint32_t() const { uint32_t value; if (amqpvalue_get_uint(m_value, &value) != 0) @@ -184,7 +184,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint32_t() + AmqpValue::operator uint32_t() { uint32_t value; if (amqpvalue_get_uint(m_value, &value) != 0) @@ -193,7 +193,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int32_t() const + AmqpValue::operator int32_t() const { int32_t value; if (amqpvalue_get_int(m_value, &value) != 0) @@ -202,7 +202,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int32_t() + AmqpValue::operator int32_t() { int32_t value; if (amqpvalue_get_int(m_value, &value) != 0) @@ -211,7 +211,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint64_t() const + AmqpValue::operator uint64_t() const { uint64_t value; if (amqpvalue_get_ulong(m_value, &value) != 0) @@ -220,7 +220,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator uint64_t() + AmqpValue::operator uint64_t() { uint64_t value; if (amqpvalue_get_ulong(m_value, &value) != 0) @@ -229,7 +229,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int64_t() const + AmqpValue::operator int64_t() const { int64_t value; if (amqpvalue_get_long(m_value, &value) != 0) @@ -238,7 +238,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator int64_t() + AmqpValue::operator int64_t() { int64_t value; if (amqpvalue_get_long(m_value, &value)) @@ -247,7 +247,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator float() const + AmqpValue::operator float() const { float value; if (amqpvalue_get_float(m_value, &value)) @@ -256,7 +256,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator float() + AmqpValue::operator float() { float value; if (amqpvalue_get_float(m_value, &value)) @@ -265,7 +265,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator double() const + AmqpValue::operator double() const { double value; if (amqpvalue_get_double(m_value, &value)) @@ -274,7 +274,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator double() + AmqpValue::operator double() { double value; if (amqpvalue_get_double(m_value, &value)) @@ -283,7 +283,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator BinaryData() const + AmqpValue::operator BinaryData() const { amqp_binary value; if (amqpvalue_get_binary(m_value, &value)) @@ -295,7 +295,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { rv.length = value.length; return rv; } - Value::operator BinaryData() + AmqpValue::operator BinaryData() { amqp_binary value; if (amqpvalue_get_binary(m_value, &value)) @@ -308,7 +308,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return rv; } - Value::operator std::string() const + AmqpValue::operator std::string() const { const char* value; if (amqpvalue_get_string(m_value, &value)) @@ -317,7 +317,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return value; } - Value::operator std::string() + AmqpValue::operator std::string() { const char* value; if (amqpvalue_get_string(m_value, &value)) @@ -327,20 +327,20 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return value; } - bool Value::operator==(Value const& that) const + bool AmqpValue::operator==(AmqpValue const& that) const { return amqpvalue_are_equal(m_value, that.m_value); } - Value Value::CreateList() { return Value(amqpvalue_create_list()); } - void Value::SetListItemCount(uint32_t count) + AmqpValue AmqpValue::CreateList() { return AmqpValue(amqpvalue_create_list()); } + void AmqpValue::SetListItemCount(uint32_t count) { if (amqpvalue_set_list_item_count(m_value, count)) { throw std::runtime_error("Could not set List item count"); } } - uint32_t Value::GetListItemCount() const + uint32_t AmqpValue::GetListItemCount() const { uint32_t count; if (amqpvalue_get_list_item_count(m_value, &count) != 0) @@ -349,21 +349,21 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return count; } - void Value::SetListItem(uint32_t index, Value item) + void AmqpValue::SetListItem(uint32_t index, AmqpValue item) { if (amqpvalue_set_list_item(m_value, index, item)) { throw std::runtime_error("Could not set List item count"); } } - Value Value::GetListItem(size_t index) const + AmqpValue AmqpValue::GetListItem(size_t index) const { AMQP_VALUE item = amqpvalue_get_list_item(m_value, index); return item; } // AMQPValue AMQPValue::GetListItemInPlace(size_t index) const { return AMQPValue(); } - Value Value::CreateMap() { return Value(amqpvalue_create_map()); } - void Value::SetMapValue(Value key, Value value) + AmqpValue AmqpValue::CreateMap() { return AmqpValue(amqpvalue_create_map()); } + void AmqpValue::SetMapValue(AmqpValue key, AmqpValue value) { if (amqpvalue_set_map_value(m_value, key, value)) { @@ -371,8 +371,8 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Value::GetMapValue(Value key) const { return amqpvalue_get_map_value(m_value, key); } - std::pair Value::GetMapKeyAndValue(uint32_t index) const + AmqpValue AmqpValue::GetMapValue(AmqpValue key) const { return amqpvalue_get_map_value(m_value, key); } + std::pair AmqpValue::GetMapKeyAndValue(uint32_t index) const { AMQP_VALUE key; AMQP_VALUE value; @@ -380,10 +380,10 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { { throw std::runtime_error("Could not set map value."); } - return std::make_pair(Value{key}, Value{value}); + return std::make_pair(AmqpValue{key}, AmqpValue{value}); } - size_t Value::GetMapValueCount() const + size_t AmqpValue::GetMapValueCount() const { uint32_t count; if (amqpvalue_get_map_pair_count(m_value, &count)) @@ -393,9 +393,9 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return count; } - Value Value::CreateArray() { return Value(amqpvalue_create_array()); } + AmqpValue AmqpValue::CreateArray() { return AmqpValue(amqpvalue_create_array()); } - void Value::AddArrayItem(Value itemValue) + void AmqpValue::AddArrayItem(AmqpValue itemValue) { if (amqpvalue_add_array_item(m_value, itemValue)) { @@ -403,12 +403,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } } - Value Value::GetArrayItem(uint32_t index) const + AmqpValue AmqpValue::GetArrayItem(uint32_t index) const { return amqpvalue_get_array_item(m_value, index); } - uint32_t Value::GetArrayItemCount() const + uint32_t AmqpValue::GetArrayItemCount() const { uint32_t count; if (amqpvalue_get_array_item_count(m_value, &count)) @@ -418,9 +418,9 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return count; } - Value Value::CreateChar(uint32_t value) { return amqpvalue_create_char(value); } + AmqpValue AmqpValue::CreateChar(uint32_t value) { return amqpvalue_create_char(value); } - uint32_t Value::GetChar() const + uint32_t AmqpValue::GetChar() const { uint32_t value; if (amqpvalue_get_char(m_value, &value)) @@ -430,12 +430,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return value; } - Value Value::CreateTimestamp(std::chrono::milliseconds value) + AmqpValue AmqpValue::CreateTimestamp(std::chrono::milliseconds value) { return amqpvalue_create_timestamp(value.count()); } - std::chrono::milliseconds Value::GetTimestamp() const + std::chrono::milliseconds AmqpValue::GetTimestamp() const { int64_t ms; if (amqpvalue_get_timestamp(m_value, &ms)) @@ -445,11 +445,11 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return std::chrono::milliseconds(ms); } - Value Value::CreateSymbol(std::string const& value) + AmqpValue AmqpValue::CreateSymbol(std::string const& value) { return amqpvalue_create_symbol(value.c_str()); } - std::string Value::GetSymbol() const + std::string AmqpValue::GetSymbol() const { const char* symbol; if (amqpvalue_get_symbol(m_value, &symbol)) @@ -459,7 +459,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return symbol; } - AmqpValueType Value::GetType() const + AmqpValueType AmqpValue::GetType() const { switch (amqpvalue_get_type(m_value)) { @@ -514,26 +514,26 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { case AMQP_TYPE_UNKNOWN: return AmqpValueType::Unknown; } - throw std::runtime_error("Unknown AMQP Value Type"); + throw std::runtime_error("Unknown AMQP AmqpValue Type"); } - Value Value::CreateComposite(Value descriptor, uint32_t listSize) + AmqpValue AmqpValue::CreateComposite(AmqpValue descriptor, uint32_t listSize) { return amqpvalue_create_composite(descriptor, listSize); } - void Value::SetCompositeItem(uint32_t index, Value itemValue) + void AmqpValue::SetCompositeItem(uint32_t index, AmqpValue itemValue) { if (amqpvalue_set_composite_item(m_value, index, itemValue)) { throw std::runtime_error("Could not set composite item"); } } - Value Value::GetCompositeItem(uint32_t index) + AmqpValue AmqpValue::GetCompositeItem(uint32_t index) { return amqpvalue_get_composite_item(m_value, index); } // AMQPValue AMQPValue::GetCompositeItemInPlace(size_t index) const { return AMQPValue(); } - size_t Value::GetCompositeItemCount() const + size_t AmqpValue::GetCompositeItemCount() const { uint32_t size; if (amqpvalue_get_composite_item_count(m_value, &size)) @@ -542,23 +542,23 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return size; } - Value Value::CreateDescribed(Value descriptor, Value value) + AmqpValue AmqpValue::CreateDescribed(AmqpValue descriptor, AmqpValue value) { // amqpvalue_create_described takes a reference to the input parameters, we need to stabilize // the value of descriptor and value so they don't get accidentally freed. return amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(value)); } - Value Value::GetDescriptor() const { return amqpvalue_get_inplace_descriptor(m_value); } + AmqpValue AmqpValue::GetDescriptor() const { return amqpvalue_get_inplace_descriptor(m_value); } - Value Value::GetDescribedValue() const { return amqpvalue_get_inplace_described_value(m_value); } + AmqpValue AmqpValue::GetDescribedValue() const { return amqpvalue_get_inplace_described_value(m_value); } - Value Value::CreateCompositeWithDescriptor(uint64_t descriptor) + AmqpValue AmqpValue::CreateCompositeWithDescriptor(uint64_t descriptor) { return amqpvalue_create_composite_with_ulong_descriptor(descriptor); } - bool Value::IsHeaderTypeByDescriptor() const { return is_header_type_by_descriptor(m_value); } - Header Value::GetHeaderFromValue() const + bool AmqpValue::IsHeaderTypeByDescriptor() const { return is_header_type_by_descriptor(m_value); } + Header AmqpValue::GetHeaderFromValue() const { HEADER_HANDLE header; if (amqpvalue_get_header(m_value, &header)) @@ -567,14 +567,14 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { } return header; } - Value Value::CreateHeader(Header const& header) { return amqpvalue_create_header(header); } + AmqpValue AmqpValue::CreateHeader(Header const& header) { return amqpvalue_create_header(header); } - bool Value::IsPropertiesTypeByDescriptor() const + bool AmqpValue::IsPropertiesTypeByDescriptor() const { return is_properties_type_by_descriptor(m_value); } - Properties Value::GetPropertiesFromValue() const + Properties AmqpValue::GetPropertiesFromValue() const { PROPERTIES_HANDLE properties; if (amqpvalue_get_properties(m_value, &properties)) @@ -584,12 +584,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return properties; } - Value Value::CreateProperties(Properties const& properties) + AmqpValue AmqpValue::CreateProperties(Properties const& properties) { return amqpvalue_create_properties(properties); } - std::ostream& operator<<(std::ostream& os, Value const& value) + std::ostream& operator<<(std::ostream& os, AmqpValue const& value) { char* valueAsString = amqpvalue_to_string(value); os << valueAsString; @@ -662,7 +662,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { return os; } - bool Value::IsNull() const + bool AmqpValue::IsNull() const { return (m_value == nullptr) || (amqpvalue_get_type(m_value) == AMQP_TYPE_NULL); } diff --git a/sdk/core/azure-core-amqp/src/models/message_source.cpp b/sdk/core/azure-core-amqp/src/models/message_source.cpp index 4877eed7803..d2e66f08905 100644 --- a/sdk/core/azure-core-amqp/src/models/message_source.cpp +++ b/sdk/core/azure-core-amqp/src/models/message_source.cpp @@ -18,7 +18,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace MessageSource::MessageSource(SOURCE_HANDLE handle) : m_source{handle} {} - MessageSource::MessageSource(Azure::Core::Amqp::Models::Value const& source) + MessageSource::MessageSource(Azure::Core::Amqp::Models::AmqpValue const& source) { if (source.IsNull()) { @@ -67,12 +67,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } // Convert the MessageSource into a Value. - MessageSource::operator const Azure::Core::Amqp::Models::Value() const + MessageSource::operator const Azure::Core::Amqp::Models::AmqpValue() const { return amqpvalue_create_source(m_source); } - Azure::Core::Amqp::Models::Value MessageSource::GetAddress() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetAddress() const { AMQP_VALUE address; if (source_get_address(m_source, &address)) @@ -81,7 +81,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return address; } - void MessageSource::SetAddress(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetAddress(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_address(m_source, value)) { @@ -220,7 +220,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageSource::GetDynamicNodeProperties() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetDynamicNodeProperties() const { AMQP_VALUE value; if (source_get_dynamic_node_properties(m_source, &value)) @@ -229,7 +229,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageSource::SetDynamicNodeProperties(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetDynamicNodeProperties(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_dynamic_node_properties(m_source, value)) { @@ -254,7 +254,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageSource::GetFilter() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetFilter() const { AMQP_VALUE value; if (source_get_filter(m_source, &value)) @@ -263,7 +263,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageSource::SetFilter(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetFilter(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_filter(m_source, value)) { @@ -271,7 +271,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageSource::GetDefaultOutcome() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetDefaultOutcome() const { AMQP_VALUE value; if (source_get_default_outcome(m_source, &value)) @@ -280,7 +280,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageSource::SetDefaultOutcome(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetDefaultOutcome(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_default_outcome(m_source, value)) { @@ -288,7 +288,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageSource::GetOutcomes() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetOutcomes() const { AMQP_VALUE value; if (source_get_outcomes(m_source, &value)) @@ -297,7 +297,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageSource::SetOutcomes(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetOutcomes(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_outcomes(m_source, value)) { @@ -305,7 +305,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageSource::GetCapabilities() const + Azure::Core::Amqp::Models::AmqpValue MessageSource::GetCapabilities() const { AMQP_VALUE value; if (source_get_capabilities(m_source, &value)) @@ -314,7 +314,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageSource::SetCapabilities(Azure::Core::Amqp::Models::Value const& value) + void MessageSource::SetCapabilities(Azure::Core::Amqp::Models::AmqpValue const& value) { if (source_set_capabilities(m_source, value)) { diff --git a/sdk/core/azure-core-amqp/src/models/message_target.cpp b/sdk/core/azure-core-amqp/src/models/message_target.cpp index 996c30685ef..1455c93cc49 100644 --- a/sdk/core/azure-core-amqp/src/models/message_target.cpp +++ b/sdk/core/azure-core-amqp/src/models/message_target.cpp @@ -18,7 +18,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace MessageTarget::MessageTarget(TARGET_HANDLE handle) : m_target{handle} {} - MessageTarget::MessageTarget(Azure::Core::Amqp::Models::Value const& source) + MessageTarget::MessageTarget(Azure::Core::Amqp::Models::AmqpValue const& source) { if (source.IsNull()) { @@ -67,12 +67,12 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } // Convert the MessageSource into a Value. - MessageTarget::operator const Azure::Core::Amqp::Models::Value() const + MessageTarget::operator const Azure::Core::Amqp::Models::AmqpValue() const { return amqpvalue_create_target(m_target); } - Azure::Core::Amqp::Models::Value MessageTarget::GetAddress() const + Azure::Core::Amqp::Models::AmqpValue MessageTarget::GetAddress() const { AMQP_VALUE address; if (target_get_address(m_target, &address)) @@ -81,7 +81,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return address; } - void MessageTarget::SetAddress(Azure::Core::Amqp::Models::Value const& value) + void MessageTarget::SetAddress(Azure::Core::Amqp::Models::AmqpValue const& value) { if (target_set_address(m_target, value)) { @@ -221,7 +221,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageTarget::GetDynamicNodeProperties() const + Azure::Core::Amqp::Models::AmqpValue MessageTarget::GetDynamicNodeProperties() const { AMQP_VALUE value; if (target_get_dynamic_node_properties(m_target, &value)) @@ -230,7 +230,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageTarget::SetDynamicNodeProperties(Azure::Core::Amqp::Models::Value const& value) + void MessageTarget::SetDynamicNodeProperties(Azure::Core::Amqp::Models::AmqpValue const& value) { if (target_set_dynamic_node_properties(m_target, value)) { @@ -238,7 +238,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } } - Azure::Core::Amqp::Models::Value MessageTarget::GetCapabilities() const + Azure::Core::Amqp::Models::AmqpValue MessageTarget::GetCapabilities() const { AMQP_VALUE value; if (target_get_capabilities(m_target, &value)) @@ -247,7 +247,7 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace } return value; } - void MessageTarget::SetCapabilities(Azure::Core::Amqp::Models::Value const& value) + void MessageTarget::SetCapabilities(Azure::Core::Amqp::Models::AmqpValue const& value) { if (target_set_capabilities(m_target, value)) { diff --git a/sdk/core/azure-core-amqp/src/models/messaging_values.cpp b/sdk/core/azure-core-amqp/src/models/messaging_values.cpp index d9e9643670c..f7b23a60b4b 100644 --- a/sdk/core/azure-core-amqp/src/models/messaging_values.cpp +++ b/sdk/core/azure-core-amqp/src/models/messaging_values.cpp @@ -7,21 +7,21 @@ #include /* Common Message values */ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace _internal { - Azure::Core::Amqp::Models::Value Messaging::DeliveryAccepted() + Azure::Core::Amqp::Models::AmqpValue Messaging::DeliveryAccepted() { return messaging_delivery_accepted(); } - Azure::Core::Amqp::Models::Value Messaging::DeliveryReleased() + Azure::Core::Amqp::Models::AmqpValue Messaging::DeliveryReleased() { return messaging_delivery_released(); } - Azure::Core::Amqp::Models::Value Messaging::DeliveryReceived( + Azure::Core::Amqp::Models::AmqpValue Messaging::DeliveryReceived( uint32_t sectionNumber, uint64_t sectionOffset) { return messaging_delivery_received(sectionNumber, sectionOffset); } - Azure::Core::Amqp::Models::Value Messaging::DeliveryRejected( + Azure::Core::Amqp::Models::AmqpValue Messaging::DeliveryRejected( std::string const& errorCondition, std::string const& errorDescription) { @@ -29,19 +29,19 @@ namespace Azure { namespace Core { namespace Amqp { namespace Models { namespace errorCondition.empty() ? nullptr : errorCondition.c_str(), errorDescription.empty() ? nullptr : errorDescription.c_str()); } - Azure::Core::Amqp::Models::Value Messaging::DeliveryModified( + Azure::Core::Amqp::Models::AmqpValue Messaging::DeliveryModified( bool deliveryFailed, bool undeliverableHere, - Azure::Core::Amqp::Models::Value annotations) + Azure::Core::Amqp::Models::AmqpValue annotations) { return messaging_delivery_modified(deliveryFailed, undeliverableHere, annotations); } - Azure::Core::Amqp::Models::Value Messaging::CreateSource(std::string const& address) + Azure::Core::Amqp::Models::AmqpValue Messaging::CreateSource(std::string const& address) { return messaging_create_source(address.c_str()); } - Azure::Core::Amqp::Models::Value Messaging::CreateTarget(std::string const& address) + Azure::Core::Amqp::Models::AmqpValue Messaging::CreateTarget(std::string const& address) { return messaging_create_target(address.c_str()); } diff --git a/sdk/core/azure-core-amqp/test/ut/amqp_message_tests.cpp b/sdk/core/azure-core-amqp/test/ut/amqp_message_tests.cpp index ba263ec0445..d715d1d1642 100644 --- a/sdk/core/azure-core-amqp/test/ut/amqp_message_tests.cpp +++ b/sdk/core/azure-core-amqp/test/ut/amqp_message_tests.cpp @@ -58,7 +58,7 @@ TEST_F(TestMessage, TestApplicationProperties) Message message; Properties properties; properties.SetSubject("Message subject."); - message.SetApplicationProperties(Value::CreateProperties(properties)); + message.SetApplicationProperties(AmqpValue::CreateProperties(properties)); auto propertiesAsValue{message.GetApplicationProperties()}; // EXPECT_TRUE(propertiesAsValue.IsPropertiesTypeByDescriptor()); @@ -138,7 +138,7 @@ TEST_F(TestMessage, TestBodyAmqpSequence) message.AddBodyAmqpSequence("Test"); message.AddBodyAmqpSequence(static_cast(95)); - message.AddBodyAmqpSequence(Value::CreateProperties(Properties())); + message.AddBodyAmqpSequence(AmqpValue::CreateProperties(Properties())); EXPECT_EQ(3, message.GetBodyAmqpSequenceCount()); EXPECT_EQ("Test", static_cast(message.GetBodyAmqpSequence(0))); diff --git a/sdk/core/azure-core-amqp/test/ut/amqp_properties_tests.cpp b/sdk/core/azure-core-amqp/test/ut/amqp_properties_tests.cpp index afb164a3788..a09b1d5594a 100644 --- a/sdk/core/azure-core-amqp/test/ut/amqp_properties_tests.cpp +++ b/sdk/core/azure-core-amqp/test/ut/amqp_properties_tests.cpp @@ -77,8 +77,8 @@ TEST_F(TestProperties, SetCorrelationId) { Properties properties; std::string correlationId = "1234"; - properties.SetCorrelationId(Value{correlationId}); - EXPECT_EQ(properties.GetCorrelationId(), Value{correlationId}); + properties.SetCorrelationId(AmqpValue{correlationId}); + EXPECT_EQ(properties.GetCorrelationId(), AmqpValue{correlationId}); GTEST_LOG_(INFO) << properties; } @@ -119,8 +119,8 @@ TEST_F(TestProperties, SetMessageId) { Properties properties; std::string messageId = "1234"; - properties.SetMessageId(Value{messageId}); - EXPECT_EQ(properties.GetMessageId(), Value{messageId}); + properties.SetMessageId(AmqpValue{messageId}); + EXPECT_EQ(properties.GetMessageId(), AmqpValue{messageId}); GTEST_LOG_(INFO) << properties; } @@ -128,8 +128,8 @@ TEST_F(TestProperties, SetReplyTo) { Properties properties; std::string replyTo = "1234"; - properties.SetReplyTo(Value{replyTo}); - EXPECT_EQ(properties.GetReplyTo(), Value{replyTo}); + properties.SetReplyTo(AmqpValue{replyTo}); + EXPECT_EQ(properties.GetReplyTo(), AmqpValue{replyTo}); GTEST_LOG_(INFO) << properties; } @@ -146,8 +146,8 @@ TEST_F(TestProperties, SetTo) { Properties properties; std::string to = "1234"; - properties.SetTo(Value{to}); - EXPECT_EQ(properties.GetTo(), Value{to}); + properties.SetTo(AmqpValue{to}); + EXPECT_EQ(properties.GetTo(), AmqpValue{to}); GTEST_LOG_(INFO) << properties; } diff --git a/sdk/core/azure-core-amqp/test/ut/amqp_value_tests.cpp b/sdk/core/azure-core-amqp/test/ut/amqp_value_tests.cpp index 71760c74cbe..5aaf450f49e 100644 --- a/sdk/core/azure-core-amqp/test/ut/amqp_value_tests.cpp +++ b/sdk/core/azure-core-amqp/test/ut/amqp_value_tests.cpp @@ -16,89 +16,89 @@ class TestValues : public testing::Test { TEST_F(TestValues, SimpleCreate) { { - Value value; + AmqpValue value; EXPECT_EQ(AmqpValueType::Null, value.GetType()); } { - Value value{true}; + AmqpValue value{true}; EXPECT_EQ(AmqpValueType::Bool, value.GetType()); EXPECT_TRUE(value); } { - Value value{false}; + AmqpValue value{false}; EXPECT_EQ(AmqpValueType::Bool, value.GetType()); EXPECT_FALSE(value); } { - Value value{}; + AmqpValue value{}; EXPECT_TRUE(value.IsNull()); } { - Value value{static_cast(255)}; + AmqpValue value{static_cast(255)}; EXPECT_EQ(AmqpValueType::UByte, value.GetType()); EXPECT_EQ(255, static_cast(value)); } { - Value value{'a'}; + AmqpValue value{'a'}; EXPECT_EQ(AmqpValueType::Byte, value.GetType()); EXPECT_EQ('a', static_cast(value)); } { - Value value{static_cast(65535)}; + AmqpValue value{static_cast(65535)}; EXPECT_EQ(AmqpValueType::UShort, value.GetType()); EXPECT_EQ(65535, static_cast(value)); } { - Value value{static_cast(32767)}; + AmqpValue value{static_cast(32767)}; EXPECT_EQ(AmqpValueType::Short, value.GetType()); EXPECT_EQ(32767, static_cast(value)); } { - Value value(32); + AmqpValue value(32); EXPECT_EQ(AmqpValueType::Int, value.GetType()); EXPECT_EQ(32, static_cast(value)); } { - Value value(static_cast(32ll)); + AmqpValue value(static_cast(32ll)); EXPECT_EQ(AmqpValueType::Long, value.GetType()); EXPECT_EQ(32ll, static_cast(value)); } { - Value value(static_cast(39ull)); + AmqpValue value(static_cast(39ull)); EXPECT_EQ(AmqpValueType::ULong, value.GetType()); EXPECT_EQ(39ull, static_cast(value)); } { - Value value(39.0f); + AmqpValue value(39.0f); EXPECT_EQ(AmqpValueType::Float, value.GetType()); EXPECT_EQ(39.0f, static_cast(value)); } { - Value value(39.0); + AmqpValue value(39.0); EXPECT_EQ(AmqpValueType::Double, value.GetType()); EXPECT_EQ(39.0, static_cast(value)); } { - Value value(39.0); + AmqpValue value(39.0); double d{value}; EXPECT_EQ(39.0, d); } { - Value value(std::string("Fred")); + AmqpValue value(std::string("Fred")); std::string fredP(value); EXPECT_EQ(AmqpValueType::String, value.GetType()); EXPECT_EQ(std::string("Fred"), fredP); } { - Value value("Fred"); + AmqpValue value("Fred"); std::string fredP(value); EXPECT_EQ(AmqpValueType::String, value.GetType()); EXPECT_EQ(std::string("Fred"), fredP); @@ -108,16 +108,16 @@ TEST_F(TestValues, SimpleCreate) TEST_F(TestValues, TestList) { { - Value list1{Value::CreateList()}; + AmqpValue list1{AmqpValue::CreateList()}; EXPECT_EQ(0, list1.GetListItemCount()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetListItemCount()); } // Put some things in the list. { - Value list1{Value::CreateList()}; + AmqpValue list1{AmqpValue::CreateList()}; list1.SetListItemCount(4); EXPECT_EQ(4, list1.GetListItemCount()); @@ -134,17 +134,17 @@ TEST_F(TestValues, TestList) TEST_F(TestValues, TestMap) { { - Value map1{Value::CreateMap()}; + AmqpValue map1{AmqpValue::CreateMap()}; EXPECT_EQ(0, map1.GetMapValueCount()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetMapValueCount()); } // Put some things in the map. { - Value map1{Value::CreateMap()}; + AmqpValue map1{AmqpValue::CreateMap()}; map1.SetMapValue("ABC", 5); map1.SetMapValue(3, "ABC"); EXPECT_EQ(2, map1.GetMapValueCount()); @@ -163,17 +163,17 @@ TEST_F(TestValues, TestMap) TEST_F(TestValues, TestArray) { { - Value value{Value::CreateArray()}; + AmqpValue value{AmqpValue::CreateArray()}; EXPECT_EQ(0, value.GetArrayItemCount()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetArrayItemCount()); } // Put some things in the map. { - Value val{Value::CreateArray()}; + AmqpValue val{AmqpValue::CreateArray()}; val.AddArrayItem("3"); // Array values must all have the same type. val.AddArrayItem("Foo"); val.AddArrayItem("George"); @@ -186,11 +186,11 @@ TEST_F(TestValues, TestArray) TEST_F(TestValues, TestChar) { { - Value value{Value::CreateChar(37)}; + AmqpValue value{AmqpValue::CreateChar(37)}; EXPECT_EQ(37, value.GetChar()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetChar()); } } @@ -200,11 +200,11 @@ TEST_F(TestValues, TestTimestamp) { std::chrono::milliseconds timeNow{std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch())}; - Value value{Value::CreateTimestamp(timeNow)}; + AmqpValue value{AmqpValue::CreateTimestamp(timeNow)}; EXPECT_EQ(timeNow, value.GetTimestamp()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetTimestamp()); } } @@ -212,11 +212,11 @@ TEST_F(TestValues, TestTimestamp) TEST_F(TestValues, TestSymbol) { { - Value value{Value::CreateSymbol("timeNow")}; + AmqpValue value{AmqpValue::CreateSymbol("timeNow")}; EXPECT_EQ("timeNow", value.GetSymbol()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetSymbol()); } } @@ -224,18 +224,18 @@ TEST_F(TestValues, TestSymbol) TEST_F(TestValues, TestCompositeValue) { { - Value value{Value::CreateComposite("My Composite Type", 5)}; + AmqpValue value{AmqpValue::CreateComposite("My Composite Type", 5)}; EXPECT_EQ(5, value.GetCompositeItemCount()); } { - Value boolValue{false}; + AmqpValue boolValue{false}; EXPECT_ANY_THROW(boolValue.GetCompositeItemCount()); } // Put some things in the map. { - Value val{Value::CreateComposite("CompType", 2)}; + AmqpValue val{AmqpValue::CreateComposite("CompType", 2)}; val.SetCompositeItem(0, 25); val.SetCompositeItem(1, 25.0f); @@ -243,14 +243,14 @@ TEST_F(TestValues, TestCompositeValue) EXPECT_EQ(25.0f, static_cast(val.GetCompositeItem(1))); } { - Value val{Value::CreateCompositeWithDescriptor(29)}; + AmqpValue val{AmqpValue::CreateCompositeWithDescriptor(29)}; } } TEST_F(TestValues, TestDescribed) { { - Value value{Value::CreateDescribed("My Composite Type", 5)}; + AmqpValue value{AmqpValue::CreateDescribed("My Composite Type", 5)}; } } @@ -259,7 +259,7 @@ TEST_F(TestValues, ValuesFromHeader) Header header; header.IsDurable(true); header.SetTimeToLive(std::chrono::milliseconds(512)); - Value headerValue{Value::CreateHeader(header)}; + AmqpValue headerValue{AmqpValue::CreateHeader(header)}; EXPECT_TRUE(header.IsDurable()); diff --git a/sdk/core/azure-core-amqp/test/ut/connection_tests.cpp b/sdk/core/azure-core-amqp/test/ut/connection_tests.cpp index 585d73458fa..4ae3fea8f57 100644 --- a/sdk/core/azure-core-amqp/test/ut/connection_tests.cpp +++ b/sdk/core/azure-core-amqp/test/ut/connection_tests.cpp @@ -224,9 +224,9 @@ class TestSocketListenerEvents : public Azure::Core::Amqp::_internal::SessionEve Azure::Core::Amqp::_internal::LinkEndpoint& newLinkInstance, std::string const& name, Azure::Core::Amqp::_internal::SessionRole, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value) override + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue) override { Azure::Core::Amqp::_internal::MessageReceiverOptions receiverOptions; receiverOptions.Name = name; @@ -263,14 +263,14 @@ class TestSocketListenerEvents : public Azure::Core::Amqp::_internal::SessionEve virtual void OnIoError(Azure::Core::Amqp::_internal::Connection const&) override {} virtual void OnEndpointFrameReceived( Azure::Core::Amqp::_internal::Connection const& connection, - Azure::Core::Amqp::Models::Value const& value, + Azure::Core::Amqp::Models::AmqpValue const& value, uint32_t framePayloadSize, uint8_t* payloadBytes) override { (void)connection, (void)value, (void)framePayloadSize, (void)payloadBytes; } // Inherited via MessageReceiver - virtual Azure::Core::Amqp::Models::Value OnMessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message) override { GTEST_LOG_(INFO) << "Message received"; diff --git a/sdk/core/azure-core-amqp/test/ut/link_tests.cpp b/sdk/core/azure-core-amqp/test/ut/link_tests.cpp index 8470b3f0fa8..4c4b31531f8 100644 --- a/sdk/core/azure-core-amqp/test/ut/link_tests.cpp +++ b/sdk/core/azure-core-amqp/test/ut/link_tests.cpp @@ -186,9 +186,9 @@ class LinkSocketListenerEvents : public Azure::Core::Amqp::Network::_internal::S Azure::Core::Amqp::_internal::LinkEndpoint& newLinkInstance, std::string const& name, Azure::Core::Amqp::_internal::SessionRole, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value) override + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue) override { GTEST_LOG_(INFO) << "OnLinkAttached - Link attached to session."; auto newLink = std::make_unique( @@ -205,7 +205,7 @@ class LinkSocketListenerEvents : public Azure::Core::Amqp::Network::_internal::S } virtual void OnEndpointFrameReceived( Connection const&, - Azure::Core::Amqp::Models::Value const&, + Azure::Core::Amqp::Models::AmqpValue const&, uint32_t, uint8_t*) override { @@ -249,13 +249,13 @@ TEST_F(TestLinks, LinkAttachDetach) Link link(session, "MySession", SessionRole::Sender, "MySource", "MyTarget"); link.Attach(); - Azure::Core::Amqp::Models::Value data; + Azure::Core::Amqp::Models::AmqpValue data; link.Detach(false, {}, {}, data); // auto listeningConnection = listener.WaitForConnection(); // auto listeningSession = listeningConnection->WaitForSession(); // auto listeningLink = listeningSession->WaitForLink(); } - connection.Close("Test complete", "Completed", Models::Value()); + connection.Close("Test complete", "Completed", Models::AmqpValue()); listener.Stop(); } diff --git a/sdk/core/azure-core-amqp/test/ut/message_sender_receiver.cpp b/sdk/core/azure-core-amqp/test/ut/message_sender_receiver.cpp index ba9770d409d..7e4338596d4 100644 --- a/sdk/core/azure-core-amqp/test/ut/message_sender_receiver.cpp +++ b/sdk/core/azure-core-amqp/test/ut/message_sender_receiver.cpp @@ -202,7 +202,7 @@ class MessageListenerEvents : public Azure::Core::Amqp::Network::_internal::Sock virtual void OnIoError(Azure::Core::Amqp::_internal::Connection const&) override {} virtual void OnEndpointFrameReceived( Connection const&, - Azure::Core::Amqp::Models::Value const&, + Azure::Core::Amqp::Models::AmqpValue const&, uint32_t, uint8_t*) override { @@ -214,9 +214,9 @@ class MessageListenerEvents : public Azure::Core::Amqp::Network::_internal::Sock Azure::Core::Amqp::_internal::LinkEndpoint& newLinkInstance, std::string const& name, Azure::Core::Amqp::_internal::SessionRole, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value properties) override + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue properties) override { GTEST_LOG_(INFO) << "OnLinkAttached - Link attached to session."; MessageReceiverOptions receiverOptions; @@ -239,7 +239,7 @@ class MessageListenerEvents : public Azure::Core::Amqp::Network::_internal::Sock (void)properties; return true; } - virtual Azure::Core::Amqp::Models::Value OnMessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message message) override { GTEST_LOG_(INFO) << "Message received"; @@ -308,7 +308,7 @@ TEST_F(TestMessages, ReceiverOpenClose) (void)oldState; } - Models::Value OnMessageReceived(Models::Message) override { return Models::Value(); } + Models::AmqpValue OnMessageReceived(Models::Message) override { return Models::AmqpValue(); } }; ReceiverEvents receiverEvents; @@ -348,7 +348,7 @@ TEST_F(TestMessages, SenderOpenClose) sender.Open(); sender.Close(); } - connection.Close("Test complete", "", Models::Value()); + connection.Close("Test complete", "", Models::AmqpValue()); listener.Stop(); } @@ -431,11 +431,11 @@ TEST_F(TestMessages, SenderSendAsync) Azure::Core::Context context; Azure::Core::Amqp::Common::_internal:: - AsyncOperationQueue + AsyncOperationQueue sendCompleteQueue; sender.SendAsync( message, - [&](MessageSendResult sendResult, Azure::Core::Amqp::Models::Value deliveryStatus) { + [&](MessageSendResult sendResult, Azure::Core::Amqp::Models::AmqpValue deliveryStatus) { GTEST_LOG_(INFO) << "Send Complete!"; sendCompleteQueue.CompleteOperation(sendResult, deliveryStatus); }); @@ -446,7 +446,7 @@ TEST_F(TestMessages, SenderSendAsync) } receiveContext.Cancel(); listenerThread.join(); - connection.Close("", "", Models::Value()); + connection.Close("", "", Models::AmqpValue()); } TEST_F(TestMessages, SenderSendSync) @@ -515,7 +515,7 @@ TEST_F(TestMessages, SenderSendSync) message.AddBodyAmqpData({messageBody, sizeof(messageBody)}); Azure::Core::Amqp::Common::_internal:: - AsyncOperationQueue + AsyncOperationQueue sendCompleteQueue; auto result = sender.Send(message); EXPECT_EQ(std::get<0>(result), MessageSendResult::Ok); diff --git a/sdk/core/azure-core-amqp/test/ut/message_source_target.cpp b/sdk/core/azure-core-amqp/test/ut/message_source_target.cpp index 314488beca5..a67d023c69a 100644 --- a/sdk/core/azure-core-amqp/test/ut/message_source_target.cpp +++ b/sdk/core/azure-core-amqp/test/ut/message_source_target.cpp @@ -36,12 +36,12 @@ TEST_F(TestSourceTarget, SimpleSourceTarget) } { - EXPECT_ANY_THROW(MessageSource source(Value{})); - EXPECT_ANY_THROW(MessageSource source(Value::CreateArray())); + EXPECT_ANY_THROW(MessageSource source(AmqpValue{})); + EXPECT_ANY_THROW(MessageSource source(AmqpValue::CreateArray())); } { - EXPECT_ANY_THROW(MessageTarget target(Value{})); - EXPECT_ANY_THROW(MessageTarget target(Value::CreateArray())); + EXPECT_ANY_THROW(MessageTarget target(AmqpValue{})); + EXPECT_ANY_THROW(MessageTarget target(AmqpValue::CreateArray())); } } @@ -69,14 +69,14 @@ TEST_F(TestSourceTarget, TargetProperties) { MessageTarget target("test"); - EXPECT_EQ(Value{"test"}, target.GetAddress()); + EXPECT_EQ(AmqpValue{"test"}, target.GetAddress()); } { MessageTarget target; target.SetAddress("Address"); - EXPECT_EQ(Value("Address"), target.GetAddress()); + EXPECT_EQ(AmqpValue("Address"), target.GetAddress()); - target.SetCapabilities(Value::CreateSymbol("Test")); + target.SetCapabilities(AmqpValue::CreateSymbol("Test")); EXPECT_EQ(target.GetCapabilities().GetType(), AmqpValueType::Array); EXPECT_EQ(AmqpValueType::Symbol, target.GetCapabilities().GetArrayItem(0).GetType()); EXPECT_EQ("Test", target.GetCapabilities().GetArrayItem(0).GetSymbol()); @@ -115,11 +115,11 @@ TEST_F(TestSourceTarget, TargetProperties) target.SetDynamicNodeProperties("Dynamic properties"); EXPECT_ANY_THROW(target.GetDynamicNodeProperties()); - auto dynamicMap = Value::CreateMap(); + auto dynamicMap = AmqpValue::CreateMap(); dynamicMap.SetMapValue("Key", 23); target.SetDynamicNodeProperties(dynamicMap); EXPECT_EQ(target.GetDynamicNodeProperties().GetType(), AmqpValueType::Map); - EXPECT_EQ(target.GetDynamicNodeProperties().GetMapValue("Key"), Value(23)); + EXPECT_EQ(target.GetDynamicNodeProperties().GetMapValue("Key"), AmqpValue(23)); GTEST_LOG_(INFO) << "Target: " << target; } @@ -128,8 +128,8 @@ TEST_F(TestSourceTarget, TargetProperties) TEST_F(TestSourceTarget, TargetThroughValue) { MessageTarget target("address1"); - const Value v = target; - Value value(v); + const AmqpValue v = target; + AmqpValue value(v); MessageTarget target2(value); EXPECT_EQ(target.GetAddress(), target2.GetAddress()); @@ -149,15 +149,15 @@ TEST_F(TestSourceTarget, SourceProperties) { MessageSource source("test"); - EXPECT_EQ(Value{"test"}, source.GetAddress()); + EXPECT_EQ(AmqpValue{"test"}, source.GetAddress()); } { MessageSource source; source.SetAddress("Address"); - EXPECT_EQ(Value("Address"), source.GetAddress()); + EXPECT_EQ(AmqpValue("Address"), source.GetAddress()); - source.SetCapabilities(Value::CreateSymbol("Test")); + source.SetCapabilities(AmqpValue::CreateSymbol("Test")); EXPECT_EQ(source.GetCapabilities().GetType(), AmqpValueType::Array); EXPECT_EQ(AmqpValueType::Symbol, source.GetCapabilities().GetArrayItem(0).GetType()); EXPECT_EQ("Test", source.GetCapabilities().GetArrayItem(0).GetSymbol()); @@ -196,11 +196,11 @@ TEST_F(TestSourceTarget, SourceProperties) source.SetDynamicNodeProperties("Dynamic properties"); EXPECT_ANY_THROW(source.GetDynamicNodeProperties()); - auto dynamicMap = Value::CreateMap(); + auto dynamicMap = AmqpValue::CreateMap(); dynamicMap.SetMapValue("Key", 23); source.SetDynamicNodeProperties(dynamicMap); EXPECT_EQ(source.GetDynamicNodeProperties().GetType(), AmqpValueType::Map); - EXPECT_EQ(source.GetDynamicNodeProperties().GetMapValue("Key"), Value(23)); + EXPECT_EQ(source.GetDynamicNodeProperties().GetMapValue("Key"), AmqpValue(23)); source.SetDistributionMode("A different mode"); EXPECT_EQ("A different mode", source.GetDistributionMode()); @@ -208,16 +208,16 @@ TEST_F(TestSourceTarget, SourceProperties) // A filter set is a map. source.SetFilter("Dynamic properties"); EXPECT_ANY_THROW(source.GetFilter()); - auto filterMap = Value::CreateMap(); + auto filterMap = AmqpValue::CreateMap(); filterMap.SetMapValue("Key", 23); source.SetFilter(filterMap); EXPECT_EQ(source.GetFilter().GetType(), AmqpValueType::Map); - EXPECT_EQ(source.GetFilter().GetMapValue("Key"), Value(23)); + EXPECT_EQ(source.GetFilter().GetMapValue("Key"), AmqpValue(23)); source.SetDefaultOutcome("Default outcome"); EXPECT_EQ(source.GetDefaultOutcome(), "Default outcome"); - source.SetOutcomes(Value::CreateSymbol("Test")); + source.SetOutcomes(AmqpValue::CreateSymbol("Test")); EXPECT_EQ(source.GetOutcomes().GetType(), AmqpValueType::Array); EXPECT_EQ(AmqpValueType::Symbol, source.GetOutcomes().GetArrayItem(0).GetType()); EXPECT_EQ("Test", source.GetOutcomes().GetArrayItem(0).GetSymbol()); @@ -227,8 +227,8 @@ TEST_F(TestSourceTarget, SourceProperties) { MessageSource source("address1"); - const Value v = source; - Value value(v); + const AmqpValue v = source; + AmqpValue value(v); MessageSource source2(value); EXPECT_EQ(source.GetAddress(), source2.GetAddress()); diff --git a/sdk/core/azure-core-amqp/test/ut/mock_amqp_server.hpp b/sdk/core/azure-core-amqp/test/ut/mock_amqp_server.hpp index 0c9944b41e6..067f34c06a4 100644 --- a/sdk/core/azure-core-amqp/test/ut/mock_amqp_server.hpp +++ b/sdk/core/azure-core-amqp/test/ut/mock_amqp_server.hpp @@ -61,7 +61,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe * @param message The message received. * @return The value to send back to the sender. */ - virtual Azure::Core::Amqp::Models::Value MessageReceived( + virtual Azure::Core::Amqp::Models::AmqpValue MessageReceived( Azure::Core::Amqp::Models::Message message) { (void)message; @@ -241,7 +241,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe { EXPECT_EQ(type.GetType(), Azure::Core::Amqp::Models::AmqpValueType::String); EXPECT_EQ(name.GetType(), Azure::Core::Amqp::Models::AmqpValueType::String); - // The body of a put-token operation MUST be an AMQP Value. + // The body of a put-token operation MUST be an AMQP AmqpValue. EXPECT_EQ(message.GetBodyType(), Azure::Core::Amqp::Models::MessageBodyType::Value); // Respond to the operation. @@ -261,7 +261,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe // Populate the response application properties. - auto propertyMap = Azure::Core::Amqp::Models::Value::CreateMap(); + auto propertyMap = Azure::Core::Amqp::Models::AmqpValue::CreateMap(); if (m_forceCbsError) { propertyMap.SetMapValue("status-code", 500); @@ -282,7 +282,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe { return; } - response.SetBodyAmqpValue(Azure::Core::Amqp::Models::Value()); + response.SetBodyAmqpValue(Azure::Core::Amqp::Models::AmqpValue()); try { m_cbsMessageSender->Send(response, m_listenerContext); @@ -308,7 +308,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe responseProperties.SetCorrelationId(requestCorrelationId); response.SetProperties(responseProperties); - auto propertyMap = Azure::Core::Amqp::Models::Value::CreateMap(); + auto propertyMap = Azure::Core::Amqp::Models::AmqpValue::CreateMap(); propertyMap.SetMapValue("status-code", 200); propertyMap.SetMapValue("status-description", "OK-delete"); @@ -321,7 +321,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe return; } - response.SetBodyAmqpValue(Azure::Core::Amqp::Models::Value()); + response.SetBodyAmqpValue(Azure::Core::Amqp::Models::AmqpValue()); m_cbsMessageSender->Send(response, m_listenerContext); } @@ -368,9 +368,9 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe Azure::Core::Amqp::_internal::LinkEndpoint& newLinkInstance, std::string const& name, Azure::Core::Amqp::_internal::SessionRole role, - Azure::Core::Amqp::Models::Value source, - Azure::Core::Amqp::Models::Value target, - Azure::Core::Amqp::Models::Value) override + Azure::Core::Amqp::Models::AmqpValue source, + Azure::Core::Amqp::Models::AmqpValue target, + Azure::Core::Amqp::Models::AmqpValue) override { Azure::Core::Amqp::Models::_internal::MessageSource msgSource(source); Azure::Core::Amqp::Models::_internal::MessageTarget msgTarget(target); @@ -430,7 +430,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe virtual void OnEndpointFrameReceived( Azure::Core::Amqp::_internal::Connection const&, - Azure::Core::Amqp::Models::Value const&, + Azure::Core::Amqp::Models::AmqpValue const&, uint32_t, uint8_t*) override { @@ -446,7 +446,7 @@ class AmqpServerMock : public Azure::Core::Amqp::Network::_internal::SocketListe << ReceiverStateToString(oldState) << " New state: " << ReceiverStateToString(newState); } - Azure::Core::Amqp::Models::Value OnMessageReceived( + Azure::Core::Amqp::Models::AmqpValue OnMessageReceived( Azure::Core::Amqp::Models::Message message) override { GTEST_LOG_(INFO) << "Received a message " << message;