Esempio n. 1
0
        public static void ClassInitialize(TestContext TC)
        {
            TempRepositoryFolder = TestResources.GetTestTempFolder(@"Solutions" + Path.DirectorySeparatorChar + "SRTestTempLongPath");

            int i = 1;

            while (TempRepositoryFolder.Length < 300)
            {
                TempRepositoryFolder = Path.Combine(TempRepositoryFolder, "LongSubFolderName_" + i);
                Directory.CreateDirectory(PathHelper.GetLongPath(TempRepositoryFolder));
                i++;
            }


            CreateTestSolution();

            mRepositorySerializer = new NewRepositorySerializer();
            // Init SR
            mSolutionRepository = new SolutionRepository();
            mSolutionRepository.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                                               rootFolder: @"~\MyRepositoryItems",
                                                               containRepositoryItems: true,
                                                               displayName: "My Repository Item",
                                                               PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                                               );


            NewRepositorySerializer.AddClassesFromAssembly(typeof(MyRepositoryItem).Assembly);



            mSolutionRepository.Open(TempRepositoryFolder);
        }
Esempio n. 2
0
        public static void ClassInitialize(TestContext TestContext)
        {
            mTestHelper.ClassInitialize(TestContext);

            TempRepositoryFolder = TestResources.GetTestTempFolder("Solutions", "SRTestTemp");
            Console.WriteLine("SolutionRepositoryTest folder: " + TempRepositoryFolder);

            Console.WriteLine("===> Creating test solution");
            CreateTestSolution();
            Console.WriteLine("===> test solution created");

            mRepositorySerializer = new NewRepositorySerializer();
            // Init SR
            mSolutionRepository = new SolutionRepository();
            mSolutionRepository.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                                               rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                                               containRepositoryItems: true,
                                                               displayName: "My Repository Item",
                                                               PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                                               );

            NewRepositorySerializer RS = new NewRepositorySerializer();

            NewRepositorySerializer.AddClassesFromAssembly(typeof(MyRepositoryItem).Assembly);
            mSolutionRepository.Open(TempRepositoryFolder);
        }
        public static void ClassInitialize(TestContext TestContext)
        {
            DummyWorkSpace ws = new DummyWorkSpace();

            WorkSpace.Init(ws);

            string folder = TestResources.GetTestTempFolder("Solutions", "PluginTest");

            if (Directory.Exists(folder))
            {
                Directory.Delete(folder, true);
            }

            SR = new SolutionRepository();
            SR.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", PropertyNameForFileName: nameof(PluginPackage.PluginId));
            SR.CreateRepository(folder);
            SR.Open(folder);
            WorkSpace.Instance.SolutionRepository = SR;
            string pluginFolder = TestResources.GetTestResourcesFolder(@"PluginPackages\GingerOfficePlugin");


            //string txt = WorkSpace.Instance.PlugInsManager.CreatePluginPackageInfo("GingerOfficePlugin", "1.0.0");
            //System.IO.File.WriteAllText(pluginFolder + @"\Ginger.PluginPackage.json", txt);


            WorkSpace.Instance.PlugInsManager.AddPluginPackage(pluginFolder);
        }
Esempio n. 4
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            //string TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp");
            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            SR.AddItemInfo <MyRepositoryItem>("*.Ginger.MyRepositoryItem.xml", @"~\MyRepositoryItems", true, "My Repository Item", PropertyNameForFileName: nameof(MyRepositoryItem.Name));


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }
Esempio n. 5
0
        public static void ClassInitialize(TestContext TC)
        {
            string TempSolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\APIModelsTest");

            if (Directory.Exists(TempSolutionFolder))
            {
                Directory.Delete(TempSolutionFolder, true);
            }
            SR = new SolutionRepository();

            SR.AddItemInfo <ApplicationAPIModel>("*.Ginger.ApplicationAPIModel.xml", @"~\Applications Models\API Models", true, "API Models", PropertyNameForFileName: nameof(ApplicationAPIModel.Name));
            // SR.AddItemInfo<GlobalAppModelParameter>("*.Ginger.GlobalAppModelParameter.xml", @"~\Applications Models\Global Models Parameters", true, "Global Model Parameters", addToRootFolders: true, PropertyNameForFileName: nameof(GlobalAppModelParameter.PlaceHolder));

            SR.CreateRepository(TempSolutionFolder);

            NewRepositorySerializer RS = new NewRepositorySerializer();

            NewRepositorySerializer.AddClassesFromAssembly(typeof(ApplicationAPIModel).Assembly);
            SR.Open(TempSolutionFolder);
        }
