Skip to content

Commit

Permalink
refactor: Remove TelemetryManager from sdk (#224)
Browse files Browse the repository at this point in the history
* Remove TelemetryManager from the sdk

* Transport layer (#225)

* * Target framework upgrade
* Initial code for HttpClient

* Integration of TransportLayer with all endpoints except File and Subscribe operations

* send and download file apis refactoring

* code cleanup: removed unnecessary usings for threading.channels

* removed support for older netstandartds

* Fix build issues for Unity and UWP projects

* retire old httpWebRequest

* CI Tests Fix (#228)

* temporarily remove one assert from TestSubscribeDecryptionOnNonEncryptedMessage

* re-enable unit tests on branch

* disable stub test

* remove channels argument exception from UrlRequestBuilder

* temporarily disable tests that were causing the CI to hang

* update key-set used by tests

* Fix broken Encryption tests

* Disable global HereNow tests (for now)

* re-enable access manager dependant tests

* Revert "re-enable access manager dependant tests"

This reverts commit dff644b.

* Test increased timeouts in ThenManageMembershipShouldReturnEventInfo

* Revert "Test increased timeouts in ThenManageMembershipShouldReturnEventInfo"

This reverts commit fc129da.

* Fix potentially faulty async calls in EncryptionTests

* Increase verbosity for CI debugging

* test increasing --logger verbosity

* add a NUnit ConsoleTraceListener

* add a simple debug writeline to test logging

* Update .pubnub.yml for .Net version support (#223)

* fix encryption tests PAM issue

* Fix more of file tests

* add missing test teardowns, replace v2 PAM access grants with v3 ones in tests that got a PAM 403

* change to PAM v3 in WhenObjectChannelMetadata

* failing test debug assert

* add temp debug method for PubnubCommon values

* Change PAM v2 to v3 in more tests, more failing test debug

* update .yml test keys ids

* add debug to failing ci test

* debug on file tests

* tests yml sdk keys change

* remove old test debugs

* Remove deprecated build targets

* Fix missing UWP includes

---------

Co-authored-by: Mohit Tejani <[email protected]>

* fix acceptance tests errors

* * fixes issue reported by acceptance tests in AppContextApi.
* Added support for Patch requests in client library

* * added missing includes for UWP (missed in last merge!)
* fix current userId memenership issue for AppContext Api

* * fix: removed references of old http client code,
added request timeout mechanism,
fixes to adhere to existing response generation mechanism by applying request state values as per response

* fix: removeMembership for current user scenario execution

* refactor: moved out enumToUrlParamName conversation utility to build utility directory, moved unnecessary log messages from internet utility method

* fixes issues found in channelGroup, audit, publish, signal operation through unit/integration tests

* files: fix issue of uploading and downloading files due to wrong header information sent through default http client component

* Unit and Integration Tests: increased delay value for Grant response wait.

* * Code cleanup: removed commented code in client library, better error handling in default http client library,
removed code for UrlProcess request from PubNubCore class,
fixed issues with generate file url

* build: update default runner group value with organization

* Add/re-add ConfigureAwait(false) in await calls to prevent Unity-side deadlocks

* Add few more missing ConfigureAwait(false)

* Added Support for Porxy.
Code Cleanup for Pubnub, PubnubCoreBase, PNConfiguration class,
Code Cleanup - removed dead codes in various files and removed old PubnubHttpClient footprints.

* fix: Serialization failure for User publish/signal message at NewtonsoftJsonNet library

* BREAKING CHANGE: Default Reconnection Policy set to `EXPONENTIAL`.
* File upload failure edge cases handling with proper exception messages.
* Refactored Check Internet status execution a bit (many more to come) to fix Unity engine impact.
* Old subscription logic cleanup: removing many state/internetstatus information store

* Unsubscribe operation refactoring: removed unncessary processings

* set default event engine enabled

* removed timer.cs, tuple.cs which was there for older .net versions

* fix: presence tests (passing locally)

* reverted eventengine enabled flag reset for Presence Tests

* update test to have different channel names for presence tests

* presence test fix for 403 permission

* attempt to fix unit/integartion test for subscribe

* fix: Patch work for internet status chekcing execution to make it compatible with single threaded environment.
Disable ee for unit/integration tests

---------

Co-authored-by: PUBNUB\jakub.grzesiowski <[email protected]>
Co-authored-by: jakub-grzesiowski <[email protected]>

---------

Co-authored-by: PUBNUB\jakub.grzesiowski <[email protected]>
Co-authored-by: jakub-grzesiowski <[email protected]>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent fcb7848 commit 6cbb75f
Show file tree
Hide file tree
Showing 141 changed files with 15,276 additions and 20,939 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* @mohitpubnub @xavrax @marcin-cebo
README.md @techwritermat @kazydek @mohitpubnub @xavrax
* @mohitpubnub @xavrax @marcin-cebo @jakub-grzesiowski
README.md @techwritermat @kazydek @mohitpubnub @xavrax @jakub-grzesiowski
2 changes: 1 addition & 1 deletion .github/workflows/commands-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Process command
if: github.event.issue.pull_request && endsWith(github.repository, '-private') != true
runs-on:
group: Default
group: organization/Default
steps:
- name: Check referred user
id: user-check
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Check release required
if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true
runs-on:
group: Default
group: organization/Default
outputs:
release: ${{ steps.check.outputs.ready }}
steps:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
name: Publish package
needs: publish-nuget
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
tests:
name: Integration and Unit tests
runs-on:
group: windows-gh
group: organization/windows-gh
defaults:
run:
shell: powershell
Expand All @@ -31,27 +31,29 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.x
5.0.x
6.0.x
7.0.x
- name: Build packages
env:
WORKSPACE_PATH: ${{ github.workspace }}
run: .\\.github\\workflows\\release\\build-packages.ps1
# - name: Run unit tests
# env:
# PN_PUB_KEY: ${{ secrets.PN_PUB_KEY }}
# PN_SUB_KEY: ${{ secrets.PN_SUB_KEY }}
# PN_SEC_KEY: ${{ secrets.PN_SEC_KEY }}
# run: dotnet test .\\src\\UnitTests\\PubnubApiPCL.Tests\\PubnubApiPCL.Tests.csproj --verbosity normal --logger trx
- name: Run unit tests
env:
PN_PUB_KEY: ${{ secrets.SDK_PUB_KEY }}
PN_SUB_KEY: ${{ secrets.SDK_SUB_KEY }}
PN_SEC_KEY: ${{ secrets.SDK_SEC_KEY }}
PN_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
PN_PAM_SUB_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
PN_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
run: dotnet test .\\src\\UnitTests\\PubnubApiPCL.Tests\\PubnubApiPCL.Tests.csproj --verbosity normal --logger "console;verbosity=detailed"
- name: Cancel workflow runs for commit on error
if: failure()
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
acceptance-tests:
name: Acceptance tests
runs-on:
group: windows-gh
group: organization/windows-gh
defaults:
run:
shell: powershell
Expand Down Expand Up @@ -91,7 +93,7 @@ jobs:
run: |
Copy-Item -Path "${{ github.workspace }}/sdk-specifications/features/access/*" -Destination "${{ github.workspace }}/src/UnitTests/AcceptanceTests/Features" -Recurse
cd ./UnitTests/AcceptanceTests
dotnet test --no-build --verbosity normal --logger trx --results-directory ./results
dotnet test --no-build --verbosity normal --logger "console;verbosity=detailed" --results-directory ./results
- name: Upload acceptance tests reports
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -107,7 +109,7 @@ jobs:
name: Tests
needs: [tests, acceptance-tests]
runs-on:
group: Default
group: organization/Default
steps:
- name: Tests summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll tests successfully passed"
4 changes: 2 additions & 2 deletions .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
pubnub-yml:
name: "Validate .pubnub.yml"
runs-on:
group: Default
group: organization/Default
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -33,7 +33,7 @@ jobs:
name: Validations
needs: [pubnub-yml]
runs-on:
group: Default
group: organization/Default
steps:
- name: Validations summary
run: echo -e "\033[38;2;95;215;0m\033[1mAll validations passed"
47 changes: 24 additions & 23 deletions .pubnub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ supported-platforms:
- .Net Framework 4.0
- .Net Framework 4.5
- .Net Framework 4.6.1+
- .Net Framework 6.0
-
version: PubnubPCL 'C#' 6.20.1
platforms:
Expand Down Expand Up @@ -892,9 +893,9 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1031,9 +1032,9 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1152,10 +1153,10 @@ sdks:
supported-operating-systems:
Android:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
target-api-level:
- 11
minimum-api-level:
Expand All @@ -1172,10 +1173,10 @@ sdks:
- ARMv7 (Cortex) CPU with NEON support
iOS:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- iOS 9.0
maximum-os-version:
Expand All @@ -1189,10 +1190,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1269,7 +1270,7 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
maximum-os-version:
Expand All @@ -1280,10 +1281,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Mac OS X 10.8
maximum-os-version:
Expand Down Expand Up @@ -1330,7 +1331,7 @@ sdks:
supported-operating-systems:
Android:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
target-api-level:
Expand All @@ -1349,10 +1350,10 @@ sdks:
- ARMv7 (Cortex) CPU with NEON support
iOS:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- iOS 9.0
maximum-os-version:
Expand All @@ -1366,10 +1367,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1446,10 +1447,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
maximum-os-version:
- Ubuntu 20.04 LTS
minimum-os-version:
Expand All @@ -1458,10 +1459,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Mac OS X 10.8
maximum-os-version:
Expand Down Expand Up @@ -1643,4 +1644,4 @@ sdks:
- Windows Server 2012 R2 Foundation
- Windows Server 2012 R2 Essentials
- Windows Server 2012 R2 Standard
- Windows Server 2012 R2 Datacenter
- Windows Server 2012 R2 Datacenter
13 changes: 5 additions & 8 deletions src/Api/PubnubApi/Builder/ResponseBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace PubnubApi
{
Expand All @@ -13,9 +10,9 @@ internal class ResponseBuilder

public ResponseBuilder(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubLog log)
{
this.config = pubnubConfig;
this.jsonLib = jsonPluggableLibrary;
this.pubnubLog = log;
config = pubnubConfig;
jsonLib = jsonPluggableLibrary;
pubnubLog = log;
}

public T JsonToObject<T>(List<object> result, bool internalObject)
Expand All @@ -28,7 +25,7 @@ public T JsonToObject<T>(List<object> result, bool internalObject)
}
else
{
NewtonsoftJsonDotNet jsonNewtonLib = new NewtonsoftJsonDotNet(this.config, this.pubnubLog);
NewtonsoftJsonDotNet jsonNewtonLib = new NewtonsoftJsonDotNet(config, pubnubLog);
ret = jsonNewtonLib.DeserializeToObject<T>(result);
}

Expand Down
10 changes: 4 additions & 6 deletions src/Api/PubnubApi/Builder/StatusBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace PubnubApi
{
public class StatusBuilder
public class StatusBuilder
{
private readonly PNConfiguration config;
private readonly IJsonPluggableLibrary jsonLibrary;
Expand Down Expand Up @@ -98,11 +96,11 @@ public PNStatus CreateStatusResponse<T>(PNOperationType type, PNStatusCategory c

if (asyncRequestState != null)
{
if (asyncRequestState.Request != null)
if (asyncRequestState.RequestCancellationTokenSource != null)
{
status.ClientRequest = asyncRequestState.Request;
status.ClientRequest = asyncRequestState.RequestCancellationTokenSource;

HttpValueCollection restUriQueryCollection = HttpUtility.ParseQueryString(asyncRequestState.Request.RequestUri.Query);
HttpValueCollection restUriQueryCollection = HttpUtility.ParseQueryString(new Uri(asyncRequestState.Response.RequestUrl).Query);
if (restUriQueryCollection.ContainsKey("auth"))
{
string auth = restUriQueryCollection["auth"];
Expand Down
Loading

0 comments on commit 6cbb75f

Please sign in to comment.