Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        new public void Start()
        {
            getPreferences();
            long testStart = DateTime.Now.Ticks;
            long tStart    = DateTime.Now.Ticks;

            HomeDocument home = client.Get <HomeDocument>(RestHomeUri, null);

            if (home == null)
            {
                WriteOutput("\nUnable to get Rest Service at: " + RestHomeUri + " check to see if the service is available.");
                return;
            }
            WriteOutput("Took " + ((DateTime.Now.Ticks - testStart) / TimeSpan.TicksPerMillisecond) + "ms to get RestService");
            //Feed<Repository> repositories = home.GetRepositories<Repository>(new FeedGetOptions { Inline = true, Links = true });
            //Repository CurrentRepository = repositories.GetRepository(repositoryName);
            CurrentRepository = home.GetRepository <D2Repository>(repositoryName);
            ProductInfo productInfo = home.GetProductInfo();

            if (CurrentRepository == null)
            {
                throw new Exception("Unable to login to the CurrentRepository, please see server logs for more details.");
            }
            // Set our default folder and document types.
            CurrentRepository.DocumentType = "dm_document";
            CurrentRepository.FolderType   = "dm_folder";
            NameValueCollection restTests = ConfigurationManager.GetSection("resttests") as NameValueCollection;

            if (!(Boolean.Parse(restTests["CreateTempDocs"].ToString()) || Boolean.Parse(restTests["CreateTempDocs"].ToString())))
            {
                throw new System.Exception("One of the tests that create Documents is required for other tests to run. "
                                           + "You must enable either the CreateTempDocs test and/or the CreateTempDocs test in order to create "
                                           + "documents that can be used in subsequent tests.");
            }

            C2ViewDocument(@"C:\SamplesToImport", "09000001800d180f", true);

            //todo: return or not
            // return;

            MoveDocs = new List <DocumentTracker>();
            foreach (String key in restTests)
            {
                bool preCheckOk = true;
                // This test is not available in versions earlier than 7.2
                double restVersion = Double.Parse((productInfo.Properties.Major.Equals("NA") ? "7.2" : productInfo.Properties.Major));

                if (key.Equals("Search"))
                {
                    if (!(restVersion >= 7.2d))
                    {
                        preCheckOk = false;
                        Console.WriteLine("Documentum Rest Version 7.2 or higher is required to use Search, your version is: "
                                          + restVersion + " Skipping...");
                    }
                }

                // These features do not work on Mono yet, should be fine when .NetCore is released though
                if (key.Equals("ExportParent") || key.Equals("ExportListOfFiles"))
                {
                    if (Type.GetType("Mono.Runtime") != null)
                    {
                        preCheckOk = false;
                        Console.WriteLine("The zip libraries required for [" + key + " ] have failed under Mono, skipping this  test. If you "
                                          + "want to test for yourself, you will have to modify the source to allow it udner (UseCaseTests");
                    }
                }

                if (preCheckOk)
                {
                    if (Boolean.Parse(restTests[key].ToString()))
                    {
                        runTestByName(key);
                    }
                }
            }

            WriteOutput("#####################################");
            WriteOutput("COMPLETED TESTS IN: " + ((DateTime.Now.Ticks - testStart) / TimeSpan.TicksPerMillisecond) / 1000 / 60 + "minutes");
            WriteOutput("#####################################");
            System.Diagnostics.Process.Start(testDirectory);

            if (loggerForm != null)
            {
                while (loggerForm.Visible)
                {
                    Application.DoEvents();
                }
            }
        }