Inheritance: NuGet.Services.Metadata.Catalog.CommitCollector
        static async Task Test1Async()
        {
            await MakeTestCatalog();

            Func <HttpMessageHandler> handlerFunc = () =>
            {
                return(new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                });
            };

            TestCollector collector = new TestCollector("Test1", new Uri("http://*****:*****@"c:\data\site\cursor";
            Storage storage     = new FileStorage(baseAddress, path);

            DurableCursor front = new DurableCursor(new Uri("http://localhost:8000/cursor/front.json"), storage, MemoryCursor.Min.Value);
            //DurableCursor back = new DurableCursor(new Uri("http://localhost:8000/cursor/back.json"), storage);
            MemoryCursor back = MemoryCursor.Max;

            bool didWork = await collector.Run(front, back);

            if (!didWork)
            {
                Console.WriteLine("executed but no work was done");
            }
        }
        static async Task Test2Async()
        {
            await MakeTestCatalog();

            Func <HttpMessageHandler> handlerFunc = () =>
            {
                return(new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                });
            };

            TestCollector collectorA = new TestCollector("A", new Uri("http://*****:*****@"c:\data\site\cursor";
            Storage storage     = new FileStorage(baseAddress, path);

            DurableCursor cursorA = new DurableCursor(new Uri("http://localhost:8000/cursor/cursorA.json"), storage, MemoryCursor.Min.Value);
            DurableCursor cursorB = new DurableCursor(new Uri("http://localhost:8000/cursor/cursorB.json"), storage, MemoryCursor.Min.Value);

            Console.WriteLine("check catalog...");

            bool run = false;

            do
            {
                run  = false;
                run |= await collectorA.Run(cursorA, MemoryCursor.Max);

                run |= await collectorB.Run(cursorB, cursorA);
            }while (run);

            Console.WriteLine("ADDING MORE CATALOG");

            await MoreTestCatalog();

            do
            {
                run  = false;
                run |= await collectorA.Run(cursorA, MemoryCursor.Max);

                run |= await collectorB.Run(cursorB, cursorA);
            }while (run);

            Console.WriteLine("ALL DONE");
        }
        static async Task Test0Async()
        {
            await MakeTestCatalog();

            Func <HttpMessageHandler> handlerFunc = () =>
            {
                return(new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                });
            };

            TestCollector collector = new TestCollector("Test0", new Uri("http://localhost:8000/cursor/index.json"), handlerFunc);

            DateTime front = new DateTime(2014, 1, 2);
            DateTime back  = new DateTime(2014, 1, 6);

            await collector.Run(front, back);
        }
Ejemplo n.º 4
0
        static async Task Test2Async()
        {
            await MakeTestCatalog();

            Func<HttpMessageHandler> handlerFunc = () =>
            {
                return new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                };
            };

            TestCollector collectorA = new TestCollector("A", new Uri("http://*****:*****@"c:\data\site\cursor";
            Storage storage = new FileStorage(baseAddress, path);

            DurableCursor cursorA = new DurableCursor(new Uri("http://localhost:8000/cursor/cursorA.json"), storage, MemoryCursor.MinValue);
            DurableCursor cursorB = new DurableCursor(new Uri("http://localhost:8000/cursor/cursorB.json"), storage, MemoryCursor.MinValue);

            Console.WriteLine("check catalog...");

            bool run = false;

            do
            {
                run = false;
                run |= await collectorA.Run(cursorA, MemoryCursor.CreateMax(), CancellationToken.None);
                run |= await collectorB.Run(cursorB, cursorA, CancellationToken.None);
            }
            while (run);

            Console.WriteLine("ADDING MORE CATALOG");

            await MoreTestCatalog();

            do
            {
                run = false;
                run |= await collectorA.Run(cursorA, MemoryCursor.CreateMax(), CancellationToken.None);
                run |= await collectorB.Run(cursorB, cursorA, CancellationToken.None);
            }
            while (run);

            Console.WriteLine("ALL DONE");
        }
Ejemplo n.º 5
0
        static async Task Test1Async()
        {
            await MakeTestCatalog();

            Func<HttpMessageHandler> handlerFunc = () =>
            {
                return new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                };
            };

            TestCollector collector = new TestCollector("Test1", new Uri("http://*****:*****@"c:\data\site\cursor";
            Storage storage = new FileStorage(baseAddress, path);

            DurableCursor front = new DurableCursor(new Uri("http://localhost:8000/cursor/front.json"), storage, MemoryCursor.MinValue);
            //DurableCursor back = new DurableCursor(new Uri("http://localhost:8000/cursor/back.json"), storage);
            MemoryCursor back = MemoryCursor.CreateMax();

            bool didWork = await collector.Run(front, back, CancellationToken.None);

            if (!didWork)
            {
                Console.WriteLine("executed but no work was done");
            }
        }
Ejemplo n.º 6
0
        static async Task Test0Async()
        {
            await MakeTestCatalog();

            Func<HttpMessageHandler> handlerFunc = () =>
            {
                return new FileSystemEmulatorHandler
                {
                    BaseAddress = new Uri("http://*****:*****@"c:\data\site",
                    InnerHandler = new HttpClientHandler()
                };
            };

            TestCollector collector = new TestCollector("Test0", new Uri("http://localhost:8000/cursor/index.json"), handlerFunc);

            DateTime front = new DateTime(2014, 1, 2);
            DateTime back = new DateTime(2014, 1, 6);

            await collector.Run(front, back, CancellationToken.None);
        }