Esempio n. 6
0
        public void InstalledPluginPackageFromOnline()
        {
            //Arrange

            // TODO: create a simple plugin for unit test which will download faster.

            string PluginId      = "PACT";
            string PluginVersion = "1.6";
            string path          = TestResources.GetTestTempFolder(@"Solutions\PluginsManagerSR1");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            SolutionRepository solutionRepository = new SolutionRepository();

            solutionRepository.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", PropertyNameForFileName: nameof(PluginPackage.PluginId));
            solutionRepository.CreateRepository(path);
            solutionRepository.Open(path);

            PluginsManager pluginsManager = new PluginsManager(solutionRepository);
            ObservableList <PluginPackage> pluginPackages = solutionRepository.GetAllRepositoryItems <PluginPackage>();

            // Act
            var p = pluginsManager.GetOnlinePluginsIndex();
            OnlinePluginPackage onlinePluginPackage = (from x in p where x.Id == PluginId select x).SingleOrDefault();

            //OnlinePluginPackageRelease onlinePluginPackageRelease
            pluginsManager.InstallPluginPackage(onlinePluginPackage, onlinePluginPackage.Releases[0]);
            //string folder = Path.Combine(Common.GetTestResourcesFolder(), @"PluginPackages\SeleniumPluginPackage.1.0.0");


            //Assert
            Assert.AreEqual(1, pluginPackages.Count);
            Assert.AreEqual("PACT", pluginPackages[0].PluginId);
        }
        public static SolutionRepository CreateGingerSolutionRepository()
        {
            SolutionRepository SR = new SolutionRepository();


            // TODO: replace ~\ with ~ env.seperator !!!!!!!!!!
            SR.AddItemInfo <BusinessFlow>("*.Ginger.BusinessFlow.xml", @"~\BusinessFlows", true, GingerDicser.GetTermResValue(eTermResKey.BusinessFlows), PropertyNameForFileName: nameof(BusinessFlow.Name));

            SR.AddItemInfo <ApplicationAPIModel>("*.Ginger.ApplicationAPIModel.xml", @"~\Applications Models\API Models", true, "API Models", PropertyNameForFileName: nameof(ApplicationAPIModel.Name));
            SR.AddItemInfo <GlobalAppModelParameter>("*.Ginger.GlobalAppModelParameter.xml", @"~\Applications Models\Global Models Parameters", true, "Global Model Parameters", PropertyNameForFileName: nameof(GlobalAppModelParameter.PlaceHolder));
            SR.AddItemInfo <ApplicationPOMModel>("*.Ginger.ApplicationPOMModel.xml", @"~\Applications Models\POM Models", true, "POM Models", PropertyNameForFileName: nameof(ApplicationPOMModel.Name));

            SR.AddItemInfo <ProjEnvironment>("*.Ginger.Environment.xml", @"~\Environments", true, "Environments", PropertyNameForFileName: nameof(ProjEnvironment.Name));
            SR.AddItemInfo <ALMDefectProfile>("*.Ginger.ALMDefectProfile.xml", @"~\ALMDefectProfiles", true, "ALM Defect Profiles", PropertyNameForFileName: nameof(ALMDefectProfile.Name));

            SR.AddItemInfo <Agent>("*.Ginger.Agent.xml", @"~\Agents", true, "Agents", PropertyNameForFileName: nameof(Agent.Name));

            SR.AddItemInfo <HTMLReportConfiguration>("*.Ginger.HTMLReportConfiguration.xml", @"~\HTMLReportConfigurations", true, "HTMLReportConfigurations", PropertyNameForFileName: nameof(HTMLReportsConfiguration.Name));
            //SR.AddItemInfo<HTMLReportTemplate>("*.Ginger.HTMLReportTemplate.xml", @"~\HTMLReportConfigurations\HTMLReportTemplate", true, "HTMLReportTemplate", PropertyNameForFileName: nameof(HTMLReportTemplate.Name));
            //SR.AddItemInfo<ReportTemplate>("*.Ginger.ReportTemplate.xml", @"~\HTMLReportConfigurations\ReportTemplates", true, "ReportTemplates", PropertyNameForFileName: nameof(ReportTemplate.Name));

            SR.AddItemInfo <DataSourceBase>("*.Ginger.DataSource.xml", @"~\DataSources", true, "Data Sources", PropertyNameForFileName: nameof(DataSourceBase.Name));

            SR.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", PropertyNameForFileName: nameof(PluginPackage.PluginId));

            SR.AddItemInfo <ActivitiesGroup>("*.Ginger.ActivitiesGroup.xml", @"~\SharedRepository\ActivitiesGroup", true, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups, "Shared "), PropertyNameForFileName: nameof(ActivitiesGroup.Name));
            SR.AddItemInfo <Activity>("*.Ginger.Activity.xml", @"~\SharedRepository\Activities", true, GingerDicser.GetTermResValue(eTermResKey.Activities, "Shared "), PropertyNameForFileName: nameof(Activity.ActivityName));
            SR.AddItemInfo <Act>("*.Ginger.Action.xml", @"~\SharedRepository\Actions", true, "Shared Actions", PropertyNameForFileName: nameof(Act.Description));
            SR.AddItemInfo <VariableBase>("*.Ginger.Variable.xml", @"~\SharedRepository\Variables", true, GingerDicser.GetTermResValue(eTermResKey.Variables, "Shared "), PropertyNameForFileName: nameof(VariableBase.Name));

            SR.AddItemInfo <RunSetConfig>("*.Ginger.RunSetConfig.xml", @"~\RunSetConfigs", true, GingerDicser.GetTermResValue(eTermResKey.RunSets), PropertyNameForFileName: nameof(RunSetConfig.Name));

            return(SR);
        }
