diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dc880210..79a772b63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,10 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: 5.0.x + - name: Setup .NET 6.0.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x - name: Build packages env: WORKSPACE_PATH: ${{ github.workspace }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 36b490c85..d4b436ba3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,6 +23,10 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: 5.0.x + - name: Setup .NET 6.0.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x - name: Build packages env: WORKSPACE_PATH: ${{ github.workspace }} diff --git a/.github/workflows/run_acceptance_tests.yml b/.github/workflows/run_acceptance_tests.yml index 17bc64741..335ebf957 100644 --- a/.github/workflows/run_acceptance_tests.yml +++ b/.github/workflows/run_acceptance_tests.yml @@ -33,10 +33,10 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} - - name: Setup .NET 5.0.x + - name: Setup .NET 6.0.x uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.x + dotnet-version: 6.0.x - name: Restore dependencies run: dotnet restore - name: Build Projects diff --git a/.pubnub.yml b/.pubnub.yml index 9479f0359..c98d6e953 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,15 @@ name: c-sharp -version: "6.5.0" +version: "6.6.0" schema: 1 scm: github.com/pubnub/c-sharp changelog: + - date: 2022-07-18 + version: v6.6.0 + changes: + - type: improvement + text: "Introduced UserId to PNConfiguration and deprecated UUID." + - type: improvement + text: "Added build target framework support to .Net Framework 4.8 and .Net 6.0." - date: 2022-06-14 version: v6.5.0 changes: @@ -653,7 +660,7 @@ features: - QUERY-PARAM supported-platforms: - - version: Pubnub 'C#' 6.5.0 + version: Pubnub 'C#' 6.6.0 platforms: - Windows 10 and up - Windows Server 2008 and up @@ -663,7 +670,7 @@ supported-platforms: - .Net Framework 4.5 - .Net Framework 4.6.1+ - - version: PubnubPCL 'C#' 6.5.0 + version: PubnubPCL 'C#' 6.6.0 platforms: - Xamarin.Android - Xamarin.iOS @@ -681,8 +688,9 @@ supported-platforms: - .Net Standard 2.0 - .Net Standard 2.1 - .Net Core + - .Net 6.0 - - version: PubnubUWP 'C#' 6.5.0 + version: PubnubUWP 'C#' 6.6.0 platforms: - Windows Phone 10 - Universal Windows Apps @@ -706,7 +714,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: Pubnub - location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0 requires: - name: ".Net" @@ -722,18 +730,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" - @@ -868,18 +869,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" - @@ -1003,7 +997,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubNubPCL - location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0 requires: - name: ".Net Core" @@ -1019,18 +1013,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" supported-platforms: @@ -1204,18 +1191,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" supported-platforms: @@ -1376,7 +1356,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubnubUWP - location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0 requires: - name: "Universal Windows Platform Development" @@ -1399,18 +1379,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" supported-platforms: @@ -1493,18 +1466,11 @@ sdks: license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md" location: "External" is-required: "Required" - - - name: "Portable.BouncyCastle" - min-version: "1.8.1.2" - license: "MIT,X11" - license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2" - location: "External" - is-required: "Required" - name: "PeterO.Cbor" - min-version: "4.4.4" + min-version: "4.5.2" license: "CC0-1.0" - license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4" + license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2" location: "External" is-required: "Required" supported-platforms: diff --git a/CHANGELOG b/CHANGELOG index 2ab595afc..c2c40b992 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +v6.6.0 - July 18 2022 +----------------------------- +- Modified: introduced UserId to PNConfiguration and deprecated UUID. +- Modified: added build target framework support to .Net Framework 4.8 and .Net 6.0. + v6.5.0 - June 14 2022 ----------------------------- - Fixed: suppress web request aborted exception message to callback. diff --git a/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs b/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs index 51a698eba..4b14a5f00 100644 --- a/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs +++ b/src/Api/PubnubApi/Builder/UrlRequestBuilder.cs @@ -2038,7 +2038,7 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ { if (pubnubUnitTest.IncludeUuid) { - ret.Add("uuid", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].Uuid, PNOperationType.PNSubscribeOperation, false, false, true)); + ret.Add("uuid", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].UserId, PNOperationType.PNSubscribeOperation, false, false, true)); } if (pubnubUnitTest.IncludePnsdk) @@ -2049,7 +2049,7 @@ private Dictionary GenerateCommonQueryParams(PNOperationType typ else { ret.Add("uuid", UriUtil.EncodeUriComponent(uuid != null ? uuid : - (pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].Uuid : ""), + (pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].UserId.ToString() : ""), PNOperationType.PNSubscribeOperation, false, false, true)); ret.Add("pnsdk", UriUtil.EncodeUriComponent(Pubnub.Version, PNOperationType.PNSubscribeOperation, false, false, true)); } diff --git a/src/Api/PubnubApi/ClientNetworkStatus.cs b/src/Api/PubnubApi/ClientNetworkStatus.cs index 910eee710..7638151ec 100644 --- a/src/Api/PubnubApi/ClientNetworkStatus.cs +++ b/src/Api/PubnubApi/ClientNetworkStatus.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using System.IO; using System.Globalization; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 using System.Net.Http; using System.Net.Http.Headers; #endif @@ -20,7 +20,7 @@ internal static class ClientNetworkStatus private static IPubnubLog pubnubLog; private static bool networkStatus = true; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 private static HttpClient httpClient; #endif @@ -72,7 +72,7 @@ public static IPubnubLog PubnubLog } } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 public static HttpClient RefHttpClient { set @@ -221,7 +221,7 @@ private static async Task CheckSocketConnect(object internetState) } else { -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) { gotTimeResp = await GetTimeWithTaskFactoryAsync(requestUri).ConfigureAwait(false); @@ -271,7 +271,7 @@ private static void ParseCheckSocketConnectException(Exception ex, PNOperatio internalcallback(false); } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 private static async Task GetTimeWithHttpClient(Uri requestUri) { bool successFlag = false; @@ -347,7 +347,7 @@ private static async Task GetTimeWithClassicHttp(Uri requestUri) } if (asyncRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif asyncRequestState.Response = null; diff --git a/src/Api/PubnubApi/EndPoint/Files/SendFileOperation.cs b/src/Api/PubnubApi/EndPoint/Files/SendFileOperation.cs index 75c07934f..a87113cd6 100644 --- a/src/Api/PubnubApi/EndPoint/Files/SendFileOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Files/SendFileOperation.cs @@ -487,7 +487,7 @@ private static byte[] GetMultipartFormData(byte[] sendFileByteArray, string file ret = new byte[dataStream.Length]; int bytesRead = dataStream.Read(ret, 0, ret.Length); System.Diagnostics.Debug.WriteLine(string.Format("MultipartFormData byte count = {0}", bytesRead)); -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 dataStream.Close(); #endif } diff --git a/src/Api/PubnubApi/EndPoint/Objects/GetMembershipsOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/GetMembershipsOperation.cs index e4e2e9bed..3c60b6481 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/GetMembershipsOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/GetMembershipsOperation.cs @@ -152,7 +152,7 @@ private void GetMembershipsList(string uuid, PNPageObject page, int limit, bool { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNPageObject internalPage; @@ -195,7 +195,7 @@ private async Task> GetMembershipsList(string uuid if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNPageObject internalPage; diff --git a/src/Api/PubnubApi/EndPoint/Objects/GetUuidMetadataOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/GetUuidMetadataOperation.cs index 0f5f70234..380535e75 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/GetUuidMetadataOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/GetUuidMetadataOperation.cs @@ -113,7 +113,7 @@ private void GetSingleUuidMetadata(string uuid, bool includeCustom, Dictionary> GetSingleUuidMetadata(stri { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNResult ret = new PNResult(); diff --git a/src/Api/PubnubApi/EndPoint/Objects/ManageMembershipsOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/ManageMembershipsOperation.cs index 82f100965..e348b0712 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/ManageMembershipsOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/ManageMembershipsOperation.cs @@ -166,7 +166,7 @@ private void ManageChannelMembershipWithUuid(string uuid, List set { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNPageObject internalPage; @@ -246,7 +246,7 @@ private async Task> ManageChannelMembershipWithUui if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0) diff --git a/src/Api/PubnubApi/EndPoint/Objects/RemoveMembershipsOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/RemoveMembershipsOperation.cs index 9fc696c9c..c79af8aec 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/RemoveMembershipsOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/RemoveMembershipsOperation.cs @@ -158,7 +158,7 @@ private void RemoveUuidMemberships(string uuid, List removeMembership, P { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNPageObject internalPage; @@ -220,7 +220,7 @@ private async Task> RemoveUuidMemberships(string u if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0) diff --git a/src/Api/PubnubApi/EndPoint/Objects/RemoveUuidMetadataOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/RemoveUuidMetadataOperation.cs index 277152b87..eddf63671 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/RemoveUuidMetadataOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/RemoveUuidMetadataOperation.cs @@ -113,7 +113,7 @@ private void RemoveUuidMetadata(string uuid, Dictionary external { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); @@ -145,7 +145,7 @@ private async Task> RemoveUuidMetadata(stri if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0) diff --git a/src/Api/PubnubApi/EndPoint/Objects/SetMembershipsOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/SetMembershipsOperation.cs index d669fbd57..7a41aaae7 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/SetMembershipsOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/SetMembershipsOperation.cs @@ -159,7 +159,7 @@ private void SetChannelMembershipWithUuid(string uuid, List setMem { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNPageObject internalPage; @@ -222,7 +222,7 @@ private async Task> SetChannelMembershipWithUuid(s if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0) diff --git a/src/Api/PubnubApi/EndPoint/Objects/SetUuidMetadataOperation.cs b/src/Api/PubnubApi/EndPoint/Objects/SetUuidMetadataOperation.cs index 19fe83b74..fce170187 100644 --- a/src/Api/PubnubApi/EndPoint/Objects/SetUuidMetadataOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Objects/SetUuidMetadataOperation.cs @@ -152,7 +152,7 @@ private void SetUuidMetadata(string uuid, bool includeCustom, Dictionary requestState = new RequestState(); @@ -205,7 +205,7 @@ private async Task> SetUuidMetadata(string uui { if (string.IsNullOrEmpty(uuid)) { - uuid = config.Uuid; + uuid = config.UserId; } PNResult ret = new PNResult(); diff --git a/src/Api/PubnubApi/EndPoint/OtherOperation.cs b/src/Api/PubnubApi/EndPoint/OtherOperation.cs index cdfea2be0..045271f47 100644 --- a/src/Api/PubnubApi/EndPoint/OtherOperation.cs +++ b/src/Api/PubnubApi/EndPoint/OtherOperation.cs @@ -26,10 +26,9 @@ public OtherOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPl pubnubTelemetryMgr = telemetryManager; } - - public void ChangeUUID(string newUUID) + public void ChangeUserId(UserId newUserId) { - if (string.IsNullOrEmpty(newUUID) || config.Uuid == newUUID) + if (newUserId == null || string.IsNullOrEmpty(newUserId.ToString().Trim()) || config.UserId.ToString() == newUserId.ToString()) { return; } @@ -38,10 +37,10 @@ public void ChangeUUID(string newUUID) { try { - UuidChanged = true; + config.UserId = newUserId; + CurrentUserId.AddOrUpdate(PubnubInstance.InstanceId, newUserId, (k, o) => newUserId); + UserIdChanged.AddOrUpdate(PubnubInstance.InstanceId, true, (k, o) => true); - config.Uuid = newUUID; - CurrentUuid = newUUID; string[] channels = GetCurrentSubscriberChannels(); string[] channelGroups = GetCurrentSubscriberChannelGroups(); @@ -53,7 +52,7 @@ public void ChangeUUID(string newUUID) { string channelsJsonState = BuildJsonUserState(channels.ToArray(), channelGroups.ToArray(), false); IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); - + Uri request = urlBuilder.BuildMultiChannelLeaveRequest("GET", "", channels, channelGroups, channelsJsonState, null); RequestState requestState = new RequestState(); @@ -62,7 +61,7 @@ public void ChangeUUID(string newUUID) requestState.ResponseType = PNOperationType.Leave; requestState.Reconnect = false; - UrlProcessRequest(request, requestState, false).ContinueWith(r=> { }, TaskContinuationOptions.ExecuteSynchronously).Wait(); // connectCallback = null + UrlProcessRequest(request, requestState, false).ContinueWith(r => { }, TaskContinuationOptions.ExecuteSynchronously).Wait(); // connectCallback = null } TerminateCurrentSubscriberRequest(); @@ -71,6 +70,15 @@ public void ChangeUUID(string newUUID) }, CancellationToken.None, TaskCreationOptions.PreferFairness, TaskScheduler.Default).ConfigureAwait(false); } + public UserId GetCurrentUserId() + { + UserId ret; + if (CurrentUserId.TryGetValue(PubnubInstance.InstanceId, out ret)) + { + return ret; + } + return ret; + } public static long TranslateDateTimeToSeconds(DateTime dotNetUTCDateTime) { TimeSpan timeSpan = dotNetUTCDateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); diff --git a/src/Api/PubnubApi/EndPoint/Presence/GetStateOperation.cs b/src/Api/PubnubApi/EndPoint/Presence/GetStateOperation.cs index 2ddfd759a..b10d6e9d8 100644 --- a/src/Api/PubnubApi/EndPoint/Presence/GetStateOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Presence/GetStateOperation.cs @@ -111,7 +111,7 @@ internal void GetUserState(string[] channels, string[] channelGroups, string uui string internalUuid; if (string.IsNullOrEmpty(uuid) || uuid.Trim().Length == 0) { - internalUuid = config.Uuid; + internalUuid = config.UserId; } else { internalUuid = uuid; @@ -155,7 +155,7 @@ internal async Task> GetUserState(string[] channels, string internalUuid; if (string.IsNullOrEmpty(uuid) || uuid.Trim().Length == 0) { - internalUuid = config.Uuid; + internalUuid = config.UserId; } else { diff --git a/src/Api/PubnubApi/EndPoint/Presence/SetStateOperation.cs b/src/Api/PubnubApi/EndPoint/Presence/SetStateOperation.cs index 47caf66d7..c698cc726 100644 --- a/src/Api/PubnubApi/EndPoint/Presence/SetStateOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Presence/SetStateOperation.cs @@ -354,7 +354,7 @@ private void SharedSetUserState(string[] channels, string[] channelGroups, strin if (string.IsNullOrEmpty(uuid)) { - currentUuid = config.Uuid; + currentUuid = config.UserId; } string jsonUserState = GetJsonSharedSetUserStateInternal(channels, channelGroups, jsonChannelUserState, jsonChannelGroupUserState); @@ -412,7 +412,7 @@ private async Task> SharedSetUserState(string[] chann if (string.IsNullOrEmpty(uuid)) { - currentUuid = config.Uuid; + currentUuid = config.UserId; } string jsonUserState = GetJsonSharedSetUserStateInternal(channels, channelGroups, jsonChannelUserState, jsonChannelGroupUserState); diff --git a/src/Api/PubnubApi/EndPoint/Presence/WhereNowOperation.cs b/src/Api/PubnubApi/EndPoint/Presence/WhereNowOperation.cs index 252ef9c22..2b2e2a511 100644 --- a/src/Api/PubnubApi/EndPoint/Presence/WhereNowOperation.cs +++ b/src/Api/PubnubApi/EndPoint/Presence/WhereNowOperation.cs @@ -97,7 +97,7 @@ internal void WhereNow(string uuid, Dictionary externalQueryPara string currentUuid = ""; if (string.IsNullOrEmpty(uuid)) { - currentUuid = config.Uuid; + currentUuid = config.UserId; } else { @@ -137,7 +137,7 @@ internal async Task> WhereNow(string uuid, Dictionary string currentUuid = ""; if (string.IsNullOrEmpty(uuid)) { - currentUuid = config.Uuid; + currentUuid = config.UserId; } else { diff --git a/src/Api/PubnubApi/EndPoint/PubSub/SubscribeManager.cs b/src/Api/PubnubApi/EndPoint/PubSub/SubscribeManager.cs index 2e4bea7a4..04d3792b1 100644 --- a/src/Api/PubnubApi/EndPoint/PubSub/SubscribeManager.cs +++ b/src/Api/PubnubApi/EndPoint/PubSub/SubscribeManager.cs @@ -641,10 +641,10 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan long maximumTimetoken = Math.Max(maximumTimetoken1, maximumTimetoken2); - if (minimumTimetoken == 0 || reconnect || UuidChanged) + if (minimumTimetoken == 0 || reconnect || UserIdChanged[PubnubInstance.InstanceId]) { lastTimetoken = 0; - UuidChanged = false; + UserIdChanged.AddOrUpdate(PubnubInstance.InstanceId, false, (k, o) => false); } else { @@ -660,7 +660,7 @@ private void MultiChannelSubscribeRequest(PNOperationType type, string[] chan LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime {0}, Building request for channel(s)={1}, channelgroup(s)={2} with timetoken={3}", DateTime.Now.ToString(CultureInfo.InvariantCulture), multiChannel, multiChannelGroup, lastTimetoken), config.ContainsKey(PubnubInstance.InstanceId) ? config[PubnubInstance.InstanceId].LogVerbosity : PNLogVerbosity.NONE); // Build URL string channelsJsonState = BuildJsonUserState(channels, channelGroups, false); - config[PubnubInstance.InstanceId].Uuid = CurrentUuid; // to make sure we capture if UUID is changed + config[PubnubInstance.InstanceId].UserId = CurrentUserId[PubnubInstance.InstanceId]; // to make sure we capture if UUID is changed IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config[PubnubInstance.InstanceId], jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildMultiChannelSubscribeRequest("GET", "", channels, channelGroups, (Convert.ToInt64(timetoken.ToString()) == 0) ? Convert.ToInt64(timetoken.ToString()) : lastTimetoken, region, channelsJsonState, initialSubscribeUrlParams, externalQueryParam); diff --git a/src/Api/PubnubApi/EndPoint/TokenManager.cs b/src/Api/PubnubApi/EndPoint/TokenManager.cs index daf64f993..ed0f1c6ec 100644 --- a/src/Api/PubnubApi/EndPoint/TokenManager.cs +++ b/src/Api/PubnubApi/EndPoint/TokenManager.cs @@ -5,8 +5,6 @@ using System.Text.RegularExpressions; using System.Collections; using System.Reflection; -#if DEBUG && NET461 -#endif using Newtonsoft.Json; using PeterO.Cbor; using System.Globalization; diff --git a/src/Api/PubnubApi/Log/PNPlatform.cs b/src/Api/PubnubApi/Log/PNPlatform.cs index ee4406d72..55b7fa047 100644 --- a/src/Api/PubnubApi/Log/PNPlatform.cs +++ b/src/Api/PubnubApi/Log/PNPlatform.cs @@ -20,10 +20,12 @@ public static void Print(PNConfiguration config, IPubnubLog log) LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NETSTANDARD13", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #elif NETSTANDARD14 LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NETSTANDARD14", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); -#elif UNITY && NETSTANDARD20 +#elif (UNITY && NETSTANDARD20) || (UNITY && NET60) PrintUnity(config, log); #elif !UNITY && NETSTANDARD20 LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NETSTANDARD20", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); +#elif !UNITY && NET60 + LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NET60", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #elif UAP LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = UAP", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #elif NETFX_CORE @@ -38,12 +40,14 @@ public static void Print(PNConfiguration config, IPubnubLog log) LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NET45", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #elif NET461 LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NET461", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); +#elif NET48 + LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = NET48", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #else LoggingMethod.WriteToLog(log, string.Format("DateTime {0} PLATFORM = UNKNOWN", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); #endif } -#if UNITY && NETSTANDARD20 +#if (UNITY && NETSTANDARD20) || (UNITY && NET60) private static void PrintUnity(PNConfiguration config, IPubnubLog log) { #if UNITY_IOS || UNITY_IPHONE @@ -78,10 +82,12 @@ public static string Get() result = "NETSTD13"; #elif NETSTANDARD14 result = "NETSTD14"; -#elif UNITY && NETSTANDARD20 +#elif (UNITY && NETSTANDARD20) || (UNITY && NET60) result = GetUnity(); #elif !UNITY && NETSTANDARD20 result = "NETSTD20"; +#elif !UNITY && NET60 + result = "NET60"; #elif UAP result = "UAP"; #elif NETFX_CORE @@ -96,13 +102,15 @@ public static string Get() result = "NET45"; #elif NET461 result = "NET461"; +#elif NET48 + result = "NET48"; #else result = "UNKNOWN"; #endif return result; } -#if UNITY && NETSTANDARD20 +#if (UNITY && NETSTANDARD20) || (UNITY && NET60) private static string GetUnity() { string result = ""; diff --git a/src/Api/PubnubApi/Model/Consumer/UserId.cs b/src/Api/PubnubApi/Model/Consumer/UserId.cs new file mode 100644 index 000000000..f147deac2 --- /dev/null +++ b/src/Api/PubnubApi/Model/Consumer/UserId.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace PubnubApi +{ + public class UserId + { + private string _userId; + public UserId(string value) + { + _userId = value; + } + + public static implicit operator string(UserId self) + { + return self?.ToString(); + } + public static implicit operator UserId(string value) + { + return new UserId(value); + } + public override string ToString() + { + return _userId; + } + } +} diff --git a/src/Api/PubnubApi/NewtonsoftJsonDotNet.cs b/src/Api/PubnubApi/NewtonsoftJsonDotNet.cs index 4023fbf35..9a075c7a9 100644 --- a/src/Api/PubnubApi/NewtonsoftJsonDotNet.cs +++ b/src/Api/PubnubApi/NewtonsoftJsonDotNet.cs @@ -122,7 +122,7 @@ public bool IsDictionaryCompatible(string jsonString, PNOperationType operationT } jsonTxtreader.Close(); } -#if (NET35 || NET40 || NET45 || NET461) +#if (NET35 || NET40 || NET45 || NET461 || NET48) strReader.Close(); #endif } @@ -190,13 +190,13 @@ private bool IsGenericTypeForMessage() bool ret = false; PNPlatform.Print(config, pubnubLog); -#if (NET35 || NET40 || NET45 || NET461) +#if (NET35 || NET40 || NET45 || NET461 || NET48) if (typeof(T).IsGenericType && typeof(T).GetGenericTypeDefinition() == typeof(PNMessageResult<>)) { ret = true; } LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, NET35/40 IsGenericTypeForMessage = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ret.ToString()), config.LogVerbosity); -#elif (NETSTANDARD10 || NETSTANDARD11 || NETSTANDARD12 || NETSTANDARD13 || NETSTANDARD14 || NETSTANDARD20 || UAP || NETFX_CORE || WINDOWS_UWP) +#elif (NETSTANDARD10 || NETSTANDARD11 || NETSTANDARD12 || NETSTANDARD13 || NETSTANDARD14 || NETSTANDARD20 || NET60 || UAP || NETFX_CORE || WINDOWS_UWP) if (typeof(T).GetTypeInfo().IsGenericType && typeof(T).GetGenericTypeDefinition() == typeof(PNMessageResult<>)) { ret = true; @@ -216,7 +216,7 @@ private T DeserializeMessageToObjectBasedOnPlatform(List listObject) { T ret = default(T); -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 Type dataType = typeof(T).GetGenericArguments()[0]; Type generic = typeof(PNMessageResult<>); Type specific = generic.MakeGenericType(dataType); @@ -289,7 +289,7 @@ private T DeserializeMessageToObjectBasedOnPlatform(List listObject) ret = (T)Convert.ChangeType(message, specific, CultureInfo.InvariantCulture); } -#elif NETSTANDARD10 || NETSTANDARD11 || NETSTANDARD12 || NETSTANDARD13 || NETSTANDARD14 || NETSTANDARD20 || UAP || NETFX_CORE || WINDOWS_UWP +#elif NETSTANDARD10 || NETSTANDARD11 || NETSTANDARD12 || NETSTANDARD13 || NETSTANDARD14 || NETSTANDARD20 || NET60 || UAP || NETFX_CORE || WINDOWS_UWP Type dataType = typeof(T).GetTypeInfo().GenericTypeArguments[0]; Type generic = typeof(PNMessageResult<>); Type specific = generic.MakeGenericType(dataType); diff --git a/src/Api/PubnubApi/PNConfiguration.cs b/src/Api/PubnubApi/PNConfiguration.cs index fba721405..c7c310685 100644 --- a/src/Api/PubnubApi/PNConfiguration.cs +++ b/src/Api/PubnubApi/PNConfiguration.cs @@ -9,8 +9,13 @@ public class PNConfiguration { private int presenceHeartbeatTimeout; private int presenceHeartbeatInterval; - private string uuid = ""; + private UserId _userId; + private bool uuidSetFromConstructor = false; + internal void ResetUuidSetFromConstructor() + { + uuidSetFromConstructor = false; + } public string Origin { get; set; } public int PresenceTimeout @@ -46,17 +51,24 @@ public int PresenceInterval public string AuthKey { get; set; } + [Obsolete("Uuid is deprecated, please use UserId instead.")] + public string Uuid { get { - return uuid; + return _userId.ToString(); } set { + if (_userId != null && !uuidSetFromConstructor) + { + throw new ArgumentException("Either UserId or Uuid can be used. Not both."); + } + if (value != null && value.Trim().Length > 0) { - uuid = value; + _userId = new UserId(value); } else { @@ -65,6 +77,31 @@ public string Uuid } } + public UserId UserId + { + get + { + return _userId; + } + set + { + if (uuidSetFromConstructor) + { + throw new ArgumentException("Either UserId or Uuid can be used. Not both."); + } + + if (value != null && !string.IsNullOrEmpty(value.ToString())) + { + uuidSetFromConstructor = false; + _userId = value; + } + else + { + throw new ArgumentException("Missing or Incorrect UserId"); + } + } + } + public PNLogVerbosity LogVerbosity { get; set; } public IPubnubLog PubnubLog { get; set; } @@ -102,35 +139,50 @@ public string Uuid public bool UseRandomInitializationVector { get; set; } public int FileMessagePublishRetryLimit { get; set; } + [Obsolete("PNConfiguration(string uuid) is deprecated, please use PNConfiguration(UserId userId) instead.")] public PNConfiguration(string uuid) { if (string.IsNullOrEmpty(uuid) || string.IsNullOrEmpty(uuid.Trim())) { throw new ArgumentException("Missing or Incorrect uuid value"); } + uuidSetFromConstructor = true; + ConstructorInit(new UserId(uuid)); + } - this.Origin = "ps.pndsn.com"; - this.presenceHeartbeatTimeout = 300; - this.NonSubscribeRequestTimeout = 10; - this.SubscribeTimeout = 310; - this.LogVerbosity = PNLogVerbosity.NONE; - this.CipherKey = ""; - this.PublishKey = ""; - this.SubscribeKey = ""; - this.SecretKey = ""; - this.Secure = true; - this.ReconnectionPolicy = PNReconnectionPolicy.NONE; - this.HeartbeatNotificationOption = PNHeartbeatNotificationOption.Failures; - this.IncludeRequestIdentifier = true; - this.IncludeInstanceIdentifier = false; - this.DedupOnSubscribe = false; - this.MaximumMessagesCacheSize = 100; - this.SuppressLeaveEvents = false; - this.UseRandomInitializationVector = true; - this.FileMessagePublishRetryLimit = 5; - this.Uuid = uuid; + public PNConfiguration(UserId userId) + { + if (userId == null || string.IsNullOrEmpty(userId.ToString())) + { + throw new ArgumentException("Missing or Incorrect UserId"); + } + uuidSetFromConstructor = false; + ConstructorInit(userId); } + private void ConstructorInit(UserId currentUserId) + { + Origin = "ps.pndsn.com"; + presenceHeartbeatTimeout = 300; + NonSubscribeRequestTimeout = 10; + SubscribeTimeout = 310; + LogVerbosity = PNLogVerbosity.NONE; + CipherKey = ""; + PublishKey = ""; + SubscribeKey = ""; + SecretKey = ""; + Secure = true; + ReconnectionPolicy = PNReconnectionPolicy.NONE; + HeartbeatNotificationOption = PNHeartbeatNotificationOption.Failures; + IncludeRequestIdentifier = true; + IncludeInstanceIdentifier = false; + DedupOnSubscribe = false; + MaximumMessagesCacheSize = 100; + SuppressLeaveEvents = false; + UseRandomInitializationVector = true; + FileMessagePublishRetryLimit = 5; + _userId = currentUserId; + } public PNConfiguration SetPresenceTimeoutWithCustomInterval(int timeout, int interval) { this.presenceHeartbeatTimeout = timeout; diff --git a/src/Api/PubnubApi/Properties/AssemblyInfo.cs b/src/Api/PubnubApi/Properties/AssemblyInfo.cs index 781c2dfb2..cd393ca44 100644 --- a/src/Api/PubnubApi/Properties/AssemblyInfo.cs +++ b/src/Api/PubnubApi/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: AssemblyProduct("Pubnub C# SDK")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("6.5.0.0")] -[assembly: AssemblyFileVersion("6.5.0.0")] +[assembly: AssemblyVersion("6.6.0.0")] +[assembly: AssemblyFileVersion("6.6.0.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. diff --git a/src/Api/PubnubApi/Pubnub.cs b/src/Api/PubnubApi/Pubnub.cs index 20409bb5d..4a3bc9789 100644 --- a/src/Api/PubnubApi/Pubnub.cs +++ b/src/Api/PubnubApi/Pubnub.cs @@ -412,19 +412,25 @@ public Guid GenerateGuid() return Guid.NewGuid(); } + [Obsolete("ChangeUUID is deprecated, please use ChangeUserId instead.")] public void ChangeUUID(string newUUID) { - if (newUUID != null && string.IsNullOrEmpty(newUUID.Trim())) + ChangeUserId(new UserId(newUUID)); + } + + public void ChangeUserId(UserId newUserId) + { + if (newUserId == null || string.IsNullOrEmpty(newUserId.ToString().Trim())) { if (pubnubLog != null && pubnubConfig != null) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, UUID cannot be null/empty.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId].LogVerbosity : PNLogVerbosity.NONE); + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, UserId cannot be null/empty.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId].LogVerbosity : PNLogVerbosity.NONE); } - throw new MissingMemberException("UUID cannot be null/empty"); + throw new MissingMemberException("UserId cannot be null/empty"); } EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); endPoint.CurrentPubnubInstance(this); - endPoint.ChangeUUID(newUUID); + endPoint.ChangeUserId(newUserId); } public static long TranslateDateTimeToPubnubUnixNanoSeconds(DateTime dotNetUTCDateTime) @@ -442,6 +448,13 @@ public static DateTime TranslatePubnubUnixNanoSecondsToDateTime(string unixNanoS return EndPoint.OtherOperation.TranslatePubnubUnixNanoSecondsToDateTime(unixNanoSecondTime); } + public UserId GetCurrentUserId() + { + EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, telemetryManager, tokenManager, this); + endPoint.CurrentPubnubInstance(this); + return endPoint.GetCurrentUserId(); + + } public List GetSubscribedChannels() { EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, null, tokenManager, this); @@ -873,13 +886,18 @@ public Pubnub(PNConfiguration config) LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, WARNING: The PresenceTimeout cannot be less than 20, defaulting the value to 20. Please update the settings in your code.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); } } - if (config != null && (string.IsNullOrEmpty(config.Uuid) || string.IsNullOrEmpty(config.Uuid.Trim()))) + if (config != null) { - if (pubnubLog != null) + if (config.UserId == null || string.IsNullOrEmpty(config.UserId.ToString())) { - LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, PNConfiguration.Uuid is required to use the SDK.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + if (pubnubLog != null) + { + LoggingMethod.WriteToLog(pubnubLog, string.Format("DateTime: {0}, PNConfiguration.Uuid or PNConfiguration.UserId is required to use the SDK.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); + } + throw new MissingMemberException("PNConfiguration.UserId is required to use the SDK"); } - throw new MissingMemberException("PNConfiguration.Uuid is required to use the SDK"); + + config.ResetUuidSetFromConstructor(); } } diff --git a/src/Api/PubnubApi/PubnubApi.csproj b/src/Api/PubnubApi/PubnubApi.csproj index b633ae66a..fc84fd6f8 100644 --- a/src/Api/PubnubApi/PubnubApi.csproj +++ b/src/Api/PubnubApi/PubnubApi.csproj @@ -1,7 +1,7 @@  - net35;net40;net45;net461 + net35;net40;net45;net461;net48 True pubnub.snk False @@ -13,7 +13,7 @@ Pubnub - 6.5.0.0 + 6.6.0.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -21,7 +21,8 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Suppress web request aborted exception message to callback. + Introduced UserId to PNConfiguration and deprecated UUID. +Added build target framework support to .Net Framework 4.8 and .Net 6.0. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously @@ -42,6 +43,9 @@ $(DefineConstants);NET461 + + $(DefineConstants);NET48 + 1701;1702;0436; @@ -114,4 +118,15 @@ + + + 4.3.0 + + + + + None + + + diff --git a/src/Api/PubnubApi/PubnubCoreBase.cs b/src/Api/PubnubApi/PubnubCoreBase.cs index 424bb7f6a..de7465e0a 100644 --- a/src/Api/PubnubApi/PubnubCoreBase.cs +++ b/src/Api/PubnubApi/PubnubCoreBase.cs @@ -13,7 +13,7 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 using System.Net.Http; using System.Net.Http.Headers; #endif @@ -44,7 +44,7 @@ public abstract class PubnubCoreBase private static EndPoint.TelemetryManager pubnubTelemetryMgr; protected static ConcurrentDictionary PubnubTokenMgrCollection { get; } = new ConcurrentDictionary(); private static EndPoint.DuplicationManager pubnubSubscribeDuplicationManager { get; set; } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 private static HttpClient httpClientSubscribe { get; set; } private static HttpClient httpClientNonsubscribe { get; set; } private static HttpClient httpClientNetworkStatus { get; set; } @@ -56,9 +56,9 @@ public abstract class PubnubCoreBase protected Pubnub PubnubInstance { get; set; } - protected bool UuidChanged { get; set; } + protected static ConcurrentDictionary UserIdChanged { get; set; } = new ConcurrentDictionary(); - protected string CurrentUuid { get; set; } + protected static ConcurrentDictionary CurrentUserId { get; set; } = new ConcurrentDictionary(); protected static ConcurrentDictionary LastSubscribeTimetoken { get; set; } = new ConcurrentDictionary(); protected static ConcurrentDictionary LastSubscribeRegion { get; set; } = new ConcurrentDictionary(); @@ -172,9 +172,9 @@ private void InternalConstructor(PNConfiguration pubnubConfiguation, IJsonPlugga pubnubTelemetryMgr = telemetryManager; pubnubSubscribeDuplicationManager = new EndPoint.DuplicationManager(pubnubConfiguation, jsonPluggableLibrary, log); - CurrentUuid = pubnubConfiguation.Uuid; + CurrentUserId.AddOrUpdate(instance.InstanceId, pubnubConfiguation.UserId, (k,o) => pubnubConfiguation.UserId); -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (httpClientSubscribe == null) { if (pubnubConfiguation.Proxy != null) @@ -297,7 +297,7 @@ protected bool CheckInternetConnectionStatus(bool systemActive, PNOperationTy ClientNetworkStatus.JsonLibrary = jsonLib; ClientNetworkStatus.PubnubUnitTest = unitTest; ClientNetworkStatus.PubnubLog = currentLog; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (httpClientNetworkStatus == null) { if (currentConfig.Proxy != null && pubnubHttpClientHandler != null) @@ -1071,7 +1071,7 @@ internal protected async Task> UrlProcessRequest(Uri } } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 //do nothing #else // Create Request @@ -1105,7 +1105,7 @@ internal protected async Task> UrlProcessRequest(Uri } string jsonString = ""; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubRequestState != null && pubnubRequestState.UsePostMethod) { jsonString = await pubnubHttp.SendRequestAndGetJsonResponseWithPOST(requestUri, pubnubRequestState, null, postOrPatchData, contentType).ConfigureAwait(false); @@ -1248,7 +1248,7 @@ internal protected async Task> UrlProcessRequestForStrea } } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 //do nothing #else // Create Request @@ -1282,7 +1282,7 @@ internal protected async Task> UrlProcessRequestForStrea } byte[] streamBytes; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 streamBytes = await pubnubHttp.SendRequestAndGetStreamResponse(requestUri, pubnubRequestState, null).ConfigureAwait(false); #else streamBytes = await pubnubHttp.SendRequestAndGetStreamResponse(requestUri, pubnubRequestState, request).ConfigureAwait(false); @@ -2322,7 +2322,7 @@ internal void EndPendingRequests() internal static void RemoveHttpClients() { //Conditionalmethod logic -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (httpClientNetworkStatus != null) { try{ @@ -2375,7 +2375,7 @@ internal void TerminateCurrentSubscriberRequest() catch { /* ignore */ } } } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (httpClientSubscribe != null) { try @@ -2387,7 +2387,7 @@ internal void TerminateCurrentSubscriberRequest() #endif } -#endregion + #endregion internal void Announce(PNStatus status) { diff --git a/src/Api/PubnubApi/PubnubHttp.cs b/src/Api/PubnubApi/PubnubHttp.cs index de1aeedc7..1609210ee 100644 --- a/src/Api/PubnubApi/PubnubHttp.cs +++ b/src/Api/PubnubApi/PubnubHttp.cs @@ -8,7 +8,7 @@ using System.Collections; using System.Threading.Tasks; using System.Globalization; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 using System.Net.Http; using System.Net.Http.Headers; #endif @@ -21,12 +21,12 @@ public class PubnubHttp : IPubnubHttp private readonly IJsonPluggableLibrary jsonLib; private readonly IPubnubLog pubnubLog; private readonly EndPoint.TelemetryManager pubnubTelemetryMgr; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 private static HttpClient httpClientSubscribe; private static HttpClient httpClientNonsubscribe; #endif -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 public PubnubHttp(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubLog log, EndPoint.TelemetryManager telemetryManager, HttpClient refHttpClientSubscribe, HttpClient refHttpClientNonsubscribe) #else public PubnubHttp(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubLog log, EndPoint.TelemetryManager telemetryManager) @@ -36,7 +36,7 @@ public PubnubHttp(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLib jsonLib = jsonPluggableLibrary; pubnubLog = log; pubnubTelemetryMgr = telemetryManager; -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 httpClientSubscribe = refHttpClientSubscribe; httpClientNonsubscribe = refHttpClientNonsubscribe; #endif @@ -55,7 +55,7 @@ HttpWebRequest IPubnubHttp.SetProxy(HttpWebRequest request) HttpWebRequest IPubnubHttp.SetTimeout(RequestState pubnubRequestState, HttpWebRequest request) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 request.Timeout = GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000; #endif return request; @@ -84,7 +84,7 @@ async Task IPubnubHttp.SendRequestAndGetJsonResponse(Uri requestUri, } else { -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) { return await SendRequestAndGetJsonResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); @@ -108,7 +108,7 @@ async Task IPubnubHttp.SendRequestAndGetStreamResponse(Uri requestUri } else { -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) { return await SendRequestAndGetStreamResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); @@ -133,7 +133,7 @@ async Task IPubnubHttp.SendRequestAndGetJsonResponseWithPOST(Uri requ } else { -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) { return await SendRequestAndGetJsonResponseTaskFactoryWithPOST(pubnubRequestState, request, postData, contentType).ConfigureAwait(false); @@ -157,7 +157,7 @@ async Task IPubnubHttp.SendRequestAndGetJsonResponseWithPATCH(Uri req } else { -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) { return await SendRequestAndGetJsonResponseTaskFactoryWithPATCH(pubnubRequestState, request, patchData).ConfigureAwait(false); @@ -172,7 +172,7 @@ async Task IPubnubHttp.SendRequestAndGetJsonResponseWithPATCH(Uri req } } -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 async Task SendRequestAndGetJsonResponseHttpClient(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request) { string jsonString = ""; @@ -574,7 +574,7 @@ async Task SendRequestAndGetJsonResponseTaskFactory(RequestState p if (pubnubRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif pubnubRequestState.Response = null; @@ -668,7 +668,7 @@ async Task SendRequestAndGetStreamResponseTaskFactory(RequestState if (pubnubRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif pubnubRequestState.Response = null; @@ -750,7 +750,7 @@ async Task SendRequestAndGetJsonResponseTaskFactoryWithPOST(RequestSt if (pubnubRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif pubnubRequestState.Response = null; @@ -843,7 +843,7 @@ async Task SendRequestAndGetJsonResponseTaskFactoryWithPATCH(RequestS if (pubnubRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif pubnubRequestState.Response = null; @@ -925,7 +925,7 @@ async Task SendRequestAndGetJsonResponseClassicHttp(Uri requestUri, R } if (asyncRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif asyncRequestState.Response = null; @@ -1012,7 +1012,7 @@ async Task SendRequestAndGetStreamResponseClassicHttp(RequestState } if (asyncRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif asyncRequestState.Response = null; @@ -1071,7 +1071,7 @@ async Task SendRequestAndGetJsonResponseClassicHttpWithPOST(RequestSt System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); -#if !NET35 && !NET40 && !NET45 && !NET461 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) { requestStream.Write(postData, 0, postData.Length); @@ -1114,7 +1114,7 @@ async Task SendRequestAndGetJsonResponseClassicHttpWithPOST(RequestSt } if (asyncRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif asyncRequestState.Response = null; @@ -1174,7 +1174,7 @@ async Task SendRequestAndGetJsonResponseClassicHttpWithPATCH(RequestS System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); -#if !NET35 && !NET40 && !NET45 && !NET461 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) { requestStream.Write(patchData, 0, patchData.Length); @@ -1217,7 +1217,7 @@ async Task SendRequestAndGetJsonResponseClassicHttpWithPATCH(RequestS } if (asyncRequestState.Response != null) { -#if NET35 || NET40 || NET45 || NET461 +#if NET35 || NET40 || NET45 || NET461 || NET48 pubnubRequestState.Response.Close(); #endif asyncRequestState.Response = null; diff --git a/src/Api/PubnubApi/PubnubHttpClientHandler.cs b/src/Api/PubnubApi/PubnubHttpClientHandler.cs index 08e974c49..d9a02d60a 100644 --- a/src/Api/PubnubApi/PubnubHttpClientHandler.cs +++ b/src/Api/PubnubApi/PubnubHttpClientHandler.cs @@ -1,4 +1,4 @@ -#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10 +#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 using System; using System.Collections.Generic; using System.Globalization; diff --git a/src/Api/PubnubApi/Timer.cs b/src/Api/PubnubApi/Timer.cs index 7ee86602e..ba764c8f3 100644 --- a/src/Api/PubnubApi/Timer.cs +++ b/src/Api/PubnubApi/Timer.cs @@ -6,7 +6,7 @@ namespace System.Threading { -#if NETSTANDARD10 || NETSTANDARD11 +#if NETSTANDARD10 || NETSTANDARD11 || NET60 public delegate void TimerCallback(object state); public sealed class Timer : CancellationTokenSource, IDisposable diff --git a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj index 1625e60bf..3fb3f859c 100644 --- a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj +++ b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj @@ -1,7 +1,7 @@  - netstandard1.0;netstandard1.3;netstandard1.4;netstandard1.1;netstandard2.0 + netstandard1.0;netstandard1.3;netstandard1.4;netstandard1.1;netstandard2.0;net6.0 true True pubnub.snk @@ -14,7 +14,7 @@ PubnubPCL - 6.5.0.0 + 6.6.0.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -22,7 +22,8 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Suppress web request aborted exception message to callback. + Introduced UserId to PNConfiguration and deprecated UUID. +Added build target framework support to .Net Framework 4.8 and .Net 6.0. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously @@ -389,6 +390,7 @@ Model\Consumer\Push\PNPushRemoveChannelResult.cs + Model\Derived\AccessManager\PNAccessManagerAuditResultExt.cs @@ -567,6 +569,10 @@ $(DefineConstants);NETSTANDARD20 + + $(DefineConstants);NET60 + + 1701;1702; @@ -579,23 +585,16 @@ - - + + None - - - - - - None - - - + + None @@ -626,9 +625,15 @@ - + + + None + + None + + None @@ -644,9 +649,15 @@ - + + + None + + None + + None @@ -683,7 +694,6 @@ - + + + None + + None + + None @@ -735,9 +751,15 @@ - + + None + + None + + + None @@ -772,6 +794,58 @@ None + + + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + @@ -815,7 +889,6 @@ PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously @@ -503,6 +504,7 @@ Model\Consumer\Push\PNPushRemoveChannelResult.cs + Model\Derived\AccessManager\PNAccessManagerAuditResultExt.cs diff --git a/src/Examples/PubnubApi.ConsoleExample/App.config b/src/Examples/PubnubApi.ConsoleExample/App.config index 49b92f82b..558ba0bf8 100644 --- a/src/Examples/PubnubApi.ConsoleExample/App.config +++ b/src/Examples/PubnubApi.ConsoleExample/App.config @@ -1,17 +1,17 @@ - + - + - - + + - - + + diff --git a/src/Examples/PubnubApi.ConsoleExample/PubnubApi.ConsoleExample.csproj b/src/Examples/PubnubApi.ConsoleExample/PubnubApi.ConsoleExample.csproj index 0792e04ae..a94501289 100644 --- a/src/Examples/PubnubApi.ConsoleExample/PubnubApi.ConsoleExample.csproj +++ b/src/Examples/PubnubApi.ConsoleExample/PubnubApi.ConsoleExample.csproj @@ -9,7 +9,7 @@ Properties PubnubApi.ConsoleExample PubnubApi.ConsoleExample - v4.6.1 + v4.8 512 true @@ -48,12 +48,17 @@ ..\..\packages\PeterO.Numbers.1.8.2\lib\net40\Numbers.dll - - ..\..\packages\Pubnub.6.1.0\lib\net461\Pubnub.dll + + ..\..\packages\Pubnub.6.5.0\lib\net48\Pubnub.dll + + ..\..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + ..\..\packages\System.IO.FileSystem.4.0.1\lib\net46\System.IO.FileSystem.dll True @@ -64,9 +69,19 @@ + + ..\..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + ..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + ..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + ..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll diff --git a/src/Examples/PubnubApi.ConsoleExample/PubnubAsyncAwaitExample.cs b/src/Examples/PubnubApi.ConsoleExample/PubnubAsyncAwaitExample.cs index e67a7de22..8e0def6e4 100644 --- a/src/Examples/PubnubApi.ConsoleExample/PubnubAsyncAwaitExample.cs +++ b/src/Examples/PubnubApi.ConsoleExample/PubnubAsyncAwaitExample.cs @@ -384,7 +384,7 @@ static public async Task MainAsync() menuOptionsStringBuilder.AppendLine("Enter 14 TO Set User State by Deleting existing Key-Pair"); menuOptionsStringBuilder.AppendLine("Enter 15 TO Get User State"); menuOptionsStringBuilder.AppendLine("Enter 16 FOR WhereNow"); - menuOptionsStringBuilder.AppendLine(string.Format("Enter 17 TO change UUID. (Current value = {0})", config.Uuid)); + menuOptionsStringBuilder.AppendLine(string.Format("Enter 17 TO change UUID. (Current value = {0})", pubnub.GetCurrentUserId().ToString())); menuOptionsStringBuilder.AppendLine("Enter 18 FOR Disconnect"); menuOptionsStringBuilder.AppendLine("Enter 19 FOR Reconnect"); menuOptionsStringBuilder.AppendLine("Enter 20 FOR UnsubscribeAll"); @@ -1180,7 +1180,8 @@ static public async Task MainAsync() { pubnub.ChangeUUID(newsessionUUID); Console.ForegroundColor = ConsoleColor.Blue; - Console.WriteLine("UUID = {0}", config.Uuid); + await Task.Delay(1000); + Console.WriteLine("UUID = {0}", pubnub.GetCurrentUserId().ToString()); Console.ResetColor(); } catch (Exception ex) diff --git a/src/Examples/PubnubApi.ConsoleExample/PubnubExample.cs b/src/Examples/PubnubApi.ConsoleExample/PubnubExample.cs index 25ba48ec3..f86ad2803 100644 --- a/src/Examples/PubnubApi.ConsoleExample/PubnubExample.cs +++ b/src/Examples/PubnubApi.ConsoleExample/PubnubExample.cs @@ -389,7 +389,7 @@ static public void Main() menuOptionsStringBuilder.AppendLine("Enter 14 TO Set User State by Deleting existing Key-Pair"); menuOptionsStringBuilder.AppendLine("Enter 15 TO Get User State"); menuOptionsStringBuilder.AppendLine("Enter 16 FOR WhereNow"); - menuOptionsStringBuilder.AppendLine(string.Format("Enter 17 TO change UUID. (Current value = {0})", config.Uuid)); + menuOptionsStringBuilder.AppendLine(string.Format("Enter 17 TO change UUID. (Current value = {0})", pubnub.GetCurrentUserId())); menuOptionsStringBuilder.AppendLine("Enter 18 FOR Disconnect"); menuOptionsStringBuilder.AppendLine("Enter 19 FOR Reconnect"); menuOptionsStringBuilder.AppendLine("Enter 20 FOR UnsubscribeAll"); @@ -474,7 +474,7 @@ static public void Main() Console.WriteLine("Running subscribe()"); pubnub.Subscribe() - //.WithPresence() + .WithPresence() .Channels(channel.Split(',')) .ChannelGroups(channelGroup.Split(',')) .Execute(); @@ -1183,7 +1183,8 @@ static public void Main() { pubnub.ChangeUUID(newsessionUUID); Console.ForegroundColor = ConsoleColor.Blue; - Console.WriteLine("UUID = {0}", config.Uuid); + Thread.Sleep(1000); + Console.WriteLine("UUID = {0}", pubnub.GetCurrentUserId()); Console.ResetColor(); } catch (Exception ex) diff --git a/src/Examples/PubnubApi.ConsoleExample/packages.config b/src/Examples/PubnubApi.ConsoleExample/packages.config index f0bc7d8e7..358e100e8 100644 --- a/src/Examples/PubnubApi.ConsoleExample/packages.config +++ b/src/Examples/PubnubApi.ConsoleExample/packages.config @@ -4,20 +4,21 @@ - + - + - - + + - - - + + + + - + \ No newline at end of file diff --git a/src/UnitTests/AcceptanceTests/AcceptanceTests.csproj b/src/UnitTests/AcceptanceTests/AcceptanceTests.csproj index 3dd23dbff..83341c47f 100644 --- a/src/UnitTests/AcceptanceTests/AcceptanceTests.csproj +++ b/src/UnitTests/AcceptanceTests/AcceptanceTests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/src/UnitTests/MockServerPubnubApi/MockServerPubnubApi.csproj b/src/UnitTests/MockServerPubnubApi/MockServerPubnubApi.csproj index 0045836a3..41e331582 100644 --- a/src/UnitTests/MockServerPubnubApi/MockServerPubnubApi.csproj +++ b/src/UnitTests/MockServerPubnubApi/MockServerPubnubApi.csproj @@ -1,7 +1,7 @@  - net35;net40;net45;net461 + net35;net40;net45;net461;net48 False false PubNub C# .NET - MockServerPubnubApi @@ -29,6 +29,9 @@ $(DefineConstants);NET461 + + $(DefineConstants);NET48 + diff --git a/src/UnitTests/MockServerPubnubApiPCL/MockServerPubnubApiPCL.csproj b/src/UnitTests/MockServerPubnubApiPCL/MockServerPubnubApiPCL.csproj index f58740da6..e6f85b28e 100644 --- a/src/UnitTests/MockServerPubnubApiPCL/MockServerPubnubApiPCL.csproj +++ b/src/UnitTests/MockServerPubnubApiPCL/MockServerPubnubApiPCL.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 False false PubNub C# .NET - MockServerPubnubApi @@ -35,6 +35,9 @@ $(DefineConstants);NETSTANDARD20 + + $(DefineConstants);NET60 + diff --git a/src/UnitTests/PubnubApi.Tests/CleanupGrant.cs b/src/UnitTests/PubnubApi.Tests/CleanupGrant.cs index fd28ef29f..43b1103a0 100644 --- a/src/UnitTests/PubnubApi.Tests/CleanupGrant.cs +++ b/src/UnitTests/PubnubApi.Tests/CleanupGrant.cs @@ -28,7 +28,7 @@ public static void AtUserLevel() if (!PubnubCommon.EnableStubTest) { receivedAuditMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -123,7 +123,7 @@ public static void AtChannelLevel() { receivedAuditMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs b/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs index e7dba6639..b7b0dd806 100644 --- a/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs +++ b/src/UnitTests/PubnubApi.Tests/EncryptionTests.cs @@ -151,7 +151,7 @@ public void ParseGrantTokenTest() //string token = "qEF2AkF0GmFLd-NDdHRsGQWgQ3Jlc6VEY2hhbqFjY2gxGP9DZ3JwoWNjZzEY_0N1c3KgQ3NwY6BEdXVpZKFldXVpZDEY_0NwYXSlRGNoYW6gQ2dycKBDdXNyoENzcGOgRHV1aWShYl4kAURtZXRho2VzY29yZRhkZWNvbG9yY3JlZGZhdXRob3JlcGFuZHVEdXVpZGtteWF1dGh1dWlkMUNzaWdYIP2vlxHik0EPZwtgYxAW3-LsBaX_WgWdYvtAXpYbKll3"; try { - PNConfiguration config = new PNConfiguration("unit-test-uuid") + PNConfiguration config = new PNConfiguration(new UserId("unit-test-uuid")) { SubscribeKey = PubnubCommon.SubscribeKey, PublishKey = PubnubCommon.PublishKey, @@ -225,7 +225,7 @@ public void TestYayDecryptionBasic() [Test] public void TestYayDecryptionBasicWithDynamicIV() { - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, null); string message = "MTIzNDU2Nzg5MDEyMzQ1NjdnONoCgo0wbuMGGMmfMX0="; @@ -249,7 +249,7 @@ public void TestYayByteArrayDecryptionBasic() [Test] public void TestYayByteArrayDecryptionBasicWithDynamicIV() { - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, null); byte[] messageBytes = new byte[] { 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 103, 56, 218, 2, 130, 141, 48, 110, 227, 6, 24, 201, 159, 49, 125 }; @@ -261,7 +261,7 @@ public void TestYayByteArrayDecryptionBasicWithDynamicIV() //[Test] public void TestMoonImageDecryption() { - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, null); string base64str = "TOAFyhNC/hcs8Hr0/A1KPf9HFXZe10sIs5GN5IL6CmB1Li+4xo00RxLgNR36al200s50iGiaCUvuiwT/r0aggSUq/+mx2Zfw1zSLVV8Lih/xbWS/2yMem9E4Pw1pBcO5A/pZIoE7rcc7HjBIJCS4kCLwBmyT+C8+b10dta/MJT///lhg9JEjEaNWbf4E52pod03Rz34ECnmu8y6X9GYWTDZHEGYbXRBb+viegbstoz0bqIqMdOyu7lD/YQZn1mQxQb9rcEDmTxpaEz52UE8/dVq0Fb/2uSHJtxs+PDaWcNy59p7XyadfaXCJmAR/HKU7R/LIvU1BHh20cs9t9UD9kWQbtgeicDqyxBxhdZmW9nuZXg9pM8ICELYDWGw8oEPG3bjNZ2pvZ/ho9zCcLD3GV+Q/Pflt9zXKmqUKvNOHGvOj4EePEl92Az5fCC91dfHjct1V/i7FJTUPvUPFs47RUmz9cPYH87W1RPvNs6tJGDUnfrwpzt84YZCln7PSZflqQzG3cnWweKN6V+2zVFSu5zrws3wHWzpfyidhxZiKnV+NiqCQrv6naWzI+o6txqGBpDsisvtGkWV8E3pO3nizzzw3jmGwgv0RC1FyulQri0wiJ66U9W9QcAiS3Li/3kWGfW8AorGBbxVuEPiiaMmP3a8aiwaJpd9t8Nr1MuXQcQt8Gl8HTiWBzxqjA1RQWRI5XBZcoN5kcJuDm3W+ks4CsSqYI45hCDbPkHER/+V1vu2e9oDyyKW6LU3tVV5fa7Av0W9leq9aWc7BnTGo7SXMzlqaYf+HQdjz9NvIyO6utRu38m3VmsORjFKEh7w2w6J59c0kK1adftp1wzcsFZQdRKHKwfh9fkIrwbBSAIzOmj5CXRBcS62czR8dsN4EF1309mSR1KB59J7TGnL6EOn7f3fV84bx05om+GXfWAL6avGzKDzV7SyRE3nCgHmgRKJYjIO+FnO5AI2w6CxnGevcNAahDkdy9mxHj6ayRuzxz4Feizemy1bvhB6Q1n5JQhl5cMW0Mhwv5xbQRaNMAqvVOxM8Z8V8ba3sKbjRv+SDp4fL7qF1Xt6Kg2XfQAtgkz+fqQDv9fQAnb95Yk05l62ac8xlWL0V4OOwVsyLH/e04kWNGb16Yezzp/9U659b9QeH7A7xCqT4QS2J5w9SUWAjBm9Nn3t7UDTsOr23+zuv4cWTanGjBH3Uv16sfzOS4cpSyzQDp3f/jD8tFJTC+TGm+INxx1W7gO7buQdekv9nmSjwLvLx1PZa9puxujP6x3eFo8ZT/qj/g1EN8miiD2n9bn1KzFMcRv1FispP73naqGKopbXyFNGDi8FYYI98QJiSooi7Zea2sTr/uSJETO0X5Ebwrq6GTPT9PhkVFNJ6JGrQnCwdDAHyMzDXfktT6pfKsaS52SELw+mUXIXA5fOl9qac4iqM549R0S0gLX10bNnZ+xWCwwjp7soo2XHlFlW4GazLimI7HnuM/SqQaLD0PGb1rbLm9hbto/6h4W3+nQAOIwMkOxAh8jW5gqSpIJ9oNFdAUdTmRXUdlLOwwIiom/KN65AVgZuLFs0yppTANYOdFKYIt0wYTy2FyQfzYnTqEovXWbcAxLFqry/NknTPArp+uBQ4BwZOmPjpzJ769WeAtxpbImQVDUvtDbZyrJ9LeHCtfiRuwPgmRUE5pukPgaZ4eA1YddkKb1guiA73QOhhtJinDzZ+T93MfqH6CyKJs1ozvu3mEPpZpvqjxDP2BdMh561KLSVt0BhW0DdwDGiRyKCalOwh92S9dT31x1BldGJWHf6h+WEupZS+fH8ZbHYqDppy6lbPJEOP/IVFXsdAA30aUzjQHHm+UOtbxvzU4Lzs6kBFsxc24uFL1tkv/5aTyoWjxcQxU0b2aX8voiITtLUL7lsSAG58Lsd1G5lt/jWCtA6bKZLdfwJrJR/Qc9HZMlzbd+WCpVz+1ALaf5dRZtiIZRtR95VCiqsBhExMZIxLLVmaDfRFRZM0KF/eqXQmFz6+gAXdkcLgRTWGQPj1Lv5ybfSGmkMEKkOZ86djuGlnfZlj4LsuTUUn1IHeYD+DfJ9PUy5EAuXINXdYgAm16DOQp385xf6c0DeNhDhS/OBIhFWkW9XA7rmX0JjsNaVQLScRe6YSzo2GQ28EkGfrpOL74PwI72FHTNKqkftu"; byte[] messageBytes = Convert.FromBase64CharArray(base64str.ToCharArray(), 0, base64str.Length); @@ -278,7 +278,7 @@ public void TestFileEncryptionFromPath() { IPubnubUnitTest pubnubUnitTest = new PubnubUnitTest(); pubnubUnitTest.IV = new byte[16] { 21, 113, 108, 52, 211, 105, 24, 46, 175, 249, 87, 111, 60, 71, 232, 107 }; - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true, LogVerbosity= PNLogVerbosity.BODY }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true, LogVerbosity= PNLogVerbosity.BODY }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, pubnubUnitTest); byte[] fileByteArray = System.IO.File.ReadAllBytes(@"C:\Pandu\temp\new\input\word_test.txt"); @@ -300,7 +300,7 @@ public void TestLocalFileEncryptionFromPath() { System.IO.File.Delete(destFile); } - PNConfiguration config = new PNConfiguration("uuid"); + PNConfiguration config = new PNConfiguration(new UserId("uuid")); Pubnub pn = new Pubnub(config); pn.EncryptFile(sourceFile, destFile, "enigma"); Assert.IsTrue(System.IO.File.Exists(destFile)); @@ -316,7 +316,7 @@ public void TestLocalFileDecryptionFromPath() { System.IO.File.Delete(destFile); } - PNConfiguration config = new PNConfiguration("unit-test-uuid"); + PNConfiguration config = new PNConfiguration(new UserId("unit-test-uuid")); Pubnub pn = new Pubnub(config); pn.DecryptFile(sourceFile, destFile, "enigma"); Assert.IsTrue(System.IO.File.Exists(destFile)); @@ -344,7 +344,7 @@ public void TestYayEncryptionBasicWithDynamicIV() { IPubnubUnitTest pubnubUnitTest = new PubnubUnitTest(); pubnubUnitTest.IV = new byte[16] { 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54 }; - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, pubnubUnitTest); ////deserialized string string message = "yay!"; @@ -377,7 +377,7 @@ public void TestYayByteArrayEncryptionBasicWithDynamicIV() { IPubnubUnitTest pubnubUnitTest = new PubnubUnitTest(); pubnubUnitTest.IV = new byte[16] { 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54 }; - PNConfiguration config = new PNConfiguration("uuid") { UseRandomInitializationVector = true }; + PNConfiguration config = new PNConfiguration(new UserId("uuid")) { UseRandomInitializationVector = true }; PubnubCrypto pc = new PubnubCrypto("enigma", config, null, pubnubUnitTest); ////deserialized string string message = "yay!"; diff --git a/src/UnitTests/PubnubApi.Tests/GenerateSampleGrant.cs b/src/UnitTests/PubnubApi.Tests/GenerateSampleGrant.cs index bd3b64ebe..cd3f99ec5 100644 --- a/src/UnitTests/PubnubApi.Tests/GenerateSampleGrant.cs +++ b/src/UnitTests/PubnubApi.Tests/GenerateSampleGrant.cs @@ -49,7 +49,7 @@ public static void AtUserLevel() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -79,7 +79,7 @@ public static void AtUserLevel() .WithParameter("r", "1") .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "tCnUUS8KPeTmepj_b2mLoEny3shgtxX1JzhbIIyA0wU=") .WithResponse(expected) @@ -110,7 +110,7 @@ public static void AtChannelLevel() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -138,7 +138,7 @@ public static void AtChannelLevel() .WithParameter("r", "1") .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "gumjPtSDtaYGB7Pj-fFUY-ZFD_jKuu7n9sQEBhNbAKg=") .WithResponse(expected) diff --git a/src/UnitTests/PubnubApi.Tests/PubnubApi.Tests.csproj b/src/UnitTests/PubnubApi.Tests/PubnubApi.Tests.csproj index e668d9912..ae358d01b 100644 --- a/src/UnitTests/PubnubApi.Tests/PubnubApi.Tests.csproj +++ b/src/UnitTests/PubnubApi.Tests/PubnubApi.Tests.csproj @@ -1,7 +1,7 @@  - net35;net40;net45;net461 + net35;net40;net45;net461;net48 false Debug AnyCPU @@ -26,6 +26,9 @@ $(DefineConstants);NET461 + + $(DefineConstants);NET48 + @@ -61,6 +64,11 @@ + + + + + diff --git a/src/UnitTests/PubnubApi.Tests/WhenAClientIsPresented.cs b/src/UnitTests/PubnubApi.Tests/WhenAClientIsPresented.cs index 0f0948e88..cb64414c7 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenAClientIsPresented.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenAClientIsPresented.cs @@ -43,7 +43,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -133,7 +133,7 @@ public static void ThenPresenceShouldReturnReceivedMessage() bool receivedPresenceMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -186,7 +186,7 @@ public static void ThenPresenceShouldReturnReceivedMessage() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "_JVs4gooSMhdgxRO6FNkk6HwlkyxqcRATHU5j3vkJ9s=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -227,7 +227,7 @@ public static void ThenPresenceShouldReturnReceivedMessageSSL() bool receivedPresenceMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -282,7 +282,7 @@ public static void ThenPresenceShouldReturnReceivedMessageSSL() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "_JVs4gooSMhdgxRO6FNkk6HwlkyxqcRATHU5j3vkJ9s=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -316,14 +316,14 @@ public static void ThenPresenceShouldReturnReceivedMessageSSL() } [Test] - public static void ThenPresenceShouldReturnCustomUUID() + public static void ThenPresenceShouldReturnCustomUserId() { server.ClearRequests(); - string customUUID = "mylocalmachine.mydomain.com"; + UserId customUserId = new UserId("mylocalmachine.mydomain.com"); bool receivedCustomUUID = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -365,7 +365,7 @@ public static void ThenPresenceShouldReturnCustomUUID() string channel = "hello_my_channel"; manualResetEventWaitTimeout = 310 * 1000; - pubnub.ChangeUUID(customUUID); + pubnub.ChangeUserId(customUserId); string expected = "{\"t\":{\"t\":\"14833694874957031\",\"r\":7},\"m\":[{\"a\":\"4\",\"f\":512,\"p\":{\"t\":\"14833694873794045\",\"r\":2},\"k\":\"demo-36\",\"c\":\"hello_my_channel-pnpres\",\"d\":{\"action\": \"join\", \"timestamp\": 1483369487, \"uuid\": \"mylocalmachine.mydomain.com\", \"occupancy\": 1},\"b\":\"hello_my_channel-pnpres\"}]}"; @@ -377,7 +377,7 @@ public static void ThenPresenceShouldReturnCustomUUID() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", customUUID) + .WithParameter("uuid", customUserId.ToString()) .WithParameter("signature", "D7lw9Np5UU_xUTUAe0Sc0L0eSP9aTQljeith_M_rXzI=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -419,7 +419,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfo() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -468,7 +468,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfo() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -543,7 +543,7 @@ public static async Task IfWithAsyncHereNowIsCalledThenItShouldReturnInfo() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -592,7 +592,7 @@ public static async Task IfWithAsyncHereNowIsCalledThenItShouldReturnInfo() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -665,7 +665,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipher() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -717,7 +717,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipher() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -786,7 +786,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSecret() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -837,7 +837,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSecret() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "o3VANfuhvrxfff1jsBMOc6EQ4LCe8LXHGaDh58QBZFA=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -905,7 +905,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSecretSSL() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -956,7 +956,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSecretSSL() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "o3VANfuhvrxfff1jsBMOc6EQ4LCe8LXHGaDh58QBZFA=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1025,7 +1025,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSSL() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1076,7 +1076,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoCipherSSL() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1145,7 +1145,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSecret() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1195,7 +1195,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSecret() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "o3VANfuhvrxfff1jsBMOc6EQ4LCe8LXHGaDh58QBZFA=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1263,7 +1263,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSecretSSL() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1313,7 +1313,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSecretSSL() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "o3VANfuhvrxfff1jsBMOc6EQ4LCe8LXHGaDh58QBZFA=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1382,7 +1382,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSSL() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1432,7 +1432,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoSSL() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1503,7 +1503,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoWithUserState() bool receivedHereNowMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1553,7 +1553,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoWithUserState() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1582,12 +1582,12 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoWithUserState() server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("state", "%7B%22testkey%22%3A%22testval%22%7D") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1612,7 +1612,7 @@ public static void IfHereNowIsCalledThenItShouldReturnInfoWithUserState() .WithParameter("requestid", "myRequestId") .WithParameter("state", "1") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1660,7 +1660,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfo() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1709,7 +1709,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfo() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "o3VANfuhvrxfff1jsBMOc6EQ4LCe8LXHGaDh58QBZFA=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1721,7 +1721,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfo() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1750,7 +1750,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfo() .WithParameter("requestid", "myRequestId") .WithParameter("state", "0") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1795,7 +1795,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState() bool receivedHereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1842,7 +1842,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1868,12 +1868,12 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState() server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("state", "%7B%22testkey%22%3A%22testval%22%7D") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1899,7 +1899,7 @@ public static void IfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState() .WithParameter("requestid", "myRequestId") .WithParameter("state", "1") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1946,7 +1946,7 @@ public static void IfWhereNowIsCalledThenItShouldReturnInfo() bool receivedWhereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1994,7 +1994,7 @@ public static void IfWhereNowIsCalledThenItShouldReturnInfo() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2017,16 +2017,16 @@ public static void IfWhereNowIsCalledThenItShouldReturnInfo() server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/uuid/{1}", PubnubCommon.SubscribeKey, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/uuid/{1}", PubnubCommon.SubscribeKey, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); ManualResetEvent whereNowManualEvent = new ManualResetEvent(false); - pubnub.WhereNow().Uuid(config.Uuid).Execute(new PNWhereNowResultExt( + pubnub.WhereNow().Uuid(config.UserId).Execute(new PNWhereNowResultExt( (r, s) => { Debug.WriteLine(pubnub.JsonPluggableLibrary.SerializeToJsonString(r)); receivedWhereNowMessage = true; @@ -2068,7 +2068,7 @@ public static async Task IfWithAsyncWhereNowIsCalledThenItShouldReturnInfo() bool receivedWhereNowMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2116,7 +2116,7 @@ public static async Task IfWithAsyncWhereNowIsCalledThenItShouldReturnInfo() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2139,18 +2139,18 @@ public static async Task IfWithAsyncWhereNowIsCalledThenItShouldReturnInfo() server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/uuid/{1}", PubnubCommon.SubscribeKey, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/uuid/{1}", PubnubCommon.SubscribeKey, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); #if NET40 - PNResult r = Task.Factory.StartNew(async () => await pubnub.WhereNow().Uuid(config.Uuid).ExecuteAsync()).Result.Result; + PNResult r = Task.Factory.StartNew(async () => await pubnub.WhereNow().Uuid(config.UserId).ExecuteAsync()).Result.Result; #else - PNResult r = await pubnub.WhereNow().Uuid(config.Uuid).ExecuteAsync(); + PNResult r = await pubnub.WhereNow().Uuid(config.UserId).ExecuteAsync(); #endif if (r.Result != null) { @@ -2187,10 +2187,10 @@ public static void IfSetAndGetUserStateThenItShouldReturnInfo() { server.ClearRequests(); - string customUUID = "mylocalmachine.mydomain.com"; + UserId customUserId = new UserId("mylocalmachine.mydomain.com"); bool receivedUserStateMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2208,7 +2208,7 @@ public static void IfSetAndGetUserStateThenItShouldReturnInfo() server.RunOnHttps(false); pubnub = createPubNubInstance(config); - pubnub.ChangeUUID(customUUID); + pubnub.ChangeUserId(customUserId); manualResetEventWaitTimeout = 310 * 1000; string channel = "hello_my_channel"; @@ -2219,7 +2219,7 @@ public static void IfSetAndGetUserStateThenItShouldReturnInfo() string expected = "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"testkey\": \"testval\"}, \"service\": \"Presence\"}"; server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, customUUID)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, customUserId.ToString())) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2247,7 +2247,7 @@ public static void IfSetAndGetUserStateThenItShouldReturnInfo() expected = "{\"status\": 200, \"uuid\": \"mylocalmachine.mydomain.com\", \"service\": \"Presence\", \"message\": \"OK\", \"payload\": {\"testkey\": \"testval\"}, \"channel\": \"hello_my_channel\"}"; server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}", PubnubCommon.SubscribeKey, channel, customUUID)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}", PubnubCommon.SubscribeKey, channel, customUserId.ToString())) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2275,7 +2275,7 @@ public static void IfSetAndDeleteUserStateThenItShouldReturnInfo() Request getRequest = new Request(); bool receivedUserStateMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2304,12 +2304,12 @@ public static void IfSetAndDeleteUserStateThenItShouldReturnInfo() string expected = "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"k\": \"v\"}, \"service\": \"Presence\"}"; server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("state", "%7B%22k%22%3A%22v%22%7D") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2334,11 +2334,11 @@ public static void IfSetAndDeleteUserStateThenItShouldReturnInfo() expected = "{\"status\": 200, \"uuid\": \"mytestuuid\", \"service\": \"Presence\", \"message\": \"OK\", \"payload\": {\"k\": \"v\"}, \"channel\": \"hello_my_channel\"}"; getRequest = new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}", PubnubCommon.SubscribeKey, channel, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}", PubnubCommon.SubscribeKey, channel, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK); server.AddRequest(getRequest); @@ -2371,12 +2371,12 @@ public static void IfSetAndDeleteUserStateThenItShouldReturnInfo() expected = "{\"status\": 200, \"message\": \"OK\", \"payload\": {\"k\": null}, \"service\": \"Presence\"}"; server.AddRequest(new Request() .WithMethod("GET") - .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.Uuid)) + .WithPath(String.Format("/v2/presence/sub_key/{0}/channel/{1}/uuid/{2}/data", PubnubCommon.SubscribeKey, channel, config.UserId)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("state", "%7B%22k%22%3Anull%7D") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2430,7 +2430,7 @@ public static void ThenPresenceHeartbeatShouldReturnMessage() bool receivedPresenceMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2482,7 +2482,7 @@ public static void ThenPresenceHeartbeatShouldReturnMessage() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "_JVs4gooSMhdgxRO6FNkk6HwlkyxqcRATHU5j3vkJ9s=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenAMessageIsPublished.cs b/src/UnitTests/PubnubApi.Tests/WhenAMessageIsPublished.cs index c96690eec..37f914b24 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenAMessageIsPublished.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenAMessageIsPublished.cs @@ -6,7 +6,7 @@ using MockServer; using System.Diagnostics; using System.Threading.Tasks; -#if NETSTANDARD20 +#if NETSTANDARD20 || NET60 using PubnubApiPCL.Tests; #else using PubnubApi.Tests; @@ -40,7 +40,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -65,7 +65,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -121,7 +121,7 @@ public static void ThenNullMessageShouldReturnException() string channel = "hello_my_channel"; object message = null; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -144,7 +144,7 @@ public static void ThenNullMessageShouldReturnException() server.AddRequest(new Request() .WithMethod("GET") .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, message)) - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -174,7 +174,7 @@ public static void ThenUnencryptPublishGETShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; string message = messageForUnencryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -198,7 +198,7 @@ public static void ThenUnencryptPublishGETShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22Pubnub%20Messaging%20API%201%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -237,7 +237,7 @@ public static void ThenUnencryptPublishGETShouldReturnSuccessCodeAndInfo() .WithParameter("include_token", "true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -280,7 +280,7 @@ public static async Task ThenWithAsyncUnencryptPublishGETShouldReturnSuccessCode string channel = "hello_my_channel"; string message = messageForUnencryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -304,7 +304,7 @@ public static async Task ThenWithAsyncUnencryptPublishGETShouldReturnSuccessCode .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22Pubnub%20Messaging%20API%201%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -339,7 +339,7 @@ public static async Task ThenWithAsyncUnencryptPublishGETShouldReturnSuccessCode .WithParameter("include_token", "true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -381,7 +381,7 @@ public static void ThenUnencryptFireGETShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; string message = messageForUnencryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -405,7 +405,7 @@ public static void ThenUnencryptFireGETShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22Pubnub%20Messaging%20API%201%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -444,7 +444,7 @@ public static void ThenUnencryptPublishPOSTShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; string message = messageForUnencryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -468,7 +468,7 @@ public static void ThenUnencryptPublishPOSTShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22Pubnub%20Messaging%20API%201%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -507,7 +507,7 @@ public static void ThenUnencryptPublishPOSTShouldReturnSuccessCodeAndInfo() .WithParameter("include_token", "true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -546,7 +546,7 @@ public static void ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; object message = new CustomClass(); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -569,7 +569,7 @@ public static void ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%7B%22foo%22%3A%22hi%21%22%2C%22bar%22%3A%5B1%2C2%2C3%2C4%2C5%5D%7D")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -608,7 +608,7 @@ public static void ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo() .WithParameter("include_token", "true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -647,7 +647,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; object message = new SecretCustomClass(); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -672,7 +672,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22nQTUCOeyWWgWh5NRLhSlhIingu92WIQ6RFloD9rOZsTUjAhD7AkMaZJVgU7l28e2%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -710,7 +710,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo() .WithParameter("end", "14715325228931129") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -749,7 +749,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfoWithSSL string channel = "hello_my_channel"; object message = new SecretCustomClass(); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -774,7 +774,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfoWithSSL .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22nQTUCOeyWWgWh5NRLhSlhIingu92WIQ6RFloD9rOZsTUjAhD7AkMaZJVgU7l28e2%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -812,7 +812,7 @@ public static void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfoWithSSL .WithParameter("end", "14715325228931129") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -851,7 +851,7 @@ public static void ThenEncryptPublishShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; string message = messageForEncryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -876,7 +876,7 @@ public static void ThenEncryptPublishShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22%2BBY5%2FmiAA8aeuhVl4d13Kg%3D%3D%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -919,7 +919,7 @@ public static void ThenEncryptPublishShouldReturnSuccessCodeAndInfo() .WithParameter("include_token","true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -962,7 +962,7 @@ public static void ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo string channel = "hello_my_channel"; string message = messageForSecretEncryptPublish; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -990,7 +990,7 @@ public static void ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "tcFpCYsp1uiqyWCZxvdJp7KXEXjyvCFnH6F4UjJ6mds=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1030,7 +1030,7 @@ public static void ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "WyHIBPHildY1gtERK5uDGqX8RyKnrqQFegoOoHizsV4=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1070,7 +1070,7 @@ public static void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; object message = new PubnubDemoObject(); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1095,7 +1095,7 @@ public static void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%7B%22VersionID%22:3.4%2C%22Timetoken%22:%2213601488652764619%22%2C%22OperationName%22:%22Publish%22%2C%22Channels%22:%5B%22ch1%22%5D%2C%22DemoMessage%22:%7B%22DefaultMessage%22:%22~!%40%23%24%25%5E%26*()_%2B%20%601234567890-%3D%20qwertyuiop%5B%5D%5C%5C%20%7B%7D%7C%20asdfghjkl%3B'%20:%5C%22%20zxcvbnm%2C.%2F%20%3C%3E%3F%20%22%7D%2C%22CustomMessage%22:%7B%22DefaultMessage%22:%22Welcome%20to%20the%20world%20of%20Pubnub%20for%20Publish%20and%20Subscribe.%20Hah!%22%7D%2C%22SampleXml%22:%5B%7B%22ID%22:%22ABCD123%22%2C%22Name%22:%7B%22First%22:%22John%22%2C%22Middle%22:%22P.%22%2C%22Last%22:%22Doe%22%7D%2C%22Address%22:%7B%22Street%22:%22123%20Duck%20Street%22%2C%22City%22:%22New%20City%22%2C%22State%22:%22New%20York%22%2C%22Country%22:%22United%20States%22%7D%7D%2C%7B%22ID%22:%22ABCD456%22%2C%22Name%22:%7B%22First%22:%22Peter%22%2C%22Middle%22:%22Z.%22%2C%22Last%22:%22Smith%22%7D%2C%22Address%22:%7B%22Street%22:%2212%20Hollow%20Street%22%2C%22City%22:%22Philadelphia%22%2C%22State%22:%22Pennsylvania%22%2C%22Country%22:%22United%20States%22%7D%7D%5D%7D", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1134,7 +1134,7 @@ public static void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() .WithParameter("include_token", "true") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1166,14 +1166,14 @@ public static void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() [Test] public static void ThenPubnubShouldFailOnWithoutSettingUuid() { - PNConfiguration config = new PNConfiguration("mytestuuid") + Assert.Throws(() => { - PublishKey = PubnubCommon.PublishKey, - SubscribeKey = PubnubCommon.SubscribeKey, - }; + PNConfiguration config = new PNConfiguration(new UserId("")) + { + PublishKey = PubnubCommon.PublishKey, + SubscribeKey = PubnubCommon.SubscribeKey, + }; - Assert.Throws(() => - { pubnub = createPubNubInstance(config); }); @@ -1183,7 +1183,7 @@ public static void ThenPubnubShouldFailOnWithoutSettingUuid() [Test] public static void ThenPublishKeyShouldNotBeEmpty() { - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = "", SubscribeKey = PubnubCommon.SubscribeKey, @@ -1212,7 +1212,7 @@ public static void ThenOptionalSecretKeyShouldBeProvidedInConfig() bool receivedPublishMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1241,7 +1241,7 @@ public static void ThenOptionalSecretKeyShouldBeProvidedInConfig() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "CkHf9ur70OxnkkPvzc9PCPbSbq_SHq2hfYbfDHXh90Q=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1278,7 +1278,7 @@ public static void IfSSLNotProvidedThenDefaultShouldBeTrue() string channel = "hello_my_channel"; string message = "Pubnub API Usage Example"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1301,7 +1301,7 @@ public static void IfSSLNotProvidedThenDefaultShouldBeTrue() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%22Pubnub%20API%20Usage%20Example%22", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1496,7 +1496,7 @@ private static bool SampleXSecretKeyWithoutAuthThenGetMessageWithSpecialCharsRet string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("myuuid") + PNConfiguration config = new PNConfiguration(new UserId("myuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1523,7 +1523,7 @@ private static bool SampleXSecretKeyWithoutAuthThenGetMessageWithSpecialCharsRet .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%22%21%22", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1569,7 +1569,7 @@ public static void IfSecretKeyCipherKeyWithoutAuthThenGetMessageWithSpecialChars string channel = "hello_my_channel ~!@#$%^&()+=[]{}|;\"<>?-_.aA1©®€™₹😜🎉"; string message = " ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉"; - PNConfiguration config = new PNConfiguration("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid") + PNConfiguration config = new PNConfiguration(new UserId("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1597,7 +1597,7 @@ public static void IfSecretKeyCipherKeyWithoutAuthThenGetMessageWithSpecialChars .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%22%21%22", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1649,7 +1649,7 @@ public static void IfSecretKeyWithoutAuthThenPostMessageWithSpecialCharsReturnSu //var message = new { a="!" }; //":"; - PNConfiguration config = new PNConfiguration("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid") + PNConfiguration config = new PNConfiguration(new UserId("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1676,7 +1676,7 @@ public static void IfSecretKeyWithoutAuthThenPostMessageWithSpecialCharsReturnSu .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%22%21%22", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1721,7 +1721,7 @@ public static void IfSecretKeyCipherKeyWithoutAuthThenPostMessageWithSpecialChar string channel = "hello_my_channel ~!@#$%^&()+=[]{}|;\"<>?-_.aA1©®€™₹😜🎉"; string message = " ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉"; - PNConfiguration config = new PNConfiguration("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid") + PNConfiguration config = new PNConfiguration(new UserId("my ~`!@#$%^&*()+=[]\\{}|;':\",/<>?-_.aA1©®€™₹😜🎉uuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1749,7 +1749,7 @@ public static void IfSecretKeyCipherKeyWithoutAuthThenPostMessageWithSpecialChar .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/%22%21%22", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel)) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1832,8 +1832,8 @@ public static void IfMobilePayloadThenPublishReturnSuccess() .Custom(pushTypeCustomData) .GetPayload(); - - pubnub = new Pubnub(null); + PNConfiguration config = new PNConfiguration(new UserId("testuuid")); + pubnub = new Pubnub(config); System.Diagnostics.Debug.WriteLine(pubnub.JsonPluggableLibrary.SerializeToJsonString(payload)); Assert.IsTrue(payload != null, "FAILED - IfMobilePayloadThenPublishReturnSuccess"); diff --git a/src/UnitTests/PubnubApi.Tests/WhenAMessageIsSignaled.cs b/src/UnitTests/PubnubApi.Tests/WhenAMessageIsSignaled.cs index 64ae175e6..94bbdb6d4 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenAMessageIsSignaled.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenAMessageIsSignaled.cs @@ -32,7 +32,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -57,7 +57,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -123,7 +123,7 @@ public static void ThenUnencryptSignalShouldReturnSuccessCodeAndInfo() string channel = "hello_my_channel"; string message = messageForUnencryptSignal; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -149,7 +149,7 @@ public static void ThenUnencryptSignalShouldReturnSuccessCodeAndInfo() .WithContent("{\"message\":\"%22Pubnub%20Messaging%20API%201%22\"}") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -198,7 +198,7 @@ public static async Task ThenWithAsyncUnencryptSignalShouldReturnSuccessCodeAndI string channel = "hello_my_channel"; string message = messageForUnencryptSignal; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -224,7 +224,7 @@ public static async Task ThenWithAsyncUnencryptSignalShouldReturnSuccessCodeAndI .WithContent("{\"message\":\"%22Pubnub%20Messaging%20API%201%22\"}") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -265,7 +265,7 @@ public static void ThenUnencryptSignalListenerShouldGetMessagae() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -376,7 +376,7 @@ public static async Task ThenWithAsyncUnencryptSignalListenerShouldGetMessagae() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -480,7 +480,7 @@ public static void ThenIgnoreCipherKeyUnencryptSignalListenerShouldGetMessagae() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -591,7 +591,7 @@ public static async Task ThenWithAsyncIgnoreCipherKeyUnencryptSignalListenerShou return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenAuditIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenAuditIsRequested.cs index be50ccabe..05a3ea686 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenAuditIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenAuditIsRequested.cs @@ -42,7 +42,7 @@ public static void ThenSubKeyLevelShouldReturnSuccess() currentUnitTestCase = "ThenSubKeyLevelShouldReturnSuccess"; receivedAuditMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -60,7 +60,7 @@ public static void ThenSubKeyLevelShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zNRxtKgMlbcnwlamcfesFaXmG9DK2wirgob3a37Xyo0=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -95,7 +95,7 @@ public static void ThenChannelLevelShouldReturnSuccess() receivedAuditMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -114,7 +114,7 @@ public static void ThenChannelLevelShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "EdYHODFD_SaOGUkN8_QT3GpcjYdAzA71xvJfFXq2sUU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -148,7 +148,7 @@ public static void ThenChannelGroupLevelShouldReturnSuccess() string channelgroup = "hello_my_group"; receivedAuditMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -167,7 +167,7 @@ public static void ThenChannelGroupLevelShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "0xTp9FTQGMLn9cKlxqhTagtzc1r2BfaOlOym0XJ9qiQ=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenChannelGroupIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenChannelGroupIsRequested.cs index c70ecef90..87f4233b6 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenChannelGroupIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenChannelGroupIsRequested.cs @@ -42,7 +42,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -65,7 +65,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "mnWJN7WSbajMt_LWpuiXGhcs3NUcVbU3L_MZpb9_blU=") .WithResponse(expected) @@ -97,7 +97,7 @@ public static void ThenAddChannelShouldReturnSuccess() currentUnitTestCase = "ThenAddChannelShouldReturnSuccess"; receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -121,7 +121,7 @@ public static void ThenAddChannelShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -152,7 +152,7 @@ public static async Task ThenWithAsyncAddChannelShouldReturnSuccess() currentUnitTestCase = "ThenAddChannelShouldReturnSuccess"; receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -176,7 +176,7 @@ public static async Task ThenWithAsyncAddChannelShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -215,7 +215,7 @@ public static void ThenRemoveChannelShouldReturnSuccess() string channelName = "hello_my_channel"; receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -239,7 +239,7 @@ public static void ThenRemoveChannelShouldReturnSuccess() .WithParameter("remove", channelName) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "bTwraHYh6dEMi44y-WgHslZdKSltsMySX5cg0uHt9tE=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -272,7 +272,7 @@ public static async Task ThenWithAsyncRemoveChannelShouldReturnSuccess() string channelName = "hello_my_channel"; receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -296,7 +296,7 @@ public static async Task ThenWithAsyncRemoveChannelShouldReturnSuccess() .WithParameter("remove", channelName) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "bTwraHYh6dEMi44y-WgHslZdKSltsMySX5cg0uHt9tE=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -338,7 +338,7 @@ public static void ThenGetChannelListShouldReturnSuccess() receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -361,7 +361,7 @@ public static void ThenGetChannelListShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "03YaQgvhwhQ9wMg3RLSYolTDzOpuuGoRzE5a7sEMLds=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -393,7 +393,7 @@ public static async Task ThenWithAsyncGetChannelListShouldReturnSuccess() receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -416,7 +416,7 @@ public static async Task ThenWithAsyncGetChannelListShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "03YaQgvhwhQ9wMg3RLSYolTDzOpuuGoRzE5a7sEMLds=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -459,7 +459,7 @@ public static void ThenGetAllChannelGroupShouldReturnSuccess() receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -482,7 +482,7 @@ public static void ThenGetAllChannelGroupShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "qnMQZkath89WEZaFGFmYaODIJqscq97l4TlvkVKHx_0=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -517,7 +517,7 @@ public static async Task ThenWithAsyncGetAllChannelGroupShouldReturnSuccess() receivedChannelGroupMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -540,7 +540,7 @@ public static async Task ThenWithAsyncGetAllChannelGroupShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "qnMQZkath89WEZaFGFmYaODIJqscq97l4TlvkVKHx_0=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenDetailedHistoryIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenDetailedHistoryIsRequested.cs index cccbfdd47..f781226db 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenDetailedHistoryIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenDetailedHistoryIsRequested.cs @@ -33,7 +33,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -60,7 +60,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -113,7 +113,7 @@ public static void DetailHistoryNoStoreShouldNotGetMessage() bool receivedMessage = true; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -147,7 +147,7 @@ public static void DetailHistoryNoStoreShouldNotGetMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("store","0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -180,7 +180,7 @@ public static void DetailHistoryNoStoreShouldNotGetMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "14715322883933786") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -220,7 +220,7 @@ public static void DetailHistoryShouldReturnDecryptMessage() bool receivedMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -256,7 +256,7 @@ public static void DetailHistoryShouldReturnDecryptMessage() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22f42pIQcWZ9zbTbH8cyLwByD%2FGsviOE0vcREIEVPARR0%3D%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -292,7 +292,7 @@ public static void DetailHistoryShouldReturnDecryptMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "14715322883933785") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -334,7 +334,7 @@ public static void DetailHistoryCount10ReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -368,7 +368,7 @@ public static void DetailHistoryCount10ReturnsRecords() .WithParameter("count", "10") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -398,7 +398,7 @@ public static void DetailHistoryCount10ReverseTrueReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -432,7 +432,7 @@ public static void DetailHistoryCount10ReverseTrueReturnsRecords() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("reverse","true") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -464,7 +464,7 @@ public static void DetailedHistoryStartWithReverseTrue() bool receivedMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -500,7 +500,7 @@ public static void DetailedHistoryStartWithReverseTrue() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -526,7 +526,7 @@ public static void DetailedHistoryStartWithReverseTrue() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, String.Format("%22DetailedHistoryStartTimeWithReverseTrue%20{0}%22",index))) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -562,7 +562,7 @@ public static void DetailedHistoryStartWithReverseTrue() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -594,7 +594,7 @@ public static void DetailHistoryWithNullKeysReturnsError() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = null, SubscribeKey = null, @@ -715,7 +715,7 @@ private static void CommonDetailedHistoryShouldReturnEncryptedMessageBasedOnPara long midtime = 0; long endtime = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1056,7 +1056,7 @@ private static void CommonDetailedHistoryShouldReturnUnencryptedMessageBasedOnPa Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenFetchHistoryIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenFetchHistoryIsRequested.cs index c1dfd0f92..54401ec23 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenFetchHistoryIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenFetchHistoryIsRequested.cs @@ -34,7 +34,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -61,7 +61,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -114,7 +114,7 @@ public static void FetchHistoryNoStoreShouldNotGetMessage() bool receivedMessage = true; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -148,7 +148,7 @@ public static void FetchHistoryNoStoreShouldNotGetMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("store", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -181,7 +181,7 @@ public static void FetchHistoryNoStoreShouldNotGetMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "14715322883933786") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -226,7 +226,7 @@ public static void FetchHistoryShouldReturnDecryptMessage() bool receivedMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -262,7 +262,7 @@ public static void FetchHistoryShouldReturnDecryptMessage() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22f42pIQcWZ9zbTbH8cyLwByD%2FGsviOE0vcREIEVPARR0%3D%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -298,7 +298,7 @@ public static void FetchHistoryShouldReturnDecryptMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "14715322883933785") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -349,7 +349,7 @@ public static async Task FetchHistoryWithAsyncShouldReturnDecryptMessage() bool receivedMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -383,7 +383,7 @@ public static async Task FetchHistoryWithAsyncShouldReturnDecryptMessage() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, "%22f42pIQcWZ9zbTbH8cyLwByD%2FGsviOE0vcREIEVPARR0%3D%22")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -420,7 +420,7 @@ public static async Task FetchHistoryWithAsyncShouldReturnDecryptMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "14715322883933785") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -476,7 +476,7 @@ public static void FetchHistoryCount10ReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -510,7 +510,7 @@ public static void FetchHistoryCount10ReturnsRecords() .WithParameter("count", "10") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -546,7 +546,7 @@ public static async Task FetchHistoryWithAsyncCount10ReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -580,7 +580,7 @@ public static async Task FetchHistoryWithAsyncCount10ReturnsRecords() .WithParameter("count", "10") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -616,7 +616,7 @@ public static void FetchHistoryWithMessageActionsReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -646,7 +646,7 @@ public static void FetchHistoryWithMessageActionsReturnsRecords() .WithParameter("count", "10") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -682,7 +682,7 @@ public static async Task FetchHistoryWithAsyncWithMessageActionsReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -712,7 +712,7 @@ public static async Task FetchHistoryWithAsyncWithMessageActionsReturnsRecords() .WithParameter("count", "10") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -748,7 +748,7 @@ public static void FetchHistoryCount10ReverseTrueReturnsRecords() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -782,7 +782,7 @@ public static void FetchHistoryCount10ReverseTrueReturnsRecords() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("reverse", "true") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -814,7 +814,7 @@ public static void FetchHistoryStartWithReverseTrue() bool receivedMessage = false; long publishTimetoken = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -850,7 +850,7 @@ public static void FetchHistoryStartWithReverseTrue() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -878,7 +878,7 @@ public static void FetchHistoryStartWithReverseTrue() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, String.Format("%22DetailedHistoryStartTimeWithReverseTrue%20{0}%22", index))) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -914,7 +914,7 @@ public static void FetchHistoryStartWithReverseTrue() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -951,7 +951,7 @@ public static async Task FetchHistoryWithAsyncStartWithReverseTrue() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -987,7 +987,7 @@ public static async Task FetchHistoryWithAsyncStartWithReverseTrue() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1015,7 +1015,7 @@ public static async Task FetchHistoryWithAsyncStartWithReverseTrue() .WithPath(String.Format("/publish/{0}/{1}/0/{2}/0/{3}", PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, channel, String.Format("%22DetailedHistoryStartTimeWithReverseTrue%20{0}%22", index))) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1052,7 +1052,7 @@ public static async Task FetchHistoryWithAsyncStartWithReverseTrue() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("start", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1089,7 +1089,7 @@ public static void FetchHistoryWithNullKeysReturnsError() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = null, SubscribeKey = null, @@ -1364,7 +1364,7 @@ private static void CommonFetchHistoryShouldReturnEncryptedMessageBasedOnParams( long midtime = 0; long endtime = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1711,7 +1711,7 @@ private static async Task CommonFetchHistoryWithAsyncShouldReturnEncrypted long midtime = 0; long endtime = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2028,7 +2028,7 @@ private static void CommonFetchHistoryShouldReturnUnencryptedMessageBasedOnParam Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2386,7 +2386,7 @@ private static async Task CommonFetchHistoryWithAsyncShouldReturnUnencrypt Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2708,7 +2708,7 @@ public static void FetchHistoryDefaultMax100() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2735,7 +2735,7 @@ public static void FetchHistoryDefaultMax100() .WithParameter("max", "100") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2768,7 +2768,7 @@ public static async Task FetchHistoryAsyncDefaultMax100() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2795,7 +2795,7 @@ public static async Task FetchHistoryAsyncDefaultMax100() .WithParameter("max", "100") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2828,7 +2828,7 @@ public static void FetchHistoryWithMessageActionsDefaultMax25() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2855,7 +2855,7 @@ public static void FetchHistoryWithMessageActionsDefaultMax25() .WithParameter("max", "25") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -2889,7 +2889,7 @@ public static async Task FetchHistoryWithAsyncWithMessageActionsDefaultMax25() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -2916,7 +2916,7 @@ public static async Task FetchHistoryWithAsyncWithMessageActionsDefaultMax25() .WithParameter("max", "25") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenFileIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenFileIsRequested.cs index c89499e96..27cdb6704 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenFileIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenFileIsRequested.cs @@ -42,7 +42,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -56,7 +56,7 @@ public static void Init() string expected = "{\"message\":\"Success\",\"payload\":{\"level\":\"channel-group\",\"subscribe_key\":\"demo-36\",\"ttl\":20,\"channel-groups\":{\"hello_my_group\":{\"r\":1,\"w\":0,\"m\":1}}},\"service\":\"Access Manager\",\"status\":200}"; - pubnub.Grant().Channels(new[] { channelName }).AuthKeys(new[] { authKey }).Read(true).Write(true).Manage(true).Delete(true).Update(true).TTL(20) + pubnub.Grant().Channels(new[] { channelName }).AuthKeys(new[] { authKey }).Read(true).Write(true).Manage(true).Delete(true).Update(true).Get(true).TTL(20) .Execute(new PNAccessManagerGrantResultExt((r,s)=> { if (r != null) @@ -102,7 +102,7 @@ public static void ThenSendFileShouldReturnSuccess() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -234,7 +234,7 @@ public static async Task ThenWithAsyncSendFileShouldReturnSuccess() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -344,7 +344,7 @@ public static void ThenDownloadFileShouldReturnSuccess() receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -395,7 +395,7 @@ public static void ThenGetFileUrlShouldReturnSuccess() receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -445,7 +445,7 @@ public static void ThenListFilesShouldReturnSuccess() receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -494,7 +494,7 @@ public static void ThenDeleteFileShouldReturnSuccess() receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -574,7 +574,7 @@ public static async Task ThenWithAsyncDeleteFileShouldReturnSuccess() receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs index 5a7809c5b..91ca7801e 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs @@ -48,7 +48,7 @@ public static async Task ThenItShouldReturnTimeStamp() timeReceived = false; mreTime = new ManualResetEvent(false); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -65,7 +65,7 @@ public static async Task ThenItShouldReturnTimeStamp() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -144,7 +144,7 @@ public static void ThenItShouldReturnTimeStampWithSSL() timeReceived = false; mreTime = new ManualResetEvent(false); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -160,7 +160,7 @@ public static void ThenItShouldReturnTimeStampWithSSL() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -187,7 +187,7 @@ public static void ThenWithProxyItShouldReturnTimeStamp() timeReceived = false; mreTime = new ManualResetEvent(false); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -206,7 +206,7 @@ public static void ThenWithProxyItShouldReturnTimeStamp() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -240,7 +240,7 @@ public static void ThenWithProxyItShouldReturnTimeStampWithSSL() timeReceived = false; mreTime = new ManualResetEvent(false); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -257,7 +257,7 @@ public static void ThenWithProxyItShouldReturnTimeStampWithSSL() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTimeMultiInstance.cs b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTimeMultiInstance.cs index 1dbb7a98c..78ca6484f 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTimeMultiInstance.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTimeMultiInstance.cs @@ -38,13 +38,13 @@ public static void ThenItShouldReturnTimeStamp() server.ClearRequests(); bool timeReceived1 = false; - PNConfiguration config1 = new PNConfiguration("mytestuuid1") + PNConfiguration config1 = new PNConfiguration(new UserId("mytestuuid1")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, Secure = false }; - PNConfiguration config2 = new PNConfiguration("mytestuuid2") + PNConfiguration config2 = new PNConfiguration(new UserId("mytestuuid2")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -63,7 +63,7 @@ public static void ThenItShouldReturnTimeStamp() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId1") - .WithParameter("uuid", config1.Uuid) + .WithParameter("uuid", config1.UserId) .WithParameter("instanceid", pubnub1.InstanceId) .WithResponse(expected1) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -73,7 +73,7 @@ public static void ThenItShouldReturnTimeStamp() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId2") - .WithParameter("uuid", config2.Uuid) + .WithParameter("uuid", config2.UserId) .WithParameter("instanceid", pubnub2.InstanceId) .WithResponse(expected2) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -131,7 +131,7 @@ public static void ThenItShouldReturnTimeStampWithSSL() server.ClearRequests(); bool timeReceived1 = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -147,7 +147,7 @@ public static void ThenItShouldReturnTimeStampWithSSL() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -186,7 +186,7 @@ public static void ThenWithProxyItShouldReturnTimeStamp() bool timeReceived1 = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -205,7 +205,7 @@ public static void ThenWithProxyItShouldReturnTimeStamp() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -253,7 +253,7 @@ public static void ThenWithProxyItShouldReturnTimeStampWithSSL() bool timeReceived1 = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -270,7 +270,7 @@ public static void ThenWithProxyItShouldReturnTimeStampWithSSL() .WithPath("/time/0") .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenGrantIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenGrantIsRequested.cs index e4f4b35b6..859937262 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenGrantIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenGrantIsRequested.cs @@ -73,7 +73,7 @@ public static void ThenUserLevelWithReadWriteShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -96,7 +96,7 @@ public static void ThenUserLevelWithReadWriteShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "V6C3eRs_YSP7njOW1f9xAFpmCx5do_7D3oUGXxDClXw=") .WithResponse(expected) @@ -134,7 +134,7 @@ public static async Task ThenWithAsyncUserLevelWithReadWriteShouldReturnSuccess( receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -157,7 +157,7 @@ public static async Task ThenWithAsyncUserLevelWithReadWriteShouldReturnSuccess( .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "V6C3eRs_YSP7njOW1f9xAFpmCx5do_7D3oUGXxDClXw=") .WithResponse(expected) @@ -201,7 +201,7 @@ public static void ThenUserLevelWithReadShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -224,7 +224,7 @@ public static void ThenUserLevelWithReadShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "0") .WithParameter("signature", "ViiLvN22MUr36vgEINkwrLTa2kMOH9ztmM4Dg-bqoaE=") .WithResponse(expected) @@ -262,7 +262,7 @@ public static async Task ThenWithAsyncUserLevelWithReadShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -285,7 +285,7 @@ public static async Task ThenWithAsyncUserLevelWithReadShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "0") .WithParameter("signature", "ViiLvN22MUr36vgEINkwrLTa2kMOH9ztmM4Dg-bqoaE=") .WithResponse(expected) @@ -329,7 +329,7 @@ public static void ThenUserLevelWithWriteShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -352,7 +352,7 @@ public static void ThenUserLevelWithWriteShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "qIMvcoTYVOIhZ4oaVJtv_jcb4n_1YGtRwmxotAVI2eQ=") .WithResponse(expected) @@ -387,7 +387,7 @@ public static void ThenMultipleChannelGrantShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -417,7 +417,7 @@ public static void ThenMultipleChannelGrantShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "aRUz_KM2JmPWMoblHezJsSJCrIjZcjhTy0UYTi_Nru0=") .WithResponse(expected) @@ -451,7 +451,7 @@ public static void ThenMultipleAuthGrantShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -483,7 +483,7 @@ public static void ThenMultipleAuthGrantShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "9_2ZxQiQeXroQqt3x728ebRN6f4hMPk7QtebCKSZl7Q=") .WithResponse(expected) @@ -518,7 +518,7 @@ public static void ThenRevokeAtUserLevelReturnSuccess() receivedGrantMessage = false; receivedRevokeMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -542,7 +542,7 @@ public static void ThenRevokeAtUserLevelReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "V6C3eRs_YSP7njOW1f9xAFpmCx5do_7D3oUGXxDClXw=") .WithResponse(expectedGrant) @@ -558,7 +558,7 @@ public static void ThenRevokeAtUserLevelReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "0") .WithParameter("signature", "MJVPMrBFTV7jo8jMp_DSn9OhIi8aikd7wru8x0sz3io=") .WithResponse(expectedRevoke) @@ -603,7 +603,7 @@ public static void ThenChannelGroupLevelWithReadManageShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -626,7 +626,7 @@ public static void ThenChannelGroupLevelWithReadManageShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "9TH9YpQydj1FaCJVoHqaL9YbPOEOhpVVv17FMrrz89U=") .WithResponse(expected) @@ -660,7 +660,7 @@ public static void ThenChannelGroupLevelWithReadShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -683,7 +683,7 @@ public static void ThenChannelGroupLevelWithReadShouldReturnSuccess() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "5") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "0") .WithParameter("signature", "wrMx4t1Zh-2h_gIXQFJsKbTKsSHAIr8dK0Rn9KNrqp0=") .WithResponse(expected) @@ -717,7 +717,7 @@ public static void ThenUuidWithGetUpdateDeleteShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -763,7 +763,7 @@ public static void ThenUuidWithReadPermisionShouldReturnError() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -814,7 +814,7 @@ public static void ThenUuidAndChannelShouldReturnError() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -865,7 +865,7 @@ public static void ThenUuidAndChannelGroupShouldReturnError() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -916,7 +916,7 @@ public static void ThenGrantTokenShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -981,7 +981,7 @@ public static async Task ThenWithAsyncGrantTokenShouldReturnSuccess() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1019,7 +1019,7 @@ public static void ThenRevokeTokenShouldReturnSuccess() receivedRevokeMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenMessageAction.cs b/src/UnitTests/PubnubApi.Tests/WhenMessageAction.cs index a1670015b..78bfb58cf 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenMessageAction.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenMessageAction.cs @@ -30,7 +30,7 @@ public static void Init() bool receivedGrantMessage = false; string channel = "hello_my_channel"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -57,7 +57,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -109,7 +109,7 @@ public static void ThenAddMessageActionReturnsSuccess() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -212,7 +212,7 @@ public static async Task ThenWithAsyncAddMessageActionReturnsSuccess() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -318,7 +318,7 @@ public static void ThenRemoveMessageActionReturnsSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -410,7 +410,7 @@ public static async Task ThenWithAsyncRemoveMessageActionReturnsSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -493,7 +493,7 @@ public static void ThenGetMessageActionsReturnsSuccess() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -551,7 +551,7 @@ public static async Task ThenWithAsyncGetMessageActionsReturnsSuccess() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -628,7 +628,7 @@ public static void ThenAddRemoveMessageActionReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -794,7 +794,7 @@ public static async Task ThenWithAsyncAddRemoveMessageActionReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenMessageCountIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenMessageCountIsRequested.cs index 3c5ad4496..9979f1ec2 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenMessageCountIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenMessageCountIsRequested.cs @@ -40,7 +40,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -63,7 +63,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "MhmxFFbUb_HlzWqTuvJAMRjAb3fgP9dbykaiPsSZuUc=") .WithResponse(expected) @@ -103,7 +103,7 @@ public static void ThenChannel1Timetoken1ShouldReturnSuccess() currentUnitTestCase = "ThenChannel1Timetoken1ShouldReturnSuccess"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -129,7 +129,7 @@ public static void ThenChannel1Timetoken1ShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -170,7 +170,7 @@ public static async Task ThenWithAsyncChannel1Timetoken1ShouldReturnSuccess() currentUnitTestCase = "ThenWithAsyncChannel1Timetoken1ShouldReturnSuccess"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -196,7 +196,7 @@ public static async Task ThenWithAsyncChannel1Timetoken1ShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -234,7 +234,7 @@ public static void ThenChannel2Timetoken2ShouldReturnSuccess() currentUnitTestCase = "ThenChannel1Timetoken1ShouldReturnSuccess"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -260,7 +260,7 @@ public static void ThenChannel2Timetoken2ShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -301,7 +301,7 @@ public static async Task ThenWithAsyncChannel2Timetoken2ShouldReturnSuccess() currentUnitTestCase = "ThenWithAsyncChannel2Timetoken2ShouldReturnSuccess"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -327,7 +327,7 @@ public static async Task ThenWithAsyncChannel2Timetoken2ShouldReturnSuccess() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "yo21VoxIksrH3Iozeaz5Zw4BX18N3vU9PLa-zVxRXsU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenMessageDeletedFromChannel.cs b/src/UnitTests/PubnubApi.Tests/WhenMessageDeletedFromChannel.cs index 3bc8ae730..6cf9478ec 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenMessageDeletedFromChannel.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenMessageDeletedFromChannel.cs @@ -40,7 +40,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -67,7 +67,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -100,7 +100,7 @@ public static void ThenDeleteMessageShouldReturnSuccessMessage() currentTestCase = "ThenDeleteMessageShouldReturnSuccessMessage"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -124,7 +124,7 @@ public static void ThenDeleteMessageShouldReturnSuccessMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "AQjIVGOI59CyaHrRG18XRZmqRjgWdzbbf9icO0Yzxo4=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -162,7 +162,7 @@ public static async Task ThenWithAsyncDeleteMessageShouldReturnSuccessMessage() currentTestCase = "ThenWithAsyncDeleteMessageShouldReturnSuccessMessage"; receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -186,7 +186,7 @@ public static async Task ThenWithAsyncDeleteMessageShouldReturnSuccessMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "AQjIVGOI59CyaHrRG18XRZmqRjgWdzbbf9icO0Yzxo4=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMember.cs b/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMember.cs index a26798b63..1c959b246 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMember.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMember.cs @@ -32,7 +32,7 @@ public static void Init() string uuidMetadataId1 = "pandu-ut-uid1"; string uuidMetadataId2 = "pandu-ut-uid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -112,7 +112,7 @@ public static void ThenSetRemoveUuidMetadataWithManageMemberShouldReturnSuccessC string uuidMetadataId1 = "pandu-ut-uid1"; string uuidMetadataId2 = "pandu-ut-uid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -361,7 +361,7 @@ public static async Task ThenWithAsyncSetRemoveUuidMetadataWithManageMemberShoul string uuidMetadataId1 = "pandu-ut-uid1"; string uuidMetadataId2 = "pandu-ut-uid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -624,7 +624,7 @@ public static void ThenSetRemoveUuidMetadataWithSetRemoveMemberShouldReturnSucce string uuidMetadataId1 = "pandu-ut-uid1"; string uuidMetadataId2 = "pandu-ut-uid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -874,7 +874,7 @@ public static async Task ThenWithAsyncSetRemoveUuidMetadataWithSetRemoveMemberSh string uuidMetadataId1 = "pandu-ut-uid1"; string uuidMetadataId2 = "pandu-ut-uid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1161,7 +1161,7 @@ public static void ThenManageChannelMembersShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1402,7 +1402,7 @@ public static async Task ThenWithAsyncManageChannelMembersShouldReturnEventInfo( } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1651,7 +1651,7 @@ public static void ThenSetRemoveChannelMembersShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1870,7 +1870,7 @@ public static async Task ThenWithAsyncSetRemoveChannelMemberShouldReturnEventInf } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMetadata.cs b/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMetadata.cs index 03fe0ab2f..1efa55fb2 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMetadata.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenObjectChannelMetadata.cs @@ -31,7 +31,7 @@ public static void Init() bool receivedGrantMessage = false; string channelMetadataId = "pandu-ut-sid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -99,7 +99,7 @@ public static void ThenChannelMetadataCRUDShouldReturnSuccessCodeAndInfo() string channelMetadataId = "pandu-ut-sid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -243,7 +243,7 @@ public static async Task ThenWithAsyncChannelMetadataCRUDShouldReturnSuccessCode string channelMetadataId = "pandu-ut-sid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -406,7 +406,7 @@ public static void ThenChannelMetadataSetDeleteShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -545,7 +545,7 @@ public static async Task ThenWithAsyncChannelMetadataUpdateDeleteShouldReturnEve } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs b/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs index 97bd97a07..b01d354d6 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenObjectMembership.cs @@ -32,7 +32,7 @@ public static void Init() string channelMetadataId1 = "pandu-ut-sid1"; string channelMetadataId2 = "pandu-ut-sid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -111,7 +111,7 @@ public static void ThenSetRemoveChannelMetadataWithManageMembershipShouldReturnS string channelMetadataId1 = "pandu-ut-sid1"; string channelMetadataId2 = "pandu-ut-sid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -349,7 +349,7 @@ public static async Task ThenWithAsyncSetRemoveChannelMetadataWithManageMembersh string channelMetadataId1 = "pandu-ut-sid1"; string channelMetadataId2 = "pandu-ut-sid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -591,7 +591,7 @@ public static void ThenSetRemoveChannelMetadataWithSetRemoveMembershipShouldRetu string channelMetadataId1 = "pandu-ut-sid1"; string channelMetadataId2 = "pandu-ut-sid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -830,7 +830,7 @@ public static async Task ThenWithAsyncSetRemoveChannelMetadataWithSetRemoveMembe string channelMetadataId1 = "pandu-ut-sid1"; string channelMetadataId2 = "pandu-ut-sid2"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1097,7 +1097,7 @@ public static void ThenManageMembershipShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1339,7 +1339,7 @@ public static async Task ThenWithAsyncManageMembershipShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1585,7 +1585,7 @@ public static void ThenSetRemoveMembershipsShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1814,7 +1814,7 @@ public static async Task ThenWithAsyncSetRemoveMembershipsShouldReturnEventInfo( } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenObjectUuidMetadata.cs b/src/UnitTests/PubnubApi.Tests/WhenObjectUuidMetadata.cs index d3f3866bc..0c959bb2b 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenObjectUuidMetadata.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenObjectUuidMetadata.cs @@ -30,7 +30,7 @@ public static void Init() bool receivedGrantMessage = false; string uuid_metadata_id = "pandu-ut-uid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -107,7 +107,7 @@ public static void ThenUuidMetadataCRUDShouldReturnSuccessCodeAndInfo() string uuidMetadataId = "pandu-ut-uid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -254,7 +254,7 @@ public static async Task ThenWithAsyncUuidMetadataCRUDShouldReturnSuccessCodeAnd string uuidMetadataId = "pandu-ut-uid"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -419,7 +419,7 @@ public static void ThenUuidMetadataSetDeleteShouldReturnEventInfo() } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -558,7 +558,7 @@ public static async Task ThenWithAsyncUuidMetadataUpdateDeleteShouldReturnEventI } ); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, diff --git a/src/UnitTests/PubnubApi.Tests/WhenPushIsRequested.cs b/src/UnitTests/PubnubApi.Tests/WhenPushIsRequested.cs index 8201adbf5..f6ca660d5 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenPushIsRequested.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenPushIsRequested.cs @@ -50,7 +50,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -75,7 +75,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -126,7 +126,7 @@ public static void ThenPublishMpnsToastShouldReturnSuccess() publishTimetoken = 0; currentTestCase = "ThenPublishMpnsToastShouldReturnSuccess"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -158,7 +158,7 @@ public static void ThenPublishMpnsToastShouldReturnSuccess() .WithPath(string.Format("/publish/demo-36/{0}/0/{1}/0/{2}", PubnubCommon.SubscribeKey, channel, "%7B%22pn_mpns%22%3A%7B%22type%22%3A%22toast%22%2C%22text1%22%3A%22hardcode%20message%22%2C%22text2%22%3A%22%22%2C%22param%22%3A%22%22%7D%7D")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -190,7 +190,7 @@ public static void ThenPublishMpnsFlipTileShouldReturnSuccess() publishTimetoken = 0; currentTestCase = "ThenPublishMpnsFlipTileShouldReturnSuccess"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -229,7 +229,7 @@ public static void ThenPublishMpnsFlipTileShouldReturnSuccess() .WithPath(string.Format("/publish/demo-36/{0}/0/{1}/0/{2}", PubnubCommon.SubscribeKey, channel, "%7B%22pn_mpns%22%3A%7B%22type%22%3A%22flip%22%2C%22delay%22%3A0%2C%22title%22%3A%22front%20title%22%2C%22count%22%3A6%2C%22small_background_image%22%3A%22%22%2C%22background_image%22%3A%22http%3A%2F%2Fcdn.flaticon.com%2Fpng%2F256%2F37985.png%22%2C%22back_background_image%22%3A%22Assets%2FTiles%2Fpubnub3.png%22%2C%22back_content%22%3A%22back%20message%22%2C%22back_title%22%3A%22back%20title%22%2C%22wide_background_image%22%3A%22%22%2C%22wide_back_background_image%22%3A%22%22%2C%22wide_back_content%22%3A%22%22%7D%7D")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -259,7 +259,7 @@ public static void ThenPublishMpnsCycleTileShouldReturnSuccess() publishTimetoken = 0; currentTestCase = "ThenPublishMpnsCycleTileShouldReturnSuccess"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -298,7 +298,7 @@ public static void ThenPublishMpnsCycleTileShouldReturnSuccess() .WithPath(string.Format("/publish/demo-36/{0}/0/{1}/0/{2}", PubnubCommon.SubscribeKey, channel, "%7B%22pn_mpns%22%3A%7B%22type%22%3A%22cycle%22%2C%22delay%22%3A0%2C%22title%22%3A%22front%20title%22%2C%22count%22%3A2%2C%22small_background_image%22%3A%22%22%2C%22images%22%3A%5B%22Assets%2FTiles%2Fpubnub1.png%22%2C%22Assets%2FTiles%2Fpubnub2.png%22%2C%22Assets%2FTiles%2Fpubnub3.png%22%2C%22Assets%2FTiles%2Fpubnub4.png%22%5D%7D%7D")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -328,7 +328,7 @@ public static void ThenPublishMpnsIconicTileShouldReturnSuccess() publishTimetoken = 0; currentTestCase = "ThenPublishMpnsIconicTileShouldReturnSuccess"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -368,7 +368,7 @@ public static void ThenPublishMpnsIconicTileShouldReturnSuccess() .WithPath(string.Format("/publish/demo-36/{0}/0/{1}/0/{2}", PubnubCommon.SubscribeKey, channel, "%7B%22pn_mpns%22%3A%7B%22type%22%3A%22iconic%22%2C%22delay%22%3A0%2C%22title%22%3A%22front%20title%22%2C%22count%22%3A2%2C%22icon_image%22%3A%22%22%2C%22small_icon_image%22%3A%22%22%2C%22background_color%22%3A%22%22%2C%22wide_content_1%22%3A%22my%20wide%20content%22%2C%22wide_content_2%22%3A%22%22%2C%22wide_content_3%22%3A%22%22%7D%7D")) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -403,7 +403,7 @@ public static void ThenAuditPushChannelProvisionsShouldReturnSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -461,7 +461,7 @@ public static async Task ThenWithAsyncAuditPushChannelProvisionsShouldReturnSucc return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -516,7 +516,7 @@ public static void ThenAPNS2AddDeviceToPushChannelShouldReturnSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -580,7 +580,7 @@ public static async Task ThenWithAsyncAPNS2AddDeviceToPushChannelShouldReturnSuc return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -646,7 +646,7 @@ public static void ThenAPNS2RemovePushChannelFromDeviceShouldReturnSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -710,7 +710,7 @@ public static async Task ThenWithAsyncAPNS2RemovePushChannelFromDeviceShouldRetu return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -776,7 +776,7 @@ public static void ThenAPNS2ListPushChannelsFromDeviceShouldReturnSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -839,7 +839,7 @@ public static async Task ThenWithAsyncAPNS2ListPushChannelsFromDeviceShouldRetur return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -899,7 +899,7 @@ public static void ThenAPNS2RemoveDeviceFromPushShouldReturnSuccess() return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false @@ -962,7 +962,7 @@ public static async Task ThenWithAsyncAPNS2RemoveDeviceFromPushShouldReturnSucce return; } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { SubscribeKey = PubnubCommon.SubscribeKey, Secure = false diff --git a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel.cs b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel.cs index 28b2eb101..1b3c21550 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel.cs @@ -42,7 +42,7 @@ public static void Init() string[] channelsGrant = { "hello_my_channel", "hello_my_channel1", "hello_my_channel2" }; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -67,7 +67,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "hc7IKhEB7tyL6ENR3ndOOlHqPIG3RmzxwJMSGpofE6Q=") .WithResponse(expected) @@ -160,7 +160,7 @@ private static void CommonComplexMessageSubscribeShouldReturnReceivedMessageBase bool receivedErrorMessage = false; CustomClass publishedMessage = new CustomClass(); - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -229,7 +229,7 @@ private static void CommonComplexMessageSubscribeShouldReturnReceivedMessageBase .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zJpO1HpSZxGkOr3EALbOk-vQgjIZTZ6AU5svzNU9l_A=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -243,7 +243,7 @@ private static void CommonComplexMessageSubscribeShouldReturnReceivedMessageBase .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -380,7 +380,7 @@ public static void ThenSubscribeShouldReturnConnectStatus() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -427,7 +427,7 @@ public static void ThenSubscribeShouldReturnConnectStatus() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -463,7 +463,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -508,7 +508,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -539,7 +539,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -574,7 +574,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatusSSL() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -622,7 +622,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatusSSL() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -652,7 +652,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatusSSL() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -690,7 +690,7 @@ public static void ThenSubscriberShouldBeAbleToReceiveManyMessages() bool receivedErrorMessage = false; int numberOfReceivedMessages = 0; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -757,7 +757,7 @@ public static void ThenSubscriberShouldBeAbleToReceiveManyMessages() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel2.cs b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel2.cs index 558cd3ae7..35569f76a 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel2.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel2.cs @@ -54,7 +54,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -79,7 +79,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "hc7IKhEB7tyL6ENR3ndOOlHqPIG3RmzxwJMSGpofE6Q=") .WithResponse(expected) @@ -122,7 +122,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -162,7 +162,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -175,7 +175,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zJpO1HpSZxGkOr3EALbOk-vQgjIZTZ6AU5svzNU9l_A=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -319,7 +319,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -359,7 +359,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -372,7 +372,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zJpO1HpSZxGkOr3EALbOk-vQgjIZTZ6AU5svzNU9l_A=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel3.cs b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel3.cs index d49ea3def..b6f182188 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel3.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannel3.cs @@ -44,7 +44,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -69,7 +69,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "hc7IKhEB7tyL6ENR3ndOOlHqPIG3RmzxwJMSGpofE6Q=") .WithResponse(expected) @@ -112,7 +112,7 @@ private static void CommonSubscribeShouldReturnUnicodeMessageBasedOnParams(strin Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -149,7 +149,7 @@ private static void CommonSubscribeShouldReturnUnicodeMessageBasedOnParams(strin .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -227,7 +227,7 @@ private static void CommonSubscribeReturnForwardSlashMessageBasedOnParams(string Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -264,7 +264,7 @@ private static void CommonSubscribeReturnForwardSlashMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -277,7 +277,7 @@ private static void CommonSubscribeReturnForwardSlashMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zJpO1HpSZxGkOr3EALbOk-vQgjIZTZ6AU5svzNU9l_A=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -416,7 +416,7 @@ private static void CommonSubscribeShouldReturnSpecialCharMessageBasedOnParams(s Assert.Ignore("Ignored for Server side run"); } - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -453,7 +453,7 @@ private static void CommonSubscribeShouldReturnSpecialCharMessageBasedOnParams(s .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -466,7 +466,7 @@ private static void CommonSubscribeShouldReturnSpecialCharMessageBasedOnParams(s .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "zJpO1HpSZxGkOr3EALbOk-vQgjIZTZ6AU5svzNU9l_A=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannelGroup.cs b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannelGroup.cs index ffdf39e67..c6974a022 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannelGroup.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToAChannelGroup.cs @@ -46,7 +46,7 @@ public static void Init() bool receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -74,7 +74,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "oiUrVMZSf7NEGk6M9JrvpnffmMEy7wWLgYGHwMztIlU=") .WithResponse(expected) @@ -170,7 +170,7 @@ public static void ThenSubscribeShouldReturnReceivedMessage() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -230,7 +230,7 @@ public static void ThenSubscribeShouldReturnReceivedMessage() .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -269,7 +269,7 @@ public static void ThenSubscribeShouldReturnReceivedMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -338,7 +338,7 @@ public static void ThenSubscribeShouldReturnConnectStatus() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -387,7 +387,7 @@ public static void ThenSubscribeShouldReturnConnectStatus() .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -426,7 +426,7 @@ public static void ThenSubscribeShouldReturnConnectStatus() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -463,7 +463,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -521,7 +521,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -558,7 +558,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -598,7 +598,7 @@ public static void ThenMultiSubscribeShouldReturnConnectStatus() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToWildcardChannel.cs b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToWildcardChannel.cs index d81892a40..158582926 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenSubscribedToWildcardChannel.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenSubscribedToWildcardChannel.cs @@ -42,7 +42,7 @@ public static void Init() bool receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -71,7 +71,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "0OiQ1k5uyR4Y56XBmpCfMFtMkUiJKMf6k-OZEs5ea5c=") .WithResponse(expected) @@ -142,7 +142,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "aIQJHjVxSH626VLkW7ULvBcifLYGyZBWGQ-Nbpss4Qw=") .WithResponse(expected) @@ -214,7 +214,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -286,7 +286,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "FVeU4RXzcxTzOf7xvmMyEPllc388HDpDfdT5lnGcLVE=") .WithResponse(expected) @@ -356,7 +356,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "mnWJN7WSbajMt_LWpuiXGhcs3NUcVbU3L_MZpb9_blU=") .WithResponse(expected) @@ -441,7 +441,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri bool internalReceivedMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -511,7 +511,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -523,7 +523,7 @@ private static void CommonSubscribeShouldReturnReceivedMessageBasedOnParams(stri .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "5yl-J1ci5xJzHDTctEWusTxwvwRPuZ_JNAALf_zBvJU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -657,7 +657,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string bool internalReceivedMessage = false; bool receivedErrorMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -726,7 +726,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -738,7 +738,7 @@ private static void CommonSubscribeShouldReturnEmojiMessageBasedOnParams(string .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("signature", "5yl-J1ci5xJzHDTctEWusTxwvwRPuZ_JNAALf_zBvJU=") .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -846,7 +846,7 @@ public static void ChannelAndChannelGroupAndWildcardChannelSubscribeShouldReturn bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -915,7 +915,7 @@ public static void ChannelAndChannelGroupAndWildcardChannelSubscribeShouldReturn .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -956,7 +956,7 @@ public static void ChannelAndChannelGroupAndWildcardChannelSubscribeShouldReturn .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -1082,7 +1082,7 @@ public static void ThenSubscribeShouldReturnWildCardPresenceEventInWildcardPrese bool receivedMessage = false; bool receivedErrorMessage = true; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -1147,7 +1147,7 @@ public static void ThenSubscribeShouldReturnWildCardPresenceEventInWildcardPrese .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannel.cs b/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannel.cs index 69583576f..cdb557896 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannel.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannel.cs @@ -40,7 +40,7 @@ public static void Init() receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -65,7 +65,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "JMQKzXgfqNo-HaHuabC0gq0X6IkVMHa9AWBCg6BGN1Q=") .WithResponse(expected) @@ -97,7 +97,7 @@ public static void ThenShouldReturnUnsubscribedMessage() receivedMessage = false; currentTestCase = "ThenShouldReturnUnsubscribedMessage"; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -132,7 +132,7 @@ public static void ThenShouldReturnUnsubscribedMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannelGroup.cs b/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannelGroup.cs index 216c6c8eb..7dc626876 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannelGroup.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenUnsubscribedToAChannelGroup.cs @@ -29,7 +29,7 @@ public static void Init() bool receivedGrantMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -54,7 +54,7 @@ public static void Init() .WithParameter("requestid", "myRequestId") .WithParameter("timestamp", "1356998400") .WithParameter("ttl", "20") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithParameter("w", "1") .WithParameter("signature", "mnWJN7WSbajMt_LWpuiXGhcs3NUcVbU3L_MZpb9_blU=") .WithResponse(expected) @@ -119,7 +119,7 @@ public static void ThenShouldReturnUnsubscribedMessage() bool receivedMessage = false; - PNConfiguration config = new PNConfiguration("mytestuuid") + PNConfiguration config = new PNConfiguration(new UserId("mytestuuid")) { PublishKey = PubnubCommon.PublishKey, SubscribeKey = PubnubCommon.SubscribeKey, @@ -172,7 +172,7 @@ public static void ThenShouldReturnUnsubscribedMessage() .WithParameter("auth", config.AuthKey) .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); @@ -210,7 +210,7 @@ public static void ThenShouldReturnUnsubscribedMessage() .WithParameter("pnsdk", PubnubCommon.EncodedSDK) .WithParameter("requestid", "myRequestId") .WithParameter("tt", "0") - .WithParameter("uuid", config.Uuid) + .WithParameter("uuid", config.UserId) .WithResponse(expected) .WithStatusCode(System.Net.HttpStatusCode.OK)); diff --git a/src/UnitTests/PubnubApi.Tests/WhenUserIdInPNConfig.cs b/src/UnitTests/PubnubApi.Tests/WhenUserIdInPNConfig.cs new file mode 100644 index 000000000..8ada91bc7 --- /dev/null +++ b/src/UnitTests/PubnubApi.Tests/WhenUserIdInPNConfig.cs @@ -0,0 +1,116 @@ +using System; +using NUnit.Framework; +using System.Threading; +using PubnubApi; +using System.Collections.Generic; +using MockServer; +using System.Diagnostics; + +namespace PubNubMessaging.Tests +{ + [TestFixture] + public class WhenUserIdInPNConfig : TestHarness + { + [SetUp] + public static void Init() + { + } + + [TearDown] + public static void Exit() + { + + } + + [Test] + public static void ThenUuidSetShouldFailWithUserIdConstructorValue() + { + Assert.Throws(() => + { + PNConfiguration config = new PNConfiguration(new UserId("newuserid")) + { + SubscribeKey = "somesubkey", + PublishKey = "somepubkey", + SecretKey = "someseckey", + Uuid = "altnewuuidthatshouldfail" + }; + }); + } + + [Test] + public static void ThenUserIdSetShouldFailWithUuidConstructorValue() + { + Assert.Throws(() => + { + PNConfiguration config = new PNConfiguration("newuuid") + { + SubscribeKey = "somesubkey", + PublishKey = "somepubkey", + SecretKey = "someseckey", + UserId = new UserId("altnewuseridthatshouldfail") + }; + }); + } + + [Test] + public static void ThenUserIdSetShouldGiveSameForUuid() + { + PNConfiguration config = new PNConfiguration(new UserId("newuserid")) + { + SubscribeKey = "somesubkey", + PublishKey = "somepubkey", + SecretKey = "someseckey", + }; + Assert.AreEqual(config.UserId.ToString(), config.Uuid); + } + + [Test] + public static void ThenUuidSetShouldGiveSameForUserId() + { + PNConfiguration config = new PNConfiguration("newuuid") + { + SubscribeKey = "somesubkey", + PublishKey = "somepubkey", + SecretKey = "someseckey", + }; + Assert.AreEqual(config.UserId.ToString(), config.Uuid); + } + + [Test] + public static void ThenChangeUuidShouldGiveCurrentNewUuid() + { + ManualResetEvent mre = new ManualResetEvent(false); + PNConfiguration config = new PNConfiguration("olduuid") + { + SubscribeKey = "demo", + PublishKey = "demo", + LogVerbosity = PNLogVerbosity.BODY, + ReconnectionPolicy = PNReconnectionPolicy.LINEAR + }; + + Pubnub pubnub = new Pubnub(config); + Thread.Sleep(1000); + pubnub.ChangeUUID("newuuid"); + mre.WaitOne(1000); + Assert.AreEqual("newuuid", pubnub.GetCurrentUserId().ToString()); + } + + [Test] + public static void ThenChangeUserIdShouldGiveCurrentNewUserId() + { + ManualResetEvent mre = new ManualResetEvent(false); + PNConfiguration config = new PNConfiguration(new UserId("olduserid")) + { + SubscribeKey = "demo", + PublishKey = "demo", + LogVerbosity = PNLogVerbosity.BODY, + ReconnectionPolicy = PNReconnectionPolicy.LINEAR + }; + Pubnub pubnub = new Pubnub(config); + Thread.Sleep(1000); + pubnub.ChangeUserId(new UserId("newuserid")); + mre.WaitOne(1000); + Assert.AreEqual("newuserid", pubnub.GetCurrentUserId().ToString()); + } + } +} diff --git a/src/UnitTests/PubnubApiPCL.Tests/PubnubApiPCL.Tests.csproj b/src/UnitTests/PubnubApiPCL.Tests/PubnubApiPCL.Tests.csproj index d763a794a..0e0efd9b8 100644 --- a/src/UnitTests/PubnubApiPCL.Tests/PubnubApiPCL.Tests.csproj +++ b/src/UnitTests/PubnubApiPCL.Tests/PubnubApiPCL.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false Debug AnyCPU @@ -34,6 +34,10 @@ $(DefineConstants);NETSTANDARD20 + + $(DefineConstants);NET60 + + $(DefineConstants);NETSTANDARD20 @@ -78,6 +82,7 @@ +