Example #1
0
        public void XMLTemplateParesrCreatePaymentProfile()
        {
            //Arrange
            XMLTemplateParser xMLTemplateParser            = new XMLTemplateParser();
            string            createPaymentProfileFileName = TestResources.GetTestResourcesFile(@"AutoPilot\XMLTemplates\bankCode.xml");

            //Act
            ObservableList <ApplicationAPIModel> createPaymentProfileModels = new ObservableList <ApplicationAPIModel>();

            xMLTemplateParser.ParseDocument(createPaymentProfileFileName, createPaymentProfileModels);
            TemplateFile TempleteFile = new TemplateFile()
            {
                FilePath = createPaymentProfileFileName
            };

            createPaymentProfileModels[0].OptionalValuesTemplates.Add(TempleteFile);
            Dictionary <Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >();
            ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters();

            ImportOptionalValues.ShowMessage = false;
            ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(createPaymentProfileModels[0], OptionalValuesPerParameterDict);
            ImportOptionalValues.PopulateOptionalValuesForAPIParameters(createPaymentProfileModels[0], OptionalValuesPerParameterDict);

            //Assert
            Assert.AreEqual(createPaymentProfileModels.Count, 1, "APIModels count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters.Count, 1, "AppModelParameters count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].PlaceHolder, "{BLZ}", "PlaceHolder name check");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList.Count, 1, "AppModelParameters count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList[0].Value, "46451012", "OptionalValue check");
        }
Example #2
0
        private void ExportAPIFiles(ObservableList <ApplicationAPIModel> SelectedAAMList)
        {
            foreach (ApplicationAPIModel AAM in SelectedAAMList)
            {
                Dictionary <System.Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >();

                ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters();
                ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(AAM, OptionalValuesPerParameterDict);
                ImportOptionalValues.PopulateOptionalValuesForAPIParameters(AAM, OptionalValuesPerParameterDict);

                AAM.ContainingFolder = APIModelFolder.FolderFullPath;
                if (TargetApplicationKey != null)
                {
                    AAM.TargetApplicationKey = TargetApplicationKey;
                }
                if (TagsKeys != null)
                {
                    foreach (RepositoryItemKey tagKey in TagsKeys)
                    {
                        AAM.TagsKeys.Add(tagKey);
                    }
                }
                APIModelFolder.AddRepositoryItem(AAM);
            }
        }
Example #3
0
        public void JSONTemplateCreateBillingArrangement()
        {
            //Arrange
            JSONTemplateParser jSONTemplateParser = new JSONTemplateParser();
            string             createBillingArrangementFileName = TestResources.GetTestResourcesFile(@"AutoPilot\JSONTemplates\login.json");

            //Act
            ObservableList <ApplicationAPIModel> createPaymentProfileModels = new ObservableList <ApplicationAPIModel>();

            jSONTemplateParser.ParseDocument(createBillingArrangementFileName, createPaymentProfileModels);
            TemplateFile TempleteFile = new TemplateFile()
            {
                FilePath = createBillingArrangementFileName
            };

            createPaymentProfileModels[0].OptionalValuesTemplates.Add(TempleteFile);
            Dictionary <Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >();
            ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters();

            ImportOptionalValues.ShowMessage = false;
            ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(createPaymentProfileModels[0], OptionalValuesPerParameterDict);
            ImportOptionalValues.PopulateOptionalValuesForAPIParameters(createPaymentProfileModels[0], OptionalValuesPerParameterDict);

            //Assert
            Assert.AreEqual(createPaymentProfileModels.Count, 1, "APIModels count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters.Count, 2, "AppModelParameters count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].PlaceHolder, "<USER>", "PlaceHolder name check");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[1].PlaceHolder, "<PASSWORD>", "PlaceHolder name check");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList.Count, 1, "AppModelParameters count");
            Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList[0].Value, "restOwner", "OptionalValue check");
        }
        private void ImportAPIModels(ObservableList <ApplicationAPIModel> SelectedAAMList)
        {
            foreach (ApplicationAPIModel apiModel in SelectedAAMList)
            {
                Dictionary <System.Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >();

                ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters();
                ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(apiModel, OptionalValuesPerParameterDict);
                ImportOptionalValues.PopulateOptionalValuesForAPIParameters(apiModel, OptionalValuesPerParameterDict);

                if (string.IsNullOrEmpty(apiModel.ContainingFolder))
                {
                    apiModel.ContainingFolder = APIModelFolder.FolderFullPath;
                }

                if (apiModel.TargetApplicationKey == null && TargetApplicationKey != null)
                {
                    apiModel.TargetApplicationKey = TargetApplicationKey;
                }

                if (apiModel.TagsKeys != null && TagsKeys != null)
                {
                    foreach (RepositoryItemKey tagKey in TagsKeys)
                    {
                        apiModel.TagsKeys.Add(tagKey);
                    }
                }

                if (APIModelFolder.FolderFullPath == apiModel.ContainingFolder)
                {
                    APIModelFolder.AddRepositoryItem(apiModel);
                }
                else
                {
                    RepositoryFolderBase rfFolderBase = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(apiModel.ContainingFolder);
                    rfFolderBase.AddRepositoryItem(apiModel);
                }
            }
        }