Esempio n. 8
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            SR.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                              rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                              containRepositoryItems: true,
                                              displayName: "My Repository Item",
                                              PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                              );


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            RepositoryFolder <MyRepositoryItem> bigFolder = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("BigfolderWith100Items");


            // Add another 100 big item so it will take time loading and we can check multi thread access while load in progress
            for (int i = 0; i < 100; i++)
            {
                MyRepositoryItem bigItem = new MyRepositoryItem("Big Item #" + i);
                bigItem.BigStringHolderSlowSet = new string('a', 150000);
                bigFolder.AddRepositoryItem(bigItem);
            }

            //TODO: add more sample items for testing
            SR.Close();
        }
Esempio n. 9
0
        private void OpenSolution()
        {
            InitClassTypesDictionary();

            Console.WriteLine("Solution Folder?");
            string sFolder = Console.ReadLine();

            if (Directory.Exists(sFolder))
            {
                Console.WriteLine("Opening Solution at folder: " + sFolder);

                SR = new SolutionRepository();
                SR.AddItemInfo <BusinessFlow>("*.Ginger.BusinessFlow.xml", @"~\BusinessFlows", true, GingerDicser.GetTermResValue(eTermResKey.BusinessFlows), PropertyNameForFileName: nameof(BusinessFlow.Name));

                SR.AddItemInfo <ApplicationAPIModel>("*.Ginger.ApplicationAPIModel.xml", @"~\Applications Models\API Models", true, "API Models", PropertyNameForFileName: nameof(ApplicationAPIModel.Name));
                SR.AddItemInfo <GlobalAppModelParameter>("*.Ginger.GlobalAppModelParameter.xml", @"~\Applications Models\Global Models Parameters", true, "Global Model Parameters", PropertyNameForFileName: nameof(GlobalAppModelParameter.PlaceHolder));
                SR.AddItemInfo <ApplicationPOMModel>("*.Ginger.ApplicationPOMModel.xml", @"~\Applications Models\POM Models", true, "POM Models", PropertyNameForFileName: nameof(ApplicationPOMModel.Name));

                SR.AddItemInfo <ProjEnvironment>("*.Ginger.Environment.xml", @"~\Environments", true, "Environments", PropertyNameForFileName: nameof(ProjEnvironment.Name));
                SR.AddItemInfo <ALMDefectProfile>("*.Ginger.ALMDefectProfile.xml", @"~\ALMDefectProfiles", true, "ALM Defect Profiles", PropertyNameForFileName: nameof(ALMDefectProfile.Name));

                // SR.AddItemInfo<Agent>("*.Ginger.Agent.xml", @"~\Agents", true, "Agents", PropertyNameForFileName: nameof(Agent.Name));

                //TODO: check if below 2 reports folders are realy needed
                SR.AddItemInfo <HTMLReportConfiguration>("*.Ginger.HTMLReportConfiguration.xml", @"~\HTMLReportConfigurations", true, "HTMLReportConfigurations", PropertyNameForFileName: nameof(HTMLReportsConfiguration.Name));
                SR.AddItemInfo <HTMLReportTemplate>("*.Ginger.HTMLReportTemplate.xml", @"~\HTMLReportConfigurations\HTMLReportTemplate", true, "HTMLReportTemplate", PropertyNameForFileName: nameof(HTMLReportTemplate.Name));

                // SR.AddItemInfo<ReportTemplate>("*.Ginger.ReportTemplate.xml", @"~\HTMLReportConfigurations\ReportTemplates", true, "ReportTemplates", PropertyNameForFileName: nameof(ReportTemplate.Name));

                SR.AddItemInfo <DataSourceBase>("*.Ginger.DataSource.xml", @"~\DataSources", true, "Data Sources", PropertyNameForFileName: nameof(DataSourceBase.Name));

                SR.AddItemInfo <PluginPackage>("*.Ginger.PluginPackage.xml", @"~\Plugins", true, "Plugins", PropertyNameForFileName: nameof(PluginPackage.PluginId));

                SR.AddItemInfo <ActivitiesGroup>("*.Ginger.ActivitiesGroup.xml", @"~\SharedRepository\ActivitiesGroup", true, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups, "Shared "), PropertyNameForFileName: nameof(ActivitiesGroup.Name));
                SR.AddItemInfo <Activity>("*.Ginger.Activity.xml", @"~\SharedRepository\Activities", true, GingerDicser.GetTermResValue(eTermResKey.Activities, "Shared "), PropertyNameForFileName: nameof(Activity.ActivityName));
                SR.AddItemInfo <Act>("*.Ginger.Action.xml", @"~\SharedRepository\Actions", true, "Shared Actions", PropertyNameForFileName: nameof(Act.Description));
                SR.AddItemInfo <VariableBase>("*.Ginger.Variable.xml", @"~\SharedRepository\Variables", true, GingerDicser.GetTermResValue(eTermResKey.Variables, "Shared "), PropertyNameForFileName: nameof(VariableBase.Name));

                SR.AddItemInfo <RunSetConfig>("*.Ginger.RunSetConfig.xml", @"~\RunSetConfigs", true, GingerDicser.GetTermResValue(eTermResKey.RunSets), PropertyNameForFileName: nameof(RunSetConfig.Name));

                WorkSpace.Instance.SolutionRepository = SR;
                SR.Open(sFolder);
                IEnumerable <RepositoryFile> files = SR.GetAllSolutionRepositoryFiles().ToList();
                Console.WriteLine("Files count = " + files.Count());

                Console.WriteLine("Ginger Menu - Solution: " + sFolder);

                OpenSolutionMenuItem.Active       = false;
                CloseSolutionMenuItem.Active      = true;
                BusinessFlowsCountMenuItem.Active = true;
                BusinessFlowsListMenuItem.Active  = true;
                EnvironmentsListMenuItem.Active   = true;
                RunBusinessFlowMenuItem.Active    = true;
            }
            else
            {
                Console.WriteLine("Directory not found: " + sFolder);
            }
        }
Esempio n. 10
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            //SR.AddItemInfo<MyRepositoryItem>("*.Ginger.MyRepositoryItem.xml", @"~\MyRepositoryItems", true, "My Repository Item", addToRootFolders: true, PropertyNameForFileName: nameof(MyRepositoryItem.Name));
            SR.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                              rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                              containRepositoryItems: true,
                                              displayName: "My Repository Item",
                                              PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                              );


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }