From e8a2fa0aee5838b3f54b9fccf073870641c2e37b Mon Sep 17 00:00:00 2001 From: Manish Sinha Date: Thu, 28 Apr 2011 23:03:40 +0530 Subject: Updated the blacklist API --- .../Blacklist/TestInsertEventsWithBlacklist.cs | 18 ++++++++++-------- Zeitgeist/BlacklistClient.cs | 10 ++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs b/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs index c88b8c8..9495524 100644 --- a/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs +++ b/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs @@ -39,6 +39,15 @@ namespace Zeitgeist.Testsuite { LogClient client = new LogClient(); BlacklistClient bClient = new BlacklistClient(); + // Handle the Template Added event + bClient.TemplateAdded += delegate(string blacklistId, Event addedTemplate) { + Console.Out.WriteLine("Blacklist added for: ", blacklistId); + }; + // Handle the Template Removed event + bClient.TemplateRemoved += delegate(string blacklistId, Event removedTemplate) { + Console.Out.WriteLine("Blacklist removed for: ", blacklistId); + }; + string fooBlacklistId = "block-foo"; // Create the first event @@ -72,14 +81,7 @@ namespace Zeitgeist.Testsuite // If inserted, clean the database by deleting random events client.DeleteEvents(res); - // Handle the Template Added event - bClient.TemplateAdded += delegate(string blacklistId, Event addedTemplate) { - Console.Out.WriteLine("Blacklist added for: ", blacklistId); - }; - // Handle the Template Removed event - bClient.TemplateRemoved += delegate(string blacklistId, Event removedTemplate) { - Console.Out.WriteLine("Blacklist removed for: ", blacklistId); - }; + // Add the blacklist template bClient.AddTemplate(fooBlacklistId, evTemplate); diff --git a/Zeitgeist/BlacklistClient.cs b/Zeitgeist/BlacklistClient.cs index 6019748..4aaf8ae 100644 --- a/Zeitgeist/BlacklistClient.cs +++ b/Zeitgeist/BlacklistClient.cs @@ -50,14 +50,16 @@ namespace Zeitgeist // Connect the Template Added event srcInterface.TemplateAdded += delegate(string blacklistId, RawEvent addedTemplate) { - if(TemplateAdded != null) - TemplateAdded(blacklistId, RawEvent.FromRaw(addedTemplate)); + Console.Out.WriteLine("Blacklist added for: "+blacklistId); + if(this.TemplateAdded != null) + this.TemplateAdded(blacklistId, RawEvent.FromRaw(addedTemplate)); }; // Connect the Template Removed event srcInterface.TemplateRemoved += delegate(string blacklistId, RawEvent removedTemplate) { - if(TemplateRemoved != null) - TemplateRemoved(blacklistId, RawEvent.FromRaw(removedTemplate)); + Console.Out.WriteLine("Blacklist removed for: "+blacklistId); + if(this.TemplateRemoved != null) + this.TemplateRemoved(blacklistId, RawEvent.FromRaw(removedTemplate)); }; } -- cgit v1.2.3