示例#1
0
 public Detector(IFeedFactory feedFactory, IScanlinePool scanlinePool)
     : base(500)
 {
     this._frameFeedHighEnergy = feedFactory.GetFeedOf <IFrame>("RawHighEnergyFrameFeed");
     this._frameFeedLowEnergy  = feedFactory.GetFeedOf <IFrame>("RawLowEnergyFrameFeed");
     this._scanLinePool        = scanlinePool;
 }
示例#2
0
        public void Initialize()
        {
            _factory     = new IsolatedStorageFeedFactory();
            _rssDocument = _factory.CreateFeed(new Uri(SilverlightTestFileLoader.SampleRssFeeds().First(), UriKind.Relative), FeedType.Rss20,
                                               SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleRssFeeds().First()));

            _atomDocument = _factory.CreateFeed(new Uri(SilverlightTestFileLoader.SampleAtomFeeds().First(), UriKind.Relative), FeedType.Atom10,
                                                SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleAtomFeeds().First()));
        }
        public FeedParserActor(IFeedFactory feedFactory, IActorRef downloadActor, string consoleWriterActorPath)
        {
            _feedFactory = feedFactory;
            _downloadActor = downloadActor;
            _consoleWriterActorPath = consoleWriterActorPath;

            //Set our Receive functions
            Initialize();
        }
        public FeedParserActor(IFeedFactory feedFactory, ActorRef downloadActor, string consoleWriterActorPath)
        {
            _feedFactory            = feedFactory;
            _downloadActor          = downloadActor;
            _consoleWriterActorPath = consoleWriterActorPath;

            //Set our Receive functions
            Initialize();
        }
        public void Initialize()
        {
            _factory = new IsolatedStorageFeedFactory();
            _rssDocument = _factory.CreateFeed(new Uri(SilverlightTestFileLoader.SampleRssFeeds().First(), UriKind.Relative), FeedType.Rss20,
                                SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleRssFeeds().First()));

            _atomDocument = _factory.CreateFeed(new Uri(SilverlightTestFileLoader.SampleAtomFeeds().First(), UriKind.Relative), FeedType.Atom10,
                                SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleAtomFeeds().First()));

        }
        public FeedValidatorActor(IFeedFactory feedFactory, string consoleWriterActorPath)
        {
            _feedFactory = feedFactory;
            _consoleWriterActorPath = consoleWriterActorPath;

            //We're using a ReceiveActor, so we can define different receive functions for individual types of messages.
            Receive<string>(s =>
            {
                SendMessage(string.Format("Validating that {0} is a URL...", s));
                if (IsValidUrl(s))
                {
                    SendMessage(string.Format("{0} is a valid URL.", s), PipeToSampleStatusCode.Success);
                    SendMessage(string.Format("Determining if {0} hosts an RSS feed...", s));

                    var feedUri = new Uri(s, UriKind.Absolute);

                    /*
                     * WOAH! What's going on here?
                     * 
                     * We're calling IsValidRssOrAtomFeed(feedUri), an async method that returns Task<bool>.
                     * Rather than waiting on that Task and blocking the Actor or using the AWAIT keyword, which is unsupported,
                     * we're continuing the task and having it transform its results into a IsValidFeed object, which we'll then
                     * PipeTo this actor's inbox!
                     * 
                     * Async programming with Actors essentially means treating the output of asynchronous operations as just new types
                     * of messages. Because of this design, one FeedValidatorActor could validate many RSS / ATOM feeds concurrently without
                     * changing any of this code.
                     */
                    IsValidRssOrAtomFeed(feedUri).ContinueWith(rssValidationResult => new IsValidFeed(feedUri, rssValidationResult.Result), 
                        TaskContinuationOptions.AttachedToParent & TaskContinuationOptions.ExecuteSynchronously).PipeTo(Self);
                }
                else
                {
                    //tell the console reader actor that we need to have the user supply a different URL
                    SendValidationFailure(string.Format("{0} is NOT a valid URL.", s), s);
                }
            });

            //Receive function used to process the results of our PipeTo function in the previous Receive<string> block
            Receive<IsValidFeed>(feed =>
            {
                if (!feed.IsValid)
                {
                    //tell the console reader actor that we need to have the user supply a different URL
                    SendValidationFailure(string.Format("{0} is NOT a valid RSS or ATOM feed.", feed.FeedUri), feed.FeedUri.ToString());
                }
                else
                {
                    SendMessage(string.Format("{0} is a valid RSS or ATOM feed.", feed.FeedUri), PipeToSampleStatusCode.Success);
                    
                    //Begin processing the feed!
                    Context.ActorOf(Props.Create(() => new FeedParserCoordinator(feed.FeedUri)));
                }
            });
        }
        public FeedValidatorActor(IFeedFactory feedFactory, string consoleWriterActorPath)
        {
            _feedFactory            = feedFactory;
            _consoleWriterActorPath = consoleWriterActorPath;

            //We're using a ReceiveActor, so we can define different receive functions for individual types of messages.
            Receive <string>(s =>
            {
                SendMessage(string.Format("Validating that {0} is a URL...", s));
                if (IsValidUrl(s))
                {
                    SendMessage(string.Format("{0} is a valid URL.", s), PipeToSampleStatusCode.Success);
                    SendMessage(string.Format("Determining if {0} hosts an RSS feed...", s));

                    var feedUri = new Uri(s, UriKind.Absolute);

                    /*
                     * WOAH! What's going on here?
                     *
                     * We're calling IsValidRssOrAtomFeed(feedUri), an async method that returns Task<bool>.
                     * Rather than waiting on that Task and blocking the Actor or using the AWAIT keyword, which is unsupported,
                     * we're continuing the task and having it transform its results into a IsValidFeed object, which we'll then
                     * PipeTo this actor's inbox!
                     *
                     * Async programming with Actors essentially means treating the output of asynchronous operations as just new types
                     * of messages. Because of this design, one FeedValidatorActor could validate many RSS / ATOM feeds concurrently without
                     * changing any of this code.
                     */
                    IsValidRssOrAtomFeed(feedUri).ContinueWith(rssValidationResult => new IsValidFeed(feedUri, rssValidationResult.Result),
                                                               TaskContinuationOptions.AttachedToParent & TaskContinuationOptions.ExecuteSynchronously).PipeTo(Self);
                }
                else
                {
                    //tell the console reader actor that we need to have the user supply a different URL
                    SendValidationFailure(string.Format("{0} is NOT a valid URL.", s), s);
                }
            });

            //Receive function used to process the results of our PipeTo function in the previous Receive<string> block
            Receive <IsValidFeed>(feed =>
            {
                if (!feed.IsValid)
                {
                    //tell the console reader actor that we need to have the user supply a different URL
                    SendValidationFailure(string.Format("{0} is NOT a valid RSS or ATOM feed.", feed.FeedUri), feed.FeedUri.ToString());
                }
                else
                {
                    SendMessage(string.Format("{0} is a valid RSS or ATOM feed.", feed.FeedUri), PipeToSampleStatusCode.Success);

                    //Begin processing the feed!
                    Context.ActorOf(Props.Create(() => new FeedParserCoordinator(feed.FeedUri)));
                }
            });
        }
 public void Initialize()
 {
     _factory     = new IsolatedStorageFeedFactory();
     _rssDocument =
         SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleRssFeeds().First());
     _atomDocument =
         SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleAtomFeeds().First());
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_rssDocument, new Uri(SimpleRssPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_rssDocument, new Uri(ComplexRssPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_atomDocument, new Uri(SimpleAtomPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_atomDocument, new Uri(ComplexAtomPath, UriKind.Relative));
 }
 public void Initialize()
 {
     _factory = new IsolatedStorageFeedFactory();
     _rssDocument =
         SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleRssFeeds().First());
     _atomDocument =
         SilverlightTestFileLoader.ReadFeedContents(SilverlightTestFileLoader.SampleAtomFeeds().First());
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_rssDocument, new Uri(SimpleRssPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_rssDocument, new Uri(ComplexRssPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_atomDocument, new Uri(SimpleAtomPath, UriKind.Relative));
     SilverlightTestFileLoader.WriteFeedToIsolatedStorage(_atomDocument, new Uri(ComplexAtomPath, UriKind.Relative));
 }
示例#10
0
        public Marshaller(IFeedFactory feedFactory)
            : base(1000)
        {
            var highEnergyFrameFeed = feedFactory.GetFeedOf <IFrame>("RawHighEnergyFrameFeed");

            _highEnergyFrameFeedQueue = highEnergyFrameFeed.Subscribe();

            var lowEnergyFrameFeed = feedFactory.GetFeedOf <IFrame>("RawLowEnergyFrameFeed");

            _lowEnergyFrameFeedQueue = lowEnergyFrameFeed.Subscribe();

            Trace.TraceInformation("Marshaller initialized ({0} ,{1}).", _highEnergyFrameFeedQueue.Count, _lowEnergyFrameFeedQueue.Count);
        }
示例#11
0
 public void Initialize()
 {
     _factory = new IsolatedStorageFeedFactory();
 }
示例#12
0
 public BaseKnownValueTest(IFeedFactory factory, IEnumerable<TestCaseData> testcases) : base(testcases)
 {
     this.Factory = factory;
 }
 public AsyncFileSysFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.FileSys))
 {
     Factory = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#14
0
 public FeedSerializationTests()
 {
     Factory = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#15
0
 public MarshallerTests()
 {
     feedFactory = new FeedFactory();
     marshaller  = new Marshaller(feedFactory);
 }
 public static void Initialize(TestContext context)
 {
     _factory = new HttpFeedFactory();
 }
示例#17
0
 protected BaseFeedFactoryTests(IFeedFactory factory, FeedType feedtype, IEnumerable <TestCaseData> testcases) : base(testcases)
 {
     this.Factory  = factory;
     this.FeedType = feedtype;
 }
示例#18
0
 public void Initialize()
 {
     _factory = new IsolatedStorageFeedFactory();
 }
 public FeedSerializationTests()
 {
     Factory  = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#20
0
 public Conveyer(IFeedFactory feedFactory)
     : base(100)
 {
     conveyerPositionFeed = feedFactory.GetFeedOf <IConveyerPosition>("ConveyerPositionFeed");
 }
 public AsyncMissingHttpFeedFactoryTests()
     : base(TestFileLoader.LoadMissingTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory  = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#22
0
 public AsyncHttpFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory  = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
 public AsyncHttpFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#24
0
 public AsyncFileSysFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.FileSys))
 {
     Factory  = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
 public BaseKnownValueTest(IFeedFactory factory, IEnumerable <TestCaseData> testcases) : base(testcases)
 {
     this.Factory = factory;
 }
示例#26
0
 public FeedController(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
示例#27
0
 public void SetUp()
 {
     this.Factory = new FileSystemFeedFactory();
     feeduri = new Uri(TestFileLoader.LoadValidAtomTestCases(TestFileLoader.TestFileType.FileSys).Last().Arguments[0].ToString());
     itemCount = 3;
 }
 public FeedParserActor(IFeedFactory feedFactory, IActorRef downloadActor) 
     : this(feedFactory, downloadActor, ActorNames.ConsoleWriterActor.Path)
 {
 }
示例#29
0
 protected BaseMissingFeedFactoryTest(IFeedFactory factory, FeedType feedtype, IEnumerable <TestCaseData> testcases)
     : base(factory, feedtype, testcases)
 {
 }
示例#30
0
 public void SetUp()
 {
     this.Factory = new FileSystemFeedFactory();
     feeduri      = new Uri(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.FileSys).First().Arguments[0].ToString());
     itemCount    = 3;
 }
 public AsyncMissingHttpFeedFactoryTests()
     : base(TestFileLoader.LoadMissingTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#32
0
 public FeedQueryService(IFeedFactory factory, TimeSpan cacheDuration)
 {
     CacheExpirationWindow = cacheDuration;
     Factory = factory;
 }
 public AsyncMissingFileSysFeedFactoryTest()
     : base(TestFileLoader.LoadMissingTestCases(TestFileLoader.TestFileType.FileSys))
 {
     Factory  = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#34
0
 public SymbolRssActor(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
示例#35
0
 public FeedController(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
 public BaseSyndicationFeedTest(IFeedFactory factory, IEnumerable <TestCaseData> testcases)
     : base(testcases)
 {
     this.Factory = factory;
 }
示例#37
0
 public FeedQueryService(IFeedFactory factory)
     : this(factory, DefaultCacheExpriationWindow)
 {
 }
 public FeedParserActor(IFeedFactory feedFactory, ActorRef downloadActor)
     : this(feedFactory, downloadActor, ActorNames.ConsoleWriterActor.Path)
 {
 }
 public AsyncMissingFileSysFeedFactoryTest()
     : base(TestFileLoader.LoadMissingTestCases(TestFileLoader.TestFileType.FileSys))
 {
     Factory = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
示例#40
0
 public BlogPostSection(WebDriver driver, ILogger logger, IFeedFactory feedFactory)
     : base(driver, logger)
 {
     _feedFactory = feedFactory;
 }