Ejemplo n.º 1
0
        public void GetCabs()
        {
            if (!AtomTestSettings.EnableWinQualCabDownloadTests)
            {
                return;
            }

            DateTime startTime = DateTime.Now.AddDays(-89);

            AtomFeed atomFeed = new AtomFeed(null, 1, 100000, false, true, null, 11);

            Assert.AreEqual(true, atomFeed.Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword));

            try
            {
                // ATOM GetProducts.
                AtomProductCollection atomProducts = atomFeed.GetProducts();

                bool foundCab = false;

                foreach (AtomProduct atomProduct in atomProducts)
                {
                    AtomFileCollection atomFiles = atomFeed.GetFiles(atomProduct);

                    foreach (AtomFile atomFile in atomFiles)
                    {
                        AtomEventCollection atomEvents = atomFeed.GetEvents(atomFile, startTime);

                        foreach (AtomEvent atomEvent in atomEvents)
                        {
                            AtomCabCollection eventCabs = atomFeed.GetCabs(atomEvent);

                            foreach (AtomCab eventCab in eventCabs)
                            {
                                Assert.AreEqual(true, eventCab.Cab.DateCreatedLocal < DateTime.Now);
                                foundCab = true;
                            }

                            if (foundCab)
                            {
                                return;
                            }
                        }
                    }
                }

                Assert.AreEqual(true, false); // Should get here.
            }
            finally
            {
                try { atomFeed.LogOut(); }
                catch { }
            }
        }
Ejemplo n.º 2
0
        public static StackHashCabCollection GetCabInfoAtom(AtomFeed feed, AtomEvent theEvent)
        {
            // Get the list of events.
            AtomCabCollection atomCabs = feed.GetCabs(theEvent);

            // Convert to a StackHashCabCollection.
            StackHashCabCollection atomStackHashCabss = new StackHashCabCollection();

            foreach (AtomCab atomCab in atomCabs)
            {
                atomStackHashCabss.Add(atomCab.Cab);
            }

            return(atomStackHashCabss);
        }
Ejemplo n.º 3
0
        public void DownloadSingleCab()
        {
            if (!AtomTestSettings.EnableWinQualCabDownloadTests)
            {
                return;
            }

            AtomFeed atomFeed = new AtomFeed(null, 1, 100000, false, false, null, 11);

            // ATOM LOGIN.
            Assert.AreEqual(true, atomFeed.Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword));

            // ATOM GetProducts.
            AtomProductCollection atomProducts = atomFeed.GetProducts();


            // WERAPI Login.
            Login login = new Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword);

            login.Validate();

            foreach (AtomProduct atomProduct in atomProducts)
            {
                Console.WriteLine("Processing product " + atomProduct.Product.Name + " " + atomProduct.Product.Id.ToString());

                // ATOM GetFiles.
                AtomFileCollection atomFiles = atomFeed.GetFiles(atomProduct);

                foreach (AtomFile atomFile in atomFiles)
                {
                    Console.WriteLine("Processing file " + atomFile.File.Name + " " + atomFile.File.Id.ToString());
                    // ATOM GetEvents.
                    AtomEventCollection atomEvents = atomFeed.GetEvents(atomFile);

                    foreach (AtomEvent atomEvent in atomEvents)
                    {
                        Console.WriteLine("Processing event " + atomEvent.Event.Id.ToString());

                        // ATOM GetCabs.
                        AtomCabCollection atomCabs = atomFeed.GetCabs(atomEvent);

                        if (atomCabs.Count != 0)
                        {
                            StackHashCab cab = atomCabs[0].Cab;

                            // Convert back to an AtomCab.
                            AtomCab newCab = new AtomCab(cab, AtomCab.MakeLink(atomEvent.Event.EventTypeName, atomEvent.Event.Id, cab.Id, cab.SizeInBytes));

                            Console.WriteLine("Downloading cab " + cab.Id.ToString());

                            String tempFolder = Path.GetTempPath();

                            String fileName = atomFeed.DownloadCab(newCab, true, tempFolder);

                            try
                            {
                                Assert.AreEqual(true, File.Exists(fileName));
                                FileInfo fileInfo = new FileInfo(fileName);

                                Assert.AreEqual(cab.SizeInBytes, fileInfo.Length);
                            }
                            finally
                            {
                                if (File.Exists(fileName))
                                {
                                    File.Delete(fileName);
                                }
                            }

                            // 1 is enough.
                            return;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void DownloadCab()
        {
            if (!AtomTestSettings.EnableWinQualCabDownloadTests)
            {
                return;
            }

            DateTime startTime = DateTime.Now.AddDays(-89);

            AtomFeed atomFeed = new AtomFeed(null, 1, 100000, false, true, null, 11);

            Assert.AreEqual(true, atomFeed.Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword));

            try
            {
                // ATOM GetProducts.
                AtomProductCollection atomProducts = atomFeed.GetProducts();

                bool foundCab = false;

                foreach (AtomProduct atomProduct in atomProducts)
                {
                    AtomFileCollection atomFiles = atomFeed.GetFiles(atomProduct);

                    foreach (AtomFile atomFile in atomFiles)
                    {
                        AtomEventCollection atomEvents = atomFeed.GetEvents(atomFile, startTime);

                        foreach (AtomEvent atomEvent in atomEvents)
                        {
                            AtomCabCollection atomCabs = atomFeed.GetCabs(atomEvent);

                            foreach (AtomCab atomCab in atomCabs)
                            {
                                Assert.AreEqual(true, atomCab.Cab.DateCreatedLocal < DateTime.Now);

                                String tempFolder = Path.GetTempPath();

                                String fileName = atomFeed.DownloadCab(atomCab, true, tempFolder);

                                try
                                {
                                    Assert.AreEqual(true, File.Exists(fileName));
                                    FileInfo fileInfo = new FileInfo(fileName);

                                    Assert.AreEqual(atomCab.Cab.SizeInBytes, fileInfo.Length);
                                }
                                finally
                                {
                                    if (File.Exists(fileName))
                                    {
                                        File.Delete(fileName);
                                    }
                                }

                                foundCab = true;
                            }

                            if (foundCab)
                            {
                                return;
                            }
                        }
                    }
                }

                Assert.AreEqual(true, false); // Should get here.
            }
            finally
            {
                try { atomFeed.LogOut(); }
                catch { }
            }
        }