Exemplo n.º 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;
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
        }
Exemplo n.º 11
0
 public void Initialize()
 {
     _factory = new IsolatedStorageFeedFactory();
 }
Exemplo n.º 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;
 }
Exemplo n.º 14
0
 public FeedSerializationTests()
 {
     Factory = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
Exemplo n.º 15
0
 public MarshallerTests()
 {
     feedFactory = new FeedFactory();
     marshaller  = new Marshaller(feedFactory);
 }
Exemplo n.º 16
0
 public static void Initialize(TestContext context)
 {
     _factory = new HttpFeedFactory();
 }
Exemplo n.º 17
0
 protected BaseFeedFactoryTests(IFeedFactory factory, FeedType feedtype, IEnumerable <TestCaseData> testcases) : base(testcases)
 {
     this.Factory  = factory;
     this.FeedType = feedtype;
 }
Exemplo n.º 18
0
 public void Initialize()
 {
     _factory = new IsolatedStorageFeedFactory();
 }
Exemplo n.º 19
0
 public FeedSerializationTests()
 {
     Factory  = new FileSystemFeedFactory();
     FeedType = FeedType.Rss20;
 }
Exemplo n.º 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;
 }
Exemplo n.º 22
0
 public AsyncHttpFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory  = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
Exemplo n.º 23
0
 public AsyncHttpFeedFactoryTests()
     : base(TestFileLoader.LoadValidRssTestCases(TestFileLoader.TestFileType.Http))
 {
     Factory = new HttpFeedFactory();
     FeedType = FeedType.Rss20;
 }
Exemplo n.º 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;
 }
Exemplo n.º 26
0
 public FeedController(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 29
0
 protected BaseMissingFeedFactoryTest(IFeedFactory factory, FeedType feedtype, IEnumerable <TestCaseData> testcases)
     : base(factory, feedtype, testcases)
 {
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 34
0
 public SymbolRssActor(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
Exemplo n.º 35
0
 public FeedController(IFeedFactory feedFactory)
 {
     _feedFactory = feedFactory;
 }
 public BaseSyndicationFeedTest(IFeedFactory factory, IEnumerable <TestCaseData> testcases)
     : base(testcases)
 {
     this.Factory = factory;
 }
Exemplo n.º 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;
 }
Exemplo n.º 40
0
 public BlogPostSection(WebDriver driver, ILogger logger, IFeedFactory feedFactory)
     : base(driver, logger)
 {
     _feedFactory = feedFactory;
 }