-
Notifications
You must be signed in to change notification settings - Fork 20
Feature Notification Center #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Notification Center #35
Conversation
Feature Notification Center
Can one of the admins verify this patch? |
OptimizelySDK/Optimizely.cs
Outdated
@@ -262,6 +265,8 @@ public void Track(string eventKey, string userId, UserAttributes userAttributes | |||
Logger.Log(LogLevel.ERROR, string.Format("Unable to dispatch conversion event. Error {0}", exception.Message)); | |||
} | |||
|
|||
NotificationCenter.FireNotifications(NotificationCenter.NotificationType.Track, eventKey, userId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change to SendNotifications
OptimizelySDK/Optimizely.cs
Outdated
} | ||
|
||
NotificationCenter.FireNotifications(NotificationCenter.NotificationType.FeatureRollout, featureKey, userId, | ||
userAttributes, audience); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass back an array of audiences should be an array of one for now
private TestNotificationCallbacks TestNotificationCallbacks; | ||
private NotificationCenter.NotificationType NotificationTypeActivate = NotificationCenter.NotificationType.Activate; | ||
private NotificationCenter.NotificationType NotificationTypeTrack = NotificationCenter.NotificationType.Track; | ||
private NotificationCenter.NotificationType NotificationTypeFeatureExperiment = NotificationCenter.NotificationType.FeatureExperiment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a fourth non-mobile NotificationType enum value FeatureRollout beyond Activate, Track, FeatureExperiment . I do not see FeatureRollout being tested in NotificationCenterTests.cs .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check here.
https://github.com/optimizely/csharp-sdk/pull/35/files#diff-8660e0a3c8615b111f08b9e4ab4f9b36R1689
, I have added more tests, you can see in the latest check-in.
TEST: Test / Debug / "All Tests" ISSUE: TestBucketLogsCorrectlyWhenUserProfileFailsToSave
|
CODE COVERAGE WEAKNESSES ELSEWHERE IN SDK FIRST: DefaultErrorHandler.cs SECOND: ConfigParser.cs THIRD: OptimizelyException.cs |
C# EVENT BRAINSTORM Why isn't Optimizely's "NotificationCenter.cs" coded around Microsoft C# events? QUESTION: Should we be using C# events? I would like to see a study and evaluation of a design using Microsoft C# event |
As mentioned today during meeting, we are going to maintain the current generic notificationCenter and not code around the platform-specific NotificationCenter provided by Microsoft. |
public int AddNotification(NotificationType notificationType, FeatureRolloutCallback featureRolloutCallback) | ||
{ | ||
if (!IsNotificationTypeValid(notificationType, NotificationType.FeatureRollout)) | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a unit test for this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check it's already added here.
https://github.com/optimizely/csharp-sdk/pull/35/files/857b9344c2d95e2ee4580481757baf1d495d8802#diff-486ac263b47f8642a94df74943c6036bR84
} | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a unit test for this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added in the recent commit.
79d6a9a#diff-486ac263b47f8642a94df74943c6036bR50
return 0; | ||
|
||
return AddNotification(notificationType, (object)activateCallback); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MANY AddNotification(...) METHODS
There are multiple AddNotification(...) methods in the NotificationCenter class.
If we were using Microsoft C# events, we would just be "+=" handlers for 4 different
events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may remove overloaded AddNotification methods but it is typed safe that's why I added it. Otherwise AddNotification(NotificationType, Delegate) can be used as an argument type to support all subtype delegates.
Using Microsoft C# events, approach will be different for Add/Remove and no notificationId & notificationtype concept would be there. Here approach is same with other SDKs.
Added one more test case for FeatureRollout Notification type. Removed ConfigParser method which was not being used.
ISSUE: TestBucketLogsCorrectlyWhenUserProfileFailsToSave - FIXED OptimizelyException.cs (Exception class not used) |
|
||
private NotificationType NotificationTypeActivate = NotificationType.Activate; | ||
private NotificationType NotificationTypeTrack = NotificationType.Track; | ||
private NotificationType NotificationTypeFeatureExperiment = NotificationType.FeatureExperiment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msohailh we've decided to exclude these notification types for now as we need to determine better verbiage/naming for them. So for now just keep Activate
and Track
@mikeng13 I have removed FeatureExperiment and FeatureRollout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. I have a couple of comments/questions.
notificationCallbackMock.Setup(nc => nc.TestAnotherActivateCallback(It.IsAny<Experiment>(), | ||
It.IsAny<string>(), It.IsAny<UserAttributes>(), It.IsAny<Variation>(), It.IsAny<LogEvent>())); | ||
|
||
notificationCallbackMock.Setup(nc => nc.TestFeatureRolloutCallback(It.IsAny<string>(), It.IsAny<string>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove feature rollout and feature experiment callbacks. they will be added later if you can keep them in branch somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed featurerollout and featureexperiment callbacks. 4b096d1
NotificationCenter.AddNotification(NotificationTypeTrack, notificationCallbackMock.Object.TestTrackCallback); | ||
|
||
// Fire decision type notifications. | ||
NotificationCenter.SendNotifications(NotificationTypeActivate, config.GetExperimentFromKey("test_experiment"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LogEvent would never be null. So maybe mock it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mocked it. Please check. 0e80f49
Fixed Timing issue with Activate() & Track() being called sequentially
* Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1
* Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1
* OASIS-2504 [C#] Release 2.0.0-beta1 (#71) * Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1 * Correct 2.0.0-beta1 release date in CHANGELOG.md
* GetEnabledFeatures now returns sorted features list. (#69) * GetEnabledFeatures now returns sorted features list ignoring case * Removes sorting from GetEnabledFeatures method. (#73) * OASIS-2504 [C#] Release 2.0.0-beta1 (#72) * OASIS-2504 [C#] Release 2.0.0-beta1 (#71) * Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1 * Correct 2.0.0-beta1 release date in CHANGELOG.md * 2.0.0-beta1 --> 2.0.0 (#74) (#75) * Input validation in Activate, Track and GetVariation methods. (#76) * Input validation in Activate, Track and GetVariation methods. * Replaced InputType enum with string constants. * Updates unit tests. * Fix impression sent from feature experiment variation toggled off. * Revert "Fix impression sent from feature experiment variation toggled off." This reverts commit c943747. * Fix impression sent from feature experiment variation toggled off. (#84) * Update OptimizelySDK.DemoApp.csproj OptimizelySDK Reference * Update AssemblyVersion, AssemblyFileVersion, AssemblyInformationalVersion * Update the OptimizelySDK.Package/OptimizelySDK.nuspec * Upgrade DemoApp to OptimizelySDK 2.0.1
* GetEnabledFeatures now returns sorted features list. (#69) * GetEnabledFeatures now returns sorted features list ignoring case * Removes sorting from GetEnabledFeatures method. (#73) * OASIS-2504 [C#] Release 2.0.0-beta1 (#72) * OASIS-2504 [C#] Release 2.0.0-beta1 (#71) * Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1 * Correct 2.0.0-beta1 release date in CHANGELOG.md * 2.0.0-beta1 --> 2.0.0 (#74) (#75) * Input validation in Activate, Track and GetVariation methods. (#76) * Input validation in Activate, Track and GetVariation methods. * Replaced InputType enum with string constants. * Updates unit tests. * Fix impression sent from feature experiment variation toggled off. * Revert "Fix impression sent from feature experiment variation toggled off." This reverts commit c943747. * Fix impression sent from feature experiment variation toggled off. (#84) * Update OptimizelySDK.DemoApp.csproj OptimizelySDK Reference * Update AssemblyVersion, AssemblyFileVersion, AssemblyInformationalVersion * Update the OptimizelySDK.Package/OptimizelySDK.nuspec * Upgrade DemoApp to Optimizely BDA7 SDK 2.0.1
* 2.0.1 (#86) * GetEnabledFeatures now returns sorted features list. (#69) * GetEnabledFeatures now returns sorted features list ignoring case * Removes sorting from GetEnabledFeatures method. (#73) * OASIS-2504 [C#] Release 2.0.0-beta1 (#72) * OASIS-2504 [C#] Release 2.0.0-beta1 (#71) * Revert "Eventdispatcherissue (#35) (#54)" This reverts commit 5df7cfb. * Bump version to 2.0 beta. * Update OptimizelySDK.nuspec * AssemblyVersion = 2.0.0.0 * Improved 1.3.1 DemoApp * Updated OptimizelySDK.Package and OptimizelySDK.nuspec * keypair.snk for *.sln, *.csproj * CHANGELOG.md corrections * SDK_VERSION synch with NuGet package version. * Make 'UserAttributes userAttributes = null' optional in 5 API's * Update verifysn.ps1 and DemoApp.csproj to 2.0.0-beta1 * Correct 2.0.0-beta1 release date in CHANGELOG.md * 2.0.0-beta1 --> 2.0.0 (#74) (#75) * Input validation in Activate, Track and GetVariation methods. (#76) * Input validation in Activate, Track and GetVariation methods. * Replaced InputType enum with string constants. * Updates unit tests. * Fix impression sent from feature experiment variation toggled off. * Revert "Fix impression sent from feature experiment variation toggled off." This reverts commit c943747. * Fix impression sent from feature experiment variation toggled off. (#84) * Update OptimizelySDK.DemoApp.csproj OptimizelySDK Reference * Update AssemblyVersion, AssemblyFileVersion, AssemblyInformationalVersion * Update the OptimizelySDK.Package/OptimizelySDK.nuspec * Upgrade DemoApp to OptimizelySDK 2.0.1 * Update verifysn.ps1 to 2.0.1 * Update CHANGELOG.md to OptimizelySDK 2.0.1
OASIS-1861 Implement notification listeners