public BuildInfoBuildType UpdateBuild(string app_id, BuildInfoBuildType build)
        {
            var xml = _wrapper.UpdateBuild(
                app_id,
                build.build_id,
                build.version);

            return(XmlParseHelper.Parse <buildinfo>(xml).build ?? null);
        }
        public void Upload_Files_Prescan_And_Scan()
        {
            var app = new ApplicationType
            {
                app_name             = testData.NewAppName + _rand.Next(99999),
                business_criticality = testData.NewAppCriticality
            };

            app = _repo.CreateApp(app);

            var build = new BuildInfoBuildType
            {
                version = testData.NewBuildVersion
            };

            _repo.CreateBuild($"{app.app_id}", build);

            var files = _repo.UploadFileForPrescan($"{app.app_id}", "Assets/testapp1.zip");

            Assert.AreEqual(1, files.Count());

            files = _repo.UploadFileForPrescan($"{app.app_id}", "Assets/testapp2.zip");
            Assert.AreEqual(2, files.Count());

            var buildinfo     = _repo.StartPrescan($"{app.app_id}");
            var buildFinished = BuildStatusType.PreScanSubmitted;

            while (buildFinished == BuildStatusType.PreScanSubmitted)
            {
                buildFinished = _repo
                                .GetBuildDetail($"{app.app_id}", $"{buildinfo.build_id}")
                                .build.analysis_unit[0].status;
                Thread.Sleep(30000);
            }

            var modules            = _repo.GetModules($"{app.app_id}", $"{buildinfo.build_id}");
            var scannableModuleIds = modules.Where(x => !x.has_fatal_errors).Select(x => x.id).ToArray();
            var scaninfo           = _repo.StartScan($"{app.app_id}", string.Join(",", scannableModuleIds));

            buildFinished = BuildStatusType.ScanInProcess;
            while (buildFinished == BuildStatusType.ScanInProcess)
            {
                buildFinished = _repo
                                .GetBuildDetail($"{app.app_id}", $"{buildinfo.build_id}")
                                .build.analysis_unit[0].status;
                Thread.Sleep(30000);
            }

            _repo.DeleteApp(
                new ApplicationType {
                app_id = app.app_id
            }
                );
        }
Ejemplo n.º 3
0
        public string CreateScan(ApplicationProfile app)
        {
            var build = new BuildInfoBuildType
            {
                version = $"VeracodeDSC - {app.application_name} - {DateTime.Now.ToShortTimeString()}"
            };

            return(_veracodeRepository
                   .CreateBuild(app.id, build)
                   .build_id.ToString());
        }
        public void Create_Update_Delete_Build()
        {
            var app = new ApplicationType
            {
                app_name             = testData.NewAppName + _rand.Next(99999),
                business_criticality = testData.NewAppCriticality
            };

            app = _repo.CreateApp(app);

            var build = new BuildInfoBuildType
            {
                version = testData.NewBuildVersion
            };
            var newBuild       = _repo.CreateBuild($"{app.app_id}", build);
            var retrievedBuild = _repo.GetBuildDetail($"{app.app_id}", $"{newBuild.build_id}");

            Assert.IsNotNull(retrievedBuild);

            var updatedBuild = new BuildInfoBuildType
            {
                version  = testData.UpdatedBuildVersion,
                build_id = newBuild.build_id
            };

            var updatedRetrievedBuild = _repo.UpdateBuild($"{app.app_id}", updatedBuild);

            retrievedBuild = _repo.GetBuildDetail($"{app.app_id}", $"{newBuild.build_id}");

            Assert.AreEqual(testData.UpdatedBuildVersion, retrievedBuild.build.version);

            _repo.DeleteBuild($"{app.app_id}");

            var buildList = _repo.GetAllBuildsForApp($"{app.app_id}");

            Assert.IsNull(buildList.SingleOrDefault(x => x.build_id == retrievedBuild.build.build_id));

            _repo.DeleteApp(
                new ApplicationType {
                app_id = app.app_id
            }
                );
        }