public BuildStepViewerOptions(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;
        }
        public BuildStepRun(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;
        }
Beispiel #3
0
        public BuildStepFiles(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;

            Sync();
        }
Beispiel #4
0
 public void Add(BuildModel item)
 {
     SquadManager.DB.Connection.Current.AddBuild(item.Name
         , item.Link
         , item.NomCreateur
         , item.Class.ToString()
         , item.Role
         , item.Validate
         , item.Description);
 }
Beispiel #5
0
 public BuildModel ManifestFileToModel(string assetManifestPath)
 {
     try
     {
         return(BuildModel.Parse(XElement.Load(assetManifestPath)));
     }
     catch (Exception e)
     {
         _log.LogError($"Could not parse asset manifest file: {assetManifestPath}");
         _log.LogErrorFromException(e);
         return(null);
     }
 }
        public BuildStepTrackingOptions(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;

            TrackFlowCheckBox.AttachToolTip("Calls between functions are tracked so call graphs can work");

            TrackFieldsCheckBox.AttachToolTip("Set and get operations to class members are tracked");

            TrackInstancesCheckBox.AttachToolTip("Creation and deletion of classes are tracked, and class introspection is enabled");
        }
Beispiel #7
0
        public async Task <BuildModel> GetProjectBuilds(string ProjetcName)
        {
            BuildModel buildModel = new BuildModel();

            try
            {
                buildModel = await buildManager.GetProjectBuilds(ProjetcName);
            }
            catch (Exception)
            {
            }
            return(buildModel);
        }
        internal PublishArtifactsInManifestBase ConstructPublishingV3Task(BuildModel buildModel)
        {
            PublishedV3Manifest = true;

            return(new PublishArtifactsInManifestV3()
            {
                BuildEngine = this.BuildEngine,
                TargetChannels = this.TargetChannels,
                BuildModel = buildModel,
                BlobAssetsBasePath = this.BlobAssetsBasePath,
                PackageAssetsBasePath = this.PackageAssetsBasePath,
                BARBuildId = this.BARBuildId,
                MaestroApiEndpoint = this.MaestroApiEndpoint,
                BuildAssetRegistryToken = this.BuildAssetRegistryToken,
                MaxClients = this.MaxClients,
                NugetPath = this.NugetPath,
                InternalBuild = this.InternalBuild,
                SkipSafetyChecks = this.SkipSafetyChecks,
                AkaMSClientId = this.AkaMSClientId,
                AkaMSClientSecret = this.AkaMSClientSecret,
                AkaMSCreatedBy = this.AkaMSCreatedBy,
                AkaMSGroupOwner = this.AkaMSGroupOwner,
                AkaMsOwners = this.AkaMsOwners,
                AkaMSTenant = this.AkaMSTenant,
                PublishInstallersAndChecksums = this.PublishInstallersAndChecksums,
                AzureDevOpsFeedsKey = this.AzureDevOpsFeedsKey,
                InstallersFeedKey = this.InstallersFeedKey,
                CheckSumsFeedKey = this.ChecksumsFeedKey,
                InternalCheckSumsFeedKey = this.InternalCheckSumsFeedKey,
                InternalInstallersFeedKey = this.InternalInstallersFeedKey,
                AzureStorageTargetFeedKey = this.AzureStorageTargetFeedKey,
                PdbArtifactsBasePath = this.PdbArtifactsBasePath,
                SymWebToken = this.SymWebToken,
                MsdlToken = this.MsdlToken,
                SymbolPublishingExclusionsFile = this.SymbolPublishingExclusionsFile,
                PublishSpecialClrFiles = this.PublishSpecialClrFiles,
                BuildQuality = this.BuildQuality,
                AllowFeedOverrides = this.AllowFeedOverrides,
                InstallersFeedOverride = this.InstallersFeedOverride,
                ChecksumsFeedOverride = this.ChecksumsFeedOverride,
                ShippingFeedOverride = this.ShippingFeedOverride,
                TransportFeedOverride = this.TransportFeedOverride,
                SymbolsFeedOverride = this.SymbolsFeedOverride,
                ArtifactsBasePath = this.ArtifactsBasePath,
                AzdoApiToken = this.AzdoApiToken,
                BuildId = this.BuildId,
                AzureProject = this.AzureProject,
                AzureDevOpsOrg = this.AzureDevOpsOrg,
                UseStreamingPublishing = this.UseStreamingPublishing
            });
        }
Beispiel #9
0
        // GET: BuildModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BuildModel buildModel = db.Builds.Find(id);

            if (buildModel == null)
            {
                return(HttpNotFound());
            }
            return(View(buildModel));
        }
Beispiel #10
0
        /// <summary>
        /// 获取防御塔模型
        /// </summary>
        /// <returns></returns>
        public BuildModel GetBuildModel(int Id)
        {
            BuildModel model = null;

            if (team1BuildModel.TryGetValue(Id, out model))
            {
                return(model);
            }
            if (team2BuildModel.TryGetValue(Id, out model))
            {
                return(model);
            }
            return(null);
        }
 /// <summary>
 /// Copying symbol files to temporary location.
 /// </summary>
 /// <param name="buildModel"></param>
 /// <param name="symbolTemporaryLocation"></param>
 private void CopySymbolFilesToTemporaryLocation(BuildModel buildModel, string symbolTemporaryLocation)
 {
     foreach (var blobAsset in buildModel.Artifacts.Blobs)
     {
         if (GeneralUtils.IsSymbolPackage(blobAsset.Id))
         {
             var sourceFile      = Path.Combine(BlobAssetsBasePath, Path.GetFileName(blobAsset.Id));
             var destinationFile = Path.Combine(symbolTemporaryLocation, Path.GetFileName(blobAsset.Id));
             File.Copy(sourceFile, destinationFile);
             Log.LogMessage(MessageImportance.Low,
                            $"Successfully copied file {sourceFile} to {destinationFile}.");
         }
     }
 }
Beispiel #12
0
        public BuildStepTrackingOptions(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;


            TrackFlowCheckBox.AttachToolTip("Calls between functions are tracked so call graphs can work");

            TrackFieldsCheckBox.AttachToolTip("Set and get operations to class members are tracked");

            TrackInstancesCheckBox.AttachToolTip("Creation and deletion of classes are tracked, and class introspection is enabled");
        }
Beispiel #13
0
        public async Task DeleteBuild(int buildId)
        {
            await using (_context = new Sep3DBContext())
            {
                BuildModel buildModel = await _context.Builds
                                        .Include(b => b.BuildComponents)
                                        .Include(r => r.Ratings)
                                        .FirstAsync(build => build.Id == buildId);

                buildModel.BuildComponents = new Collection <BuildComponent>();
                _context.Builds.Remove(buildModel);
                await _context.SaveChangesAsync();
            }
        }
Beispiel #14
0
        public IBuild ConvertToBuild(BuildModel buildModel)
        {
            var changes = buildModel.LastChanges != null ? buildModel.LastChanges.Change : new List <Change>();

            var buildConfiguration = buildModel.BuildType ?? new BuildConfiguration {
                Id = buildModel.BuildTypeId
            };

            return(new Build(buildModel.Id, buildModel.Number,
                             ConvertBuildStatus(buildModel),
                             buildModel.StartDate, buildModel.FinishDate, buildModel.QueuedDate, buildConfiguration,
                             buildModel.Agent, changes, buildModel.WebUrl,
                             buildModel.Properties, buildModel.TestOccurrences, ConvertBuildState(buildModel)));
        }
Beispiel #15
0
        private static BuildState?ConvertBuildState(BuildModel buildModel)
        {
            if (buildModel.State == null)
            {
                return(null);
            }
            BuildState result;

            if (!Enum.TryParse(buildModel.State, true, out result))
            {
                return(null);
            }
            return(result);
        }
 /// <summary>
 /// Copying symbol files to temporary location.
 /// </summary>
 /// <param name="buildModel"></param>
 /// <param name="symbolTemporaryLocation"></param>
 private void CopySymbolFilesToTemporaryLocation(BuildModel buildModel, string symbolTemporaryLocation)
 {
     foreach (var blobAsset in buildModel.Artifacts.Blobs)
     {
         if (blobAsset.Id.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
         {
             var sourceFile      = Path.Combine(BlobAssetsBasePath, Path.GetFileName(blobAsset.Id));
             var destinationFile = Path.Combine(symbolTemporaryLocation, Path.GetFileName(blobAsset.Id));
             File.Copy(sourceFile, destinationFile);
             Log.LogMessage(MessageImportance.Low,
                            $"Successfully copied file {sourceFile} to {destinationFile}.");
         }
     }
 }
Beispiel #17
0
        public async Task <IActionResult> FetchDeploymentStatus(string org, string service, string buildId)
        {
            if (org == null || service == null || buildId == null)
            {
                return(BadRequest(new DeploymentStatus
                {
                    Success = false,
                    Message = "Org, service or buildId not supplied",
                }));
            }

            BuildModel buildModel = null;

            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                    using (HttpResponseMessage response = await client.GetAsync(string.Format("https://dev.azure.com/brreg/altinn-studio/_apis/build/builds/{0}?api-version=5.0-preview.4", buildId)))
                    {
                        response.EnsureSuccessStatusCode();
                        buildModel = await response.Content.ReadAsAsync <BuildModel>();

                        string responseBody = await response.Content.ReadAsStringAsync();
                    }
                }
            }
            catch (Exception ex)
            {
                return(StatusCode(500, new DeploymentStatus
                {
                    Success = false,
                    Message = "Deployment failed " + ex,
                }));
            }

            var deploymentSuccess = buildModel.Result != null && buildModel.Result.Equals("succeeded");

            return(Ok(new DeploymentStatus
            {
                Success = deploymentSuccess,
                Message = "Deployment status: " + buildModel.Status,
                StartTime = buildModel.StartTime,
                FinishTime = buildModel.FinishTime,
                BuildId = buildId,
                Status = buildModel.Status,
            }));
        }
Beispiel #18
0
        public ServerInstance(BuildModel build, IServerUpdater updater, IByondWrapper byond, IOptions <Config> config, ILogger <ServerInstance> logger)
        {
            string serverAddress = config.Value.Hub.Address;

            Build  = build;
            Status = new ServerStatusResult()
            {
                IsRunning = false, IsUpdating = false, Address = serverAddress, Id = build.Id
            };
            State   = new StoppedServerState(this);
            _byond  = byond;
            _logger = logger;
            _playersUpdatedTimestamp = DateTime.Now;
            _updater = updater;
        }
Beispiel #19
0
        public object Build(string projectname)
        {
            //Workitemlist123(projectname);
            Session.Remove("BuildCount");
            Org.ProjectName = projectname;
            BuildModel buildstorecount = logic.BuildDetailsCount(projectname);

            Session["BuildCount"] = buildstorecount.count;
            ViewBag.BuildCount    = buildstorecount.count;
            List <ValueBuild> buildstore = logic.BuildDetails(projectname);
            //string output = JsonConvert.SerializeObject(buildstore);
            string output = JsonConvert.SerializeObject(buildstorecount);

            return(output);
        }
        public override bool Execute()
        {
            // Leave out attributes if they would just have empty string values.
            if (ManifestBranch == string.Empty)
            {
                ManifestBranch = null;
            }
            if (ManifestCommit == string.Empty)
            {
                ManifestCommit = null;
            }

            var identity = new BuildIdentity
            {
                Name         = ManifestName,
                BuildId      = ManifestBuildId,
                Branch       = ManifestBranch,
                Commit       = ManifestCommit,
                IsStable     = IsStable,
                VersionStamp = VersionStamp
            };

            var orchestratedBuild = new OrchestratedBuildModel(identity)
            {
                Endpoints = new List <EndpointModel>
                {
                    EndpointModel.CreateOrchestratedBlobFeed(BlobFeedUrl)
                }
            };

            foreach (ITaskItem buildManifestFile in BuildManifestFiles)
            {
                string contents = System.IO.File.ReadAllText(buildManifestFile.ItemSpec);

                BuildModel build = BuildModel.Parse(XElement.Parse(contents));

                foreach (PackageArtifactModel package in build.Artifacts.Packages)
                {
                    package.OriginBuildName = build.Identity.Name;
                }

                orchestratedBuild.AddParticipantBuild(build);
            }

            System.IO.File.WriteAllText(File, orchestratedBuild.ToXml().ToString());

            return(!Log.HasLoggedErrors);
        }
        public BuildStepBuildOptions(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;

            ReplaceOriginalCheckBox.AttachToolTip(
            @"Unchecked: XRay copies and re-compiles the selected files then runs them side by side the originals.
               This case maintains the relative paths the original files had for configuration, etc...

            Checked: XRay overwrites the original files with XRayed versions, originals are put in a backup directory.
               Namespaces are kept the same so referencing assemblies should still work.");

            DecompileCSharpCheckBox.AttachToolTip("Recompile time takes signifigantly longer with this option");
        }
        public BuildStepBuildOptions(BuildFrame frame, BuildModel model)
        {
            InitializeComponent();

            Frame = frame;
            Model = model;

            ReplaceOriginalCheckBox.AttachToolTip(
                @"Unchecked: XRay copies and re-compiles the selected files then runs them side by side the originals.
           This case maintains the relative paths the original files had for configuration, etc...

Checked: XRay overwrites the original files with XRayed versions, originals are put in a backup directory.
           Namespaces are kept the same so referencing assemblies should still work.");

            DecompileCSharpCheckBox.AttachToolTip("Recompile time takes signifigantly longer with this option");
        }
Beispiel #23
0
        public void SetUp()
        {
            var build = new BuildModel {
                BuildTypeId = "test", FinishDate = _dateUnderTest
            };

            _buildAsSerializedStringContent = new StringContent(JsonConvert.SerializeObject(build, new TeamCityDateTimeConventer()));
            _jsonResponseWithOkStatus       = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = _buildAsSerializedStringContent
            };
            _jsonResponseWithErrorStatus = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = _buildAsSerializedStringContent
            };
        }
Beispiel #24
0
        private BuildModel GetBuildModel()
        {
            BuildModel expectedBuildModel = new BuildModel(
                new BuildIdentity
            {
                Attributes                  = manifestBuildData.ToDictionary(),
                Name                        = buildRepoName,
                BuildId                     = buildNumber,
                Branch                      = sourceBranch,
                Commit                      = commitSourceVersion,
                IsStable                    = false,
                PublishingVersion           = (PublishingInfraVersion)manifestBuildData.PublishingVersion,
                IsReleaseOnlyPackageVersion = bool.Parse(isReleasePackage)
            });

            return(expectedBuildModel);
        }
Beispiel #25
0
        public void ConvertToBuild()
        {
            var buildModelToBuildConverter = new BuildModelToBuildConverter();
            var buildModel = new BuildModel
            {
                Status    = "FAILURE",
                BuildType = new BuildConfiguration {
                    Id = "bt2"
                },
                BuildTypeId = "bt2"
            };
            var build = buildModelToBuildConverter.ConvertToBuild(buildModel);

            // Assert
            build.Status.Should().Be(BuildStatus.Failure);
            build.BuildConfiguration.Id.Should().Be("bt2");
        }
Beispiel #26
0
        public async Task CreateBuild(BuildModel buildModel)
        {
            await using (_context = new Sep3DBContext())
            {
                buildModel.Ratings = new List <RatingBuildModel>();
                await _context.Builds.AddAsync(buildModel);

                await _context.SaveChangesAsync();

                AccountModel accountModel = await _context.Accounts
                                            .Include(a => a.Builds)
                                            .FirstAsync(account => account.UserId == buildModel.AccountModelUserId);

                BuildModel databaseBuild = await _context.Builds.OrderBy(b => b.Id).LastAsync();

                if (accountModel.Builds == null)
                {
                    accountModel.Builds = new List <BuildModel>();
                }
                accountModel.Builds.Add(databaseBuild);
                _context.Update(accountModel);

                if (databaseBuild.BuildComponents == null)
                {
                    databaseBuild.BuildComponents = new List <BuildComponent>();
                }

                for (var i = 0; i < databaseBuild.ComponentList.Count; i++)
                {
                    ComponentModel arg = await _context.Components.FirstAsync(c => c.Id == databaseBuild.ComponentList[i].Id);

                    BuildComponent buildComponent = new BuildComponent
                    {
                        BuildId        = databaseBuild.Id,
                        BuildModel     = databaseBuild,
                        ComponentId    = arg.Id,
                        ComponentModel = arg
                    };
                    databaseBuild.BuildComponents.Add(buildComponent);
                }

                _context.Update(databaseBuild);
                await _context.SaveChangesAsync();
            }
        }
Beispiel #27
0
        public UpdateResult Update(BuildModel build, string branch, string commitHash)
        {
            try
            {
                var result = new UpdateResult()
                {
                    Id = build.Id
                };

                using (var repo = new Repository(build.Path))
                {
                    _git.Repo = repo;
                    _git.Fetch();
                    var checkoutBranch = _git.Checkout(branch);
                    _git.Pull();

                    if (!string.IsNullOrEmpty(commitHash))
                    {
                        _git.Reset(commitHash, checkoutBranch);
                    }

                    result.Branch        = branch;
                    result.CommitMessage = checkoutBranch.Tip.MessageShort;
                    result.CommitHash    = checkoutBranch.Tip.Sha;
                }

                string buildPath = Path.Combine(build.Path, $"{build.ExecutableName}.dme");
                result.Output = _byond.CompileWorld(buildPath);
                return(result);
            }
            catch (UpdateException ex)
            {
                _logger.LogError(ex, "Error while updating.");
                return(new UpdateResult {
                    Error = true, ErrorMessage = ex.Message
                });
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Failed to update.");
                return(new UpdateResult {
                    Error = true, ErrorMessage = ex.Message
                });
            }
        }
 private static Action <TBuilderArg> BuildAction <TBuilderArg>(
     ModelBuilder modelBuilder,
     IMutableEntityType entityType,
     BuildModel <TBuilderArg> build
     )
 {
     if (!entityType.IsOwned())
     {
         return((TBuilderArg arg) => build(modelBuilder.Entity(entityType.ClrType), null, arg));
     }
     else
     {
         return((TBuilderArg arg) =>
         {
             modelBuilder.BuildForOwnedType(entityType, builder => build(null, builder, arg));
         });
     }
 }
Beispiel #29
0
        public async Task <ActionResult> AddEdit(BuildViewModel model)
        {
            bool response = false;
            var  apiModel = new BuildModel {
                Name = model.Name, ChangeSet = model.ChangeSet, Release = model.Release, ProjectId = model.ProjectId, ProjectName = model.ProjectName
            };

            #region Upload Files

            string directoryName = string.Format("{0}-{1}-{2}", model.ProjectName, model.Release, model.ChangeSet);
            foreach (var package in model.Packages)
            {
                var file = uploader.Upload(package, directoryName, Path.GetFileName(package.FileName));
                apiModel.Packages.Add(new PackageModel {
                    Name = file.Name, Path = file.Location
                });
            }

            foreach (var script in model.Scripts)
            {
                var file = uploader.Upload(script, directoryName, Path.GetFileName(script.FileName));
                apiModel.Scripts.Add(new SqlScriptModel {
                    Name = file.Name, Extension = file.Extension, Path = file.Location
                });
            }

            #endregion

            if (model.IsNew)
            {
                response = await ApiUtility.PostAsync <BuildModel>(Services.Builds, apiModel);
            }
            else
            {
                response = await ApiUtility.PutAsync <BuildModel>(Services.Builds, apiModel);
            }

            if (response)
            {
                return(RedirectToAction("List"));
            }

            return(View(model));
        }
Beispiel #30
0
        public async Task <BuildModel> GetProjectBuilds(string ProjetcName)
        {
            BuildModel           buildModel      = new BuildModel();
            BuildModelValue      buildModelvalue = null;
            DevOpsConnectionPool poolObj         = _builderPool.Get();

            try
            {
                buildModel.Builds = new List <BuildModelValue>(); //UI aspect
                // Create instance of VssConnection using Personal Access Token
                //var buildclient = new BuildHttpClient(new Uri(c_collectionUri), new VssBasicCredential(string.Empty, personalaccesstoken));
                using (var buildclient = new BuildHttpClient(new Uri(poolObj.CollUrl), poolObj.VssCredentials))
                {
                    var definitions = await buildclient.GetDefinitionsAsync(ProjetcName);

                    if (definitions.Any())
                    {
                        foreach (var def in definitions)
                        {
                            buildModelvalue = new BuildModelValue()
                            {
                                BuildID     = def.Id,
                                BuildName   = def.Name,
                                BuildUrl    = def.Url,
                                DateCreated = def.CreatedDate,
                                BuildPath   = def.Path,
                                ProjectId   = def.Project.Id,
                                ProjectName = def.Project.Name,
                                ProjectUrl  = def.Project.Url
                            };
                            buildModel.Builds.Add(buildModelvalue);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                _builderPool.Return(poolObj);
            }
            return(buildModel);
        }
Beispiel #31
0
        public void GivenSomeAssetsInBlobSetAndSomeNot()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            AssetData dataInBlobSet = pushMetadata.GetManifestAsAsset(ImmutableList.Create(nonShippingAssetData), "thisIsALocation", "thisIsTheManifestFileName");

            PackageArtifactModel shippingPackageArtifact = new PackageArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", "false" },
                },
                Id      = shippingAssetData.Name,
                Version = shippingAssetData.Version
            };

            BlobArtifactModel blobArtifactModel = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", "true" }
                },
                Id = dataInBlobSet.Name
            };

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Packages = new List <PackageArtifactModel> {
                    shippingPackageArtifact
                },
                Blobs = new List <BlobArtifactModel> {
                    blobArtifactModel
                }
            };

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(
                ImmutableList.Create(dataInBlobSet, shippingAssetData), manifestBuildData);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
        public static Build Convert(this BuildModel model)
        {
            var build = new Build
            {
                Id              = model.Id,
                Number          = model.Number,
                Status          = model.Status,
                State           = model.State,
                BranchName      = model.BranchName,
                BuildTypeId     = model.BuildTypeId,
                Href            = model.Href,
                WebUrl          = model.WebUrl,
                StatusText      = model.StatusText,
                StartDate       = model.StartDate,
                FinishDate      = model.FinishDate,
                QueuedDate      = model.QueuedDate,
                BuildType       = model.BuildType,
                Triggered       = model.Triggered,
                Agent           = model.Agent,
                TestOccurrences = model.TestOccurrences,
                Comment         = model.Comment,
                Personal        = model.Personal,
                RunningInfo     = model.RunningInfo
            };

            if (model.LastChanges?.Change != null)
            {
                build.LastChanges = model.LastChanges.Change;
            }

            if (model.Revisions?.Revision != null)
            {
                build.Revisions = model.Revisions.Revision;
            }

            if (model.Properties?.Property != null)
            {
                build.Properties = model.Properties.Property;
            }

            return(build);
        }
Beispiel #33
0
        public ActionResult Index(BuildModel buildModel, string productDivision, string guid)
        {
            // トークンの比較(F5押下による呼び出しか確認)
            if (guid != (string)TempData["guid"])
            {
                // F5押下の場合は初期表示に戻す。
                return(RedirectToAction("Index"));
            }

            // 各プロパティに指定したバリデーションのチェックを行う。
            // チェックに反する場合は、画面に戻りエラーを返す。
            if (ModelState.IsValid)
            {
                // 処理
            }

            // 問題が発生した場合はフォームを再表示する
            // トークン処理(F5防止のため)
            return(View(SetToken(buildModel)));
        }
Beispiel #34
0
        /// <summary>
        /// トークン処理(F5防止のため)
        /// </summary>
        /// <param name="publishModel">publishModel to join</param>
        /// <returns>publishModel</returns>
        private BuildModel SetToken(BuildModel buildModel)
        {
            // GUID生成&hiddenに格納
            string guid = Guid.NewGuid().ToString();

            buildModel.Guid = guid;
            ModelState.SetModelValue("Guid", new ValueProviderResult(guid, guid, null));

            // TempDataがない場合は追加、ある場合は値を上書き
            if (TempData["guid"] == null)
            {
                TempData.Add("guid", guid);
            }
            else
            {
                TempData["guid"] = guid;
            }

            return(buildModel);
        }
        public void CheckIfBlobDataIsPreservedAfterMerging()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            packages = new List <PackageArtifactModel>();
            blobs    = new List <BlobArtifactModel>();
            blobs.Add(blob1);

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Blobs = new List <BlobArtifactModel> {
                    blob1
                }
            };
            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(packages, blobs, manifest);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
Beispiel #36
0
        public void GetBuilds_BuildConfigurationName()
        {
            // Arrange
            var teamCityCaller = CreateTeamCityCaller();
            var build          = new BuildModel {
                Id = 987, Status = "SUCCESS"
            };

            A.CallTo(() => teamCityCaller.Get <BuildWrapper>("/app/rest/builds?locator=buildType:name:FluentTc,&fields=count,build(buildTypeId,href,id,number,state,status,webUrl)"))
            .Returns(new BuildWrapper {
                Count = "1", Build = new List <BuildModel>(new[] { build })
            });

            var connectedTc = new RemoteTc().Connect(_ => _.AsGuest(), teamCityCaller);

            // Act
            var builds = connectedTc.GetBuilds(_ => _.BuildConfiguration(__ => __.Name("FluentTc")));

            // Assert
            builds.Single().Id.Should().Be(987);
        }
Beispiel #37
0
 public bool TryUpdate(BuildModel toUpdate)
 {
     throw new NotImplementedException();
 }