예제 #1
0
 public RiverWall()
 {
     Participants = new List<string>();
     Sources = new RiverSubscription();
     Template = new RiverTemplate();
     Visibility = RiverWallVisibility.Public;
     Status = RiverWallStatus.Published;
     DateCreated = Stamp.Time();
     LastModified = Stamp.Time();
 }
예제 #2
0
        public void LoadFromOPML()
        {
            var opml = new Opml();
            var res = opml.LoadFromXML(_sample);
            Assert.IsTrue(res.IsTrue, "OPML loading must be true, not " + res.Message);

            var subscription = new RiverSubscription(opml);

            Assert.IsTrue(subscription.Items.Count > 0, "River must contains items");

            Assert.IsTrue(subscription.Items.Count > 0);
            var item1 = subscription.Items.First();
            Assert.IsNotNullOrEmpty(item1.Text);
            //            Assert.IsNotNullOrEmpty(item1.Name); //depending on sample data
            //            Assert.IsNotNullOrEmpty(item1.Description); //depending on sample data
            Assert.IsNotNullOrEmpty(item1.JSONPUri.ToString());
        }
예제 #3
0
        public IQuerySetOne<RiverSubscription> FetchDefaultRivers()
        {
            string cacheKey = "DEFAULT_RIVERS";
            var cache = HttpContext.Cache[cacheKey] as RiverSubscription;

            if (cache != null)
            {
                return new QuerySetOne<RiverSubscription>(cache);
            }
            else
            {
                var fetcher = new SubscriptionFetcher();
            #if DEBUG
                var xml = fetcher.Download(Texts.FromUriHost(Request.Url), "api/1/default/RiversSubscription");
            #else
                var xml = fetcher.Download("http://hobihobi.apphb.com", "api/1/default/RiversSubscription");
            #endif
                var opml = new Opml();
                var res = opml.LoadFromXML(xml);

                if (res.IsTrue)
                {
                    var subscriptionList = new RiverSubscription(opml);
                    HttpContext.Cache.Add(cacheKey, subscriptionList, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 10, 0), CacheItemPriority.Default, null);

                    return new QuerySetOne<RiverSubscription>(subscriptionList);
                }
                else
                {
                    return new QuerySetOne<RiverSubscription>(null);
                }
            }
        }
예제 #4
0
        public static RiverSubscription Get()
        {
            var river = new RiverSubscription();
            river.Title = "Default Rivers";
            river.OwnerName = "Hobi Hobi";
            river.DateCreated = Stamp.Time();
            river.DateModified = Stamp.Time();

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "New York Times",
                Name = "nyt",
                Language = "en",
                JSONPUri = new Uri("http://static.scripting.com/river3/rivers/nytRiver.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "The Economist's Blogs",
                Name = "theEconomistBlogs",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/the-economist-blogs")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Magazines",
                Name = "magazines",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/magazines")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Movies",
                Name = "moviesRiver",
                Language = "en",
                JSONPUri = new Uri("http://static.scripting.com/river3/rivers/movies.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Reuters' Market News",
                Name = "ReutersMarkets",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/reuters-markets")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Technology",
                Name = "tech",
                Language = "en",
                JSONPUri = new Uri("http://static.scripting.com/river3/rivers/tech.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Celebrities",
                Name = "celebrities",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/celebrities")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Dave Winer",
                Name = "dave",
                Language = "en",
                JSONPUri = new Uri("http://static.scripting.com/river3/rivers/iowa.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "No Agenda Network",
                Name = "noagenda",
                Language = "en",
                JSONPUri = new Uri("http://s3.amazonaws.com/river.curry.com/rivers/radio2/River3.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Podcasts",
                Name = "podcastRiver",
                Language = "en",
                JSONPUri = new Uri("http://static.scripting.com/river3/rivers/podcasts.js")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Nouvelles Marocaine",
                Name = "marocainNovelles",
                Language = "fr",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/marocain-nouvelles")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Notizie Italia",
                Name = "notizieItalia",
                Language = "it",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/Italian")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Programming",
                Name = "programmingNews",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/programming")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "ASEAN Nations",
                Name = "asean",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/asean")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Southern Africa",
                Name = "asean",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/southern-africa")
            });

            river.Items.Add(new RiverSubscriptionItem
            {
                Text = "Middle East",
                Name = "middleEast",
                Language = "en",
                JSONPUri = new Uri("http://hobieu.apphb.com/s/riverjs/middle-east")
            });

            return river;
        }