Ejemplo n.º 1
0
 private static void Init(CloneModel model, DataSource ds)
 {
     model.ColumnList.Add <_Int32>();
     model.ColumnList.Add <_Int32>();
     model.EnsureInitialized(false);
     model.SetDataSource(ds);
 }
Ejemplo n.º 2
0
        public async Task Clonar(CloneModel clonar)
        {
            var configs = await _configurationRepository
                          .GetConfigurationsAsync(clonar.ServiceId,
                                                  clonar.Environment,
                                                  clonar.ServiceVersion);

            foreach (var config in configs)
            {
                //Busca si ya existe la version nueva del servicio
                var configAux = await _configurationRepository
                                .GetConfigurationAsync(clonar.NewServiceId,
                                                       clonar.NewEnvironment,
                                                       clonar.NewVersion,
                                                       config.Section,
                                                       config.Key);

                if (configAux == null)
                {
                    config.ServiceId      = clonar.NewServiceId;
                    config.ServiceVersion = clonar.NewVersion;
                    config.Environment    = clonar.NewEnvironment;

                    await _configurationRepository
                    .AddConfigurationAsync(config);
                }
            }
        }
Ejemplo n.º 3
0
    //Clone ConstraintOnModel

    //Clone Tag
    public static Tag cloneTag(Tag tag)
    {
        // Tag tagCloned = new Tag();
        Tag tagCloned = (Tag)CloneModel.cloneString(tag);

        return(tagCloned);
    }
        public async Task <ActionResult> Clone_Post(CloneModel model)
        {
            if (!model.SourceProjectGuid.HasValue)
            {
                return(Redirect("/Home"));
            }

            if (!string.IsNullOrWhiteSpace(model.TargetFolderPath))
            {
                foreach (var id in GetFormDefinitionIdList(Request.Form, "definitionName"))
                {
                    await ReleaseDefinitionsService.CloneDefinition(model.SourceProjectGuid.GetValueOrDefault(), id,
                                                                    model.TargetProjectGuid.GetValueOrDefault(), model.TargetFolderPath, Request.Form[$"definitionName_{id}"]);
                }

                var projectName = await ProjectService.GetProjectNameAsync(model.TargetProjectGuid.GetValueOrDefault());

                return(Redirect($"/ReleaseDefinitions?ProjectGuid={model.TargetProjectGuid}&ProjectName={projectName}"));
            }

            model.Definitions = (await ReleaseDefinitionsService.GetDefinitionsAsync(model.ProjectGuid.GetValueOrDefault()))
                                .Where(g => model.DefinitionIds.Contains(g.Id));

            model.Projects = await GetProjectsSelectListItems(Guid.Empty);

            if (model.TargetProjectGuid.HasValue)
            {
                model.Folders = await GetFoldersSelectListItems(model.TargetProjectGuid.GetValueOrDefault());
            }

            return(View(model));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Clone([FromBody] CloneModel model)
        {
            _logger.Info("Requesting clone page with {@model}", model);
            await _pageRepository.CloneAsync(model.CloneId, model.CloneName);

            return(Ok());
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Clone([FromBody] CloneModel model)
        {
            _logger.Info("Requesting clone app with {@model}", model);
            var newId = await _appRepository.CloneAsync(model.CloneId, model.CloneName);

            await _localizationRepository.CloneLocalization(model.CloneId, newId);

            return(Ok());
        }
Ejemplo n.º 7
0
        private static void Verify(CloneModel x)
        {
            Assert.AreEqual(x, x.PrimaryKey.ParentModel);
            Assert.AreEqual(x, x.ParentKey.ParentModel);

            foreach (var column in x.Columns)
            {
                Assert.AreEqual(x, column.ParentModel);
            }
        }
Ejemplo n.º 8
0
        public async Task <ActionResult> Clone(CloneModel model)
        {
            if (!model.ProjectGuid.HasValue)
            {
                return(Redirect("/Home"));
            }

            model.Groups = (await TaskGroupService.GetTaskGroupsAsync(model.ProjectGuid.GetValueOrDefault()))
                           .Where(g => model.GroupIds.Contains(g.Id));

            model.Projects = await GetProjectsSelectListItems(Guid.Empty);

            return(View(model));
        }
Ejemplo n.º 9
0
        public void Model_Clone()
        {
            var model1 = new CloneModel();
            var mock   = new Mock <DataSource>();

            mock.Setup(x => x.Model).Returns(model1);
            DataSource ds1 = mock.Object;

            Init(model1, ds1);

            var clone1 = model1.MakeCopy(true);

            Verify(clone1);
            Verify(model1, clone1);
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> Clone_Post(CloneModel model)
        {
            if (!model.SourceProjectGuid.HasValue)
            {
                return(Redirect("/Home"));
            }

            foreach (var id in GetFormGroupIdList(Request.Form, "groupName"))
            {
                await TaskGroupService.CloneGroup(model.SourceProjectGuid.GetValueOrDefault(), id,
                                                  model.TargetProjectGuid.GetValueOrDefault(), Request.Form[$"groupName_{id}"]);
            }

            var projectName = await ProjectService.GetProjectNameAsync(model.TargetProjectGuid.GetValueOrDefault());

            return(Redirect($"/TaskGroups?ProjectGuid={model.TargetProjectGuid}&ProjectName={projectName}"));
        }
        public async Task <IActionResult> Clone([FromBody] CloneModel clonar)
        {
            _logger.LogInformation("Clone {@Modelo}", clonar);

            await _configurationService.Clonar(clonar);

            var configs = await _configurationService.GetConfigurationService(clonar.ServiceId,
                                                                              clonar.NewEnvironment,
                                                                              clonar.NewVersion);

            if (configs == null)
            {
                _logger.LogInformation("Clonar NotFound");

                return(NotFound());
            }

            _logger.LogInformation("Clonar {@ClonarModelo}.", clonar);

            return(Ok(configs));
        }
Ejemplo n.º 12
0
        public void Clone_Deep_PrivateMember()
        {
            // Arrange
            CloneModel original = new CloneModel(DateTime.UtcNow)
            {
                Id          = Guid.NewGuid(),
                Description = "Some random description",
                IntValue    = 99,
                FltValue    = 3.1415926f,
                Lines       = new List <string>()
                {
                    "Alpha", "Beta", "Gamma"
                }
            };

            // Act
            CloneModel cloned = original.Clone(true);

            // Assert
            Assert.Equal(original.SomeTimeAgo, cloned.SomeTimeAgo);
        }
        public async Task <ActionResult> Clone(CloneModel model)
        {
            if (!model.ProjectGuid.HasValue)
            {
                return(Redirect("/Home"));
            }

            model.Definitions = (await ReleaseDefinitionsService.GetDefinitionsAsync(model.ProjectGuid.GetValueOrDefault()))
                                .Where(g => model.DefinitionIds.Contains(g.Id));

            model.Projects = await GetProjectsSelectListItems(Guid.Empty);

            model.Folders = new List <SelectListItem>
            {
                new SelectListItem
                {
                    Value = "",
                    Text  = "(select)"
                }
            };

            return(View(model));
        }
Ejemplo n.º 14
0
        public void Clone_Class_ChangeValue_NotSame()
        {
            // Arrange
            CloneModel original = new CloneModel()
            {
                Id          = Guid.NewGuid(),
                Description = "Some random description",
                IntValue    = 99,
                FltValue    = 3.1415926f,
                Lines       = new List <string>()
                {
                    "Alpha", "Beta", "Gamma"
                }
            };

            // Act
            CloneModel cloned = original.Clone();

            cloned.IntValue = 123;

            // Assert
            Assert.NotEqual(original.IntValue, cloned.IntValue);
        }
Ejemplo n.º 15
0
        private List <CloneModel> RunPythonScript(string doc1, string doc2)
        {
            var pythonCode = GetPythonScript(doc1, doc2);

            File.WriteAllLines(@"E:\MSSE Program\thesis dev\my.py", pythonCode);

            var processStartInfo = new ProcessStartInfo();

            processStartInfo.FileName               = @"C:\Anaconda2\python.exe";
            processStartInfo.Arguments              = "\"" + @"E:\MSSE Program\thesis dev\my.py" + "\"";
            processStartInfo.UseShellExecute        = false;
            processStartInfo.RedirectStandardOutput = true;
            var process = Process.Start(processStartInfo);
            var output  = process.StandardOutput;

            var cloneModels = new List <CloneModel>();

            while (!output.EndOfStream)
            {
                string[] splitted = output.ReadLine().Split(',');
                if (splitted.Length == 1)
                {
                    continue;
                }

                var cloneModel = new CloneModel
                {
                    Term1           = splitted[0],
                    Term2           = splitted[1],
                    SimilarityScore = Double.Parse(splitted[2])
                };
                cloneModels.Add(cloneModel);
            }

            return(cloneModels);
            //  Console.WriteLine(output.ReadToEnd());
        }
Ejemplo n.º 16
0
        public void Clone_Deep()
        {
            // Arrange
            CloneModel original = new CloneModel()
            {
                Id          = Guid.NewGuid(),
                Description = "Some random description",
                IntValue    = 99,
                FltValue    = 3.1415926f,
                Lines       = new List <string>()
                {
                    "Alpha", "Beta", "Gamma"
                }
            };

            // Act
            CloneModel cloned = original.Clone(true);

            // Assert
            Assert.Equal(original.Id, cloned.Id);
            Assert.Equal(original.Description, cloned.Description);
            Assert.Equal(original.IntValue, cloned.IntValue);
            Assert.Equal(original.FltValue, cloned.FltValue);
        }
Ejemplo n.º 17
0
 private static void Verify(CloneModel x, CloneModel y)
 {
     Assert.AreEqual(x.Columns.Count, y.Columns.Count);
     Assert.AreEqual(x.DataSource, y.DataSource);
 }
Ejemplo n.º 18
0
    //Clone StoreOptional

    //Clone Quantative

    //Clone Model/SubModel
    public static Model cloneModel(Model _model)
    {
        Model modelCloned = new Model(new OptionalDesc(), new List <Model>());

        //Clone OptionalDescription
        modelCloned.description = OptionalDesc.clonedDescription(_model.description);

        //Clone ConstraintOnModel


        //Clone Tag
        if (_model.description.tag != null)
        {
            modelCloned.description.tag = (Tag)CloneModel.cloneString(_model.description.tag);
        }

        //Clone Name
        if (_model.description.name != null)
        {
            modelCloned.description.name = CloneModel.cloneString(_model.description.name);
        }
        //CLone ... others

        //Clone receivedString
        if (_model.receivedString != null)
        {
            modelCloned.receivedString = CloneModel.cloneString(_model.receivedString);
        }
        //Clone returnedString;
        if (_model.returnString != null)
        {
            modelCloned.returnString = CloneModel.cloneString(_model.returnString);
        }
        //Clone subModel list
        if (_model.subModel == null)
        {
            return(modelCloned);
        }
        int subModelSize = _model.subModel.Count;

        if (subModelSize == 0)
        {
            modelCloned.subModel = new List <Model>();
        }
        else if (subModelSize > 0)
        {
            for (int i = 0; i < subModelSize; i++)
            {
                if (_model.subModel.ElementAt(i).GetType() == typeof(StringType))
                {
                    modelCloned.subModel.Add(CloneModel.cloneString((StringType)_model.subModel.ElementAt(i)));
                }
                else
                {
                    modelCloned.subModel.Add(CloneModel.cloneModel((Model)_model.subModel.ElementAt(i)));
                }
            }
        }

        return(modelCloned);
    }