Skip to content

Commit

Permalink
fix(presenceEventDataParsing): fixed issue in presence event data par…
Browse files Browse the repository at this point in the history
…sing arise due to change in list of serialized object values indexing differences happened after customtype introduction
  • Loading branch information
mohitpubnub committed Nov 20, 2024
1 parent 7e972cb commit b9c483e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ public static T DeserializeToInternalObject<T>(IJsonPluggableLibrary jsonPlug, L

if (listObject.Count == 6)
{
ack.Subscription = listObject[4].ToString();
ack.Subscription = ack.Subscription.Replace("-pnpres", "");
ack.Subscription = listObject[5]?.ToString();
ack.Subscription = ack.Subscription?.Replace("-pnpres", "");
}

if (listObject[1] != null)
Expand Down
29 changes: 12 additions & 17 deletions src/UnitTests/AcceptanceTests/Steps/EventEngineSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ public void GivenTheDemoKeysetWithEventEngineEnabled()

statusCallback = new SubscribeCallbackExt(delegate (Pubnub pnObj, PNStatus status) {
pnStatus = status;
Console.WriteLine("{0} {1} {2}", pnStatus.Operation, pnStatus.Category, pnStatus.StatusCode);
if (currentContract == "subscribeHandshakeFailure" && pn.PubnubUnitTest.Attempts == 3) {
statusReceivedEvent.Set();
}
Expand All @@ -266,30 +265,24 @@ public void GivenTheDemoKeysetWithEventEngineEnabled()
subscribeCallback = new SubscribeCallbackExt(
delegate (Pubnub pnObj, PNMessageResult<object> pubMsg)
{
Console.WriteLine($"Message received in listener. {pn.JsonPluggableLibrary.SerializeToJsonString(pubMsg)}");
messageResult = pubMsg;
messageReceivedEvent.Set();
},
delegate (Pubnub pnObj, PNPresenceEventResult presenceEvnt)
{
Console.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(presenceEvnt));
presenceEvent.Set();
},
delegate (Pubnub pnObj, PNSignalResult<object> signalMsg)
{
Console.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(signalMsg));
},
delegate (Pubnub pnObj, PNObjectEventResult objectEventObj)
{
Console.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(objectEventObj));
},
delegate (Pubnub pnObj, PNMessageActionEventResult msgActionEvent)
{
System.Diagnostics.Debug.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(msgActionEvent));
},
delegate (Pubnub pnObj, PNFileEventResult fileEvent)
{
System.Diagnostics.Debug.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(fileEvent));
});
}

Expand All @@ -303,12 +296,14 @@ public void GivenTheDemoKeysetWithPresenceEEenabled()
unitTest.IncludePnsdk = true;
unitTest.IncludeUuid = true;

config = new PNConfiguration(new UserId("pn-csharp-acceptance-test-uuid"));
config.Origin = acceptance_test_origin;
config.Secure = false;
config.PublishKey = System.Environment.GetEnvironmentVariable("PN_PUB_KEY");
config.SubscribeKey = System.Environment.GetEnvironmentVariable("PN_SUB_KEY");
config.SecretKey = System.Environment.GetEnvironmentVariable("PN_SEC_KEY");
config = new PNConfiguration(new UserId("pn-csharp-acceptance-test-uuid"))
{
Origin = acceptance_test_origin,
Secure = false,
PublishKey = System.Environment.GetEnvironmentVariable("PN_PUB_KEY"),
SubscribeKey = System.Environment.GetEnvironmentVariable("PN_SUB_KEY"),
SecretKey = System.Environment.GetEnvironmentVariable("PN_SEC_KEY")
};
if (enableIntenalPubnubLogging)
{
config.LogVerbosity = PNLogVerbosity.BODY;
Expand Down Expand Up @@ -336,13 +331,11 @@ public void GivenTheDemoKeysetWithPresenceEEenabled()
subscribeCallback = new SubscribeCallbackExt(
delegate (Pubnub pnObj, PNMessageResult<object> pubMsg)
{
Console.WriteLine($"Message received in listener. {pn.JsonPluggableLibrary.SerializeToJsonString(pubMsg)}");
messageResult = pubMsg;
messageReceivedEvent.Set();
},
delegate (Pubnub pnObj, PNPresenceEventResult presenceEvnt)
{
Console.WriteLine(pn.JsonPluggableLibrary.SerializeToJsonString(presenceEvnt));
presenceEvent.Set();
});
}
Expand All @@ -356,8 +349,10 @@ public void GivenPresenceConfiguration(string heartbeatInterval, string timeout,
[When(@"I join '(.*)', '(.*)', '(.*)' channels")]
public void WhenIJoinChannels(string first, string second, string third)
{
pn = new Pubnub(config);
pn.PubnubUnitTest = unitTest;
pn = new Pubnub(config)
{
PubnubUnitTest = unitTest
};
pn.PubnubUnitTest.PresenceActivityList?.Clear();

messageReceivedEvent = new ManualResetEvent(false);
Expand Down

0 comments on commit b9c483e

Please sign in to comment.