コード例 #1
0
        public void GetUriSchemeUnderstandsAmqpConnectionTypes(TransportType connectionType)
        {
            var scheme = connectionType.GetUriScheme();

            Assert.That(scheme, Is.Not.Null.Or.Empty);
            Assert.That(connectionType.GetUriScheme(), Contains.Substring("amqp"));
        }
コード例 #2
0
        /// <summary>
        ///   Builds the audience for use in the signature.
        /// </summary>
        ///
        /// <param name="transportType">The type of protocol and transport that will be used for communicating with the Event Hubs service.</param>
        /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="eventHubName">The name of the specific Event Hub to connect the client to.</param>
        ///
        /// <returns>The value to use as the audience of the signature.</returns>
        ///
        private static string BuildAudienceResource(TransportType transportType,
                                                    string fullyQualifiedNamespace,
                                                    string eventHubName)
        {
            var builder = new UriBuilder(fullyQualifiedNamespace)
            {
                Scheme   = transportType.GetUriScheme(),
                Path     = eventHubName,
                Port     = -1,
                Fragment = string.Empty,
                Password = string.Empty,
                UserName = string.Empty,
            };

            if (builder.Path.EndsWith("/"))
            {
                builder.Path = builder.Path.TrimEnd('/');
            }

            return(builder.Uri.AbsoluteUri.ToLowerInvariant());
        }
コード例 #3
0
        /// <summary>
        ///   Builds the audience for use in the signature.
        /// </summary>
        ///
        /// <param name="transportType">The type of protocol and transport that will be used for communicating with the Event Hubs service.</param>
        /// <param name="host">The fully qualified host name for the Event Hubs namespace.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="eventHubPath">The path of the specific Event Hub to connect the client to.</param>
        ///
        /// <returns>The value to use as the audience of the signature.</returns>
        ///
        private static string BuildResource(TransportType transportType,
                                            string host,
                                            string eventHubPath)
        {
            var builder = new UriBuilder(host)
            {
                Scheme   = transportType.GetUriScheme(),
                Path     = eventHubPath,
                Port     = -1,
                Fragment = String.Empty,
                Password = String.Empty,
                UserName = String.Empty,
            };

            if (builder.Path.EndsWith("/"))
            {
                builder.Path = builder.Path.TrimEnd('/');
            }

            return(builder.Uri.AbsoluteUri.ToLowerInvariant());
        }