Пример #1
0
        internal LedLightService(Settings settings, BuildService buildService)
        {
            Settings = settings;
            Telemetry = new TelemetryClient();
            BuildService = buildService;

            Initialise();
        }
Пример #2
0
        public async Task <IActionResult> LatestBuildResult(int?userId)
        {
            if (!Project.ExplicitSubmissionRequired)
            {
                return(NotFound());
            }

            if (userId == null)
            {
                userId = User.Id;
            }

            if (userId != User.Id && ClassroomRole < ClassroomRole.Admin)
            {
                return(Forbid());
            }

            var latestBuildResult = await BuildService.GetLatestBuildResultAsync
                                    (
                ClassroomName,
                ProjectName,
                userId.Value
                                    );

            if (latestBuildResult == null)
            {
                return(NotFound());
            }

            var unreadFeedback = await SubmissionService.GetUnreadFeedbackAsync
                                 (
                ClassroomName,
                userId.Value
                                 );

            if (latestBuildResult.BuildResult != null)
            {
                var buildViewModel = GetBuildViewModelAsync
                                     (
                    latestBuildResult.BuildResult,
                    unreadFeedback
                                     );

                return(View("BuildResult", buildViewModel));
            }
            else
            {
                var buildInProgressViewModel = new BuildInProgressViewModel
                                               (
                    latestBuildResult.Commit,
                    latestBuildResult.EstimatedBuildDuration.Value
                                               );

                return(View("BuildInProgress", buildInProgressViewModel));
            }
        }
Пример #3
0
        public BuildHub()
        {
            //Accept incoming call from Client to initialize KioskHub object
            _hubContext = GlobalHost.ConnectionManager.GetHubContext<BuildHub>();
            _buildService = ServiceLocator.Current.GetInstance<BuildService>();

            #region Sample Data

            #endregion
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildSelectorViewModel"/> class.
        /// </summary>
        /// <param name="buildService">The build service.</param>
        public BuildSelectorViewModel(BuildService buildService)
        {
            this._buildService = buildService;
            this.Builds        = new ObservableCollection <BuildConfigurationViewModel>();

            foreach (var build in this._buildService.Builds)
            {
                this.Builds.Add(new BuildConfigurationViewModel(build));
            }
        }
Пример #5
0
        public void WaitForBuildToFinish()
        {
            string jenkunsServerUrl = @"http://localhost:8080";
            string projectName      = "Jenkins-CSharp-Api.Parameterized";
            var    jenkinsBuild     = new BuildService(new BuildAdapter(new HttpAdapter(), jenkunsServerUrl, projectName));

            string buildResult = jenkinsBuild.Run(string.Empty);

            Assert.AreEqual <string>("SUCCESS", buildResult, "The build run was not successful.");
        }
        public JsonResult Update(CentaBuildType model)
        {
            var service = new BuildService();
            var rs      = service.Update(model);

            return(Json(new
            {
                rs = rs
            }));
        }
        public JsonResult Filter(CentaBuildType model)
        {
            int page    = ConvertUtility.ToInt(Request["page"], 1);
            int rows    = ConvertUtility.ToInt(Request["rows"], 40);
            var service = new BuildService();
            int recordCount;
            var models = service.Filter(model, page, rows, out recordCount);

            return(Json(new { total = recordCount, rows = models }));
        }
        public void ThrowAlreadyTriggeredBuildException_WhenBuildIsAlreadyTriggered()
        {
            IBuildAdapter buildAdapter = Mock.Create <IBuildAdapter>();

            Mock.Arrange(() => buildAdapter.GetSpecificBuildStatusXml(Arg.IsAny <string>())).Throws <WebException>();

            var jenkinsBuild = new BuildService(buildAdapter);

            jenkinsBuild.TriggerBuild(string.Empty, "35");
        }
        public void WaitUntilBuildStarts()
        {
            IBuildAdapter buildAdapter = Mock.Create <IBuildAdapter>();

            Mock.Arrange(() => buildAdapter.GetSpecificBuildStatusXml(Arg.IsAny <string>())).Returns(string.Empty);

            var jenkinsBuild = new BuildService(buildAdapter);

            jenkinsBuild.WaitUntilBuildStarts("32");
        }
Пример #10
0
        public void SetupDependancies()
        {
            var rootUri = ConfigurationManager.AppSettings["HudsonRootUri"];
            var buildxmlFetcher = new HudsonBuildXmlFetcher();

            var jobxmlFetcher = new HudsonJobXmlFetcher();
            var buildFetcher = new HudsonBuildFetcher(buildxmlFetcher);
            var jobFetcher = new HudsonJobFetcher(jobxmlFetcher);

            buildService = new BuildService(buildFetcher, jobFetcher);
        }
        public JsonResult Delete(List <int> id)
        {
            var service  = new BuildService();
            var o        = Request.Form["id"];
            int effected = id.Count(service.Delete);
            var rs       = effected > 0;

            return(Json(new
            {
                rs = rs
            }));
        }
        public JsonResult AddNew(CentaBuildType model)
        {
            var service = new BuildService();
            var id      = service.AddNew(model);
            var rs      = id > 0;

            return(Json(new
            {
                rs = rs,
                id = id
            }));
        }
Пример #13
0
        internal async Task InitialiseAsync()
        {
            await LoadSettingsAsync();

            await Task.Run(() =>
            {
                CancellationToken = new CancellationTokenSource();
                BuildService      = new BuildService(Settings, CancellationToken.Token);

                LightService = new LedLightService(Settings, BuildService);
            });
        }
Пример #14
0
        public void BuildProjectAsync_ArgumentNullException_Project()
        {
            // Arrange
            var           vsaMock    = Mock.Of <IVisualStudioAccess>();
            var           fsaMock    = Mock.Of <IFileSystemAccess>();
            var           loggerMock = Mock.Of <ILogger>();
            IBuildService service    = new BuildService(vsaMock, fsaMock, loggerMock);

            // Act & Assert
            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => service.BuildProjectAsync(null));
        }
Пример #15
0
        public IHttpActionResult Getrecord()
        {
            using (BuildService buildservice = new BuildService())
            {
                List <BuildModels> models = buildservice.GetData(@"select Table_build.Build_ID , Build_date ,Build_money, Class_name,Table_Image.Image_text
                                                              from Table_build
                                                              Join Table_Class on Table_build.Build_class = Table_Class.Class_id
							                                  join Table_Image on Table_Image.Build_id = Table_build.Build_ID
                                                              ORDER  BY Build_ID ASC");

                return(Ok(models));
            }
        }
Пример #16
0
        public void CopyBuildResultAsync_ArgumentException_BinaryDirectoryNotSet()
        {
            // Arrange
            var           project         = new SqlProject("a", @"C:\TestProject\TestProject.sqlproj", "c");
            const string  targetDirectory = @"C:\TestProject\_Deployment\1.0.0";
            var           vsaMock         = Mock.Of <IVisualStudioAccess>();
            var           fsaMock         = Mock.Of <IFileSystemAccess>();
            var           loggerMock      = Mock.Of <ILogger>();
            IBuildService service         = new BuildService(vsaMock, fsaMock, loggerMock);

            // Act & Assert
            Assert.Throws <ArgumentException>(() => service.CopyBuildResultAsync(project, targetDirectory));
        }
Пример #17
0
        public void SetVersionInWindowTitle()
        {
            string appName = "Lexica";
            string version = VersionService.GetVersion();
            string build   = BuildService.GetBuild();
            string title   = $"{appName} {version}";

            if (build.Length > 0)
            {
                title += $" ({build})";
            }
            Console.Title = title;
        }
Пример #18
0
 public void SetSourceTagBuilt(int appId, int sourceTagId)
 {
     BuildService.CheckClient();
     using (UserModel m = UserModel.GetAdmin(appId)) {
         SourceTag st = m.GetSourceTag(sourceTagId);
         m.SetSourceTagStatus(st, SourceTagStatus.Ready);
         VcsSource vcs = m.GetVcsSource(st.SourceId);
         if (vcs.AutoPublish)
         {
             Builder.BuildService.PublishRelease(m, st, false);
         }
     }
 }
Пример #19
0
 public BuildController(
     AppDbContext dbContext,
     BlueprintConverter blueprintConverter,
     BuildService buildService,
     FollowerService followerService,
     ImageService imageService)
 {
     _dbContext          = dbContext;
     _blueprintConverter = blueprintConverter;
     _buildService       = buildService;
     _followerService    = followerService;
     _imageService       = imageService;
 }
Пример #20
0
        public void CancelRunningBuild()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();
            var buildService      = new BuildService(teamCityApiClient, null, null);

            // Act
            buildService.Stop(123, "Test");

            // Assert
            A.CallTo(() => teamCityApiClient.Post <BuildCancelRequest, BuildModel>("builds/123", A <BuildCancelRequest> .Ignored))
            .MustHaveHappened();
        }
 public PayloadController(
     AppDbContext dbContext,
     ImageService imageService,
     BuildService buildService,
     BlueprintConverter blueprintConverter,
     SlugService slugService)
 {
     _dbContext          = dbContext;
     _imageService       = imageService;
     _buildService       = buildService;
     _blueprintConverter = blueprintConverter;
     _slugService        = slugService;
 }
Пример #22
0
            public void Start()
            {
                buildService       = GetComponent <BuildService>();
                persistenceService = GetComponent <PersistenceService>();
                inputService       = GetComponent <InputService>();

                fgChars         = new Dictionary <int, FightingGameCharacter>();
                selectedFGChars = new Dictionary <int, ICharacterBuilder>();

                otherChars = new Dictionary <int, List <FightingGameCharacter> >();

                EventManager.TriggerEvent <Events.ServiceReady, Type>(typeof(PlayerService));
            }
Пример #23
0
        public void Execute(List <string>?args = null)
        {
            string version = VersionService.GetVersion();
            string build   = BuildService.GetBuild();

            Console.Write($"Lexica {version} (CLI)");
            if (build.Length > 0)
            {
                Console.Write($" (build: {build})");
            }
            Console.WriteLine();
            Console.WriteLine("Copyright (c) Łukasz Rydzkowski");
        }
        public void GetNextBuildNumber()
        {
            IHttpAdapter httpAdapter = Mock.Create <IHttpAdapter>();

            Mock.Arrange(() => httpAdapter.Get(Arg.IsAny <string>())).Returns(JenkinsTestData.BuildStatusXml);
            var    jenkinsBuild    = new BuildService(new BuildAdapter(httpAdapter, JenkinsTestData.JenkinsUrl, JenkinsTestData.ProjectName));
            string nextBuildNumber = jenkinsBuild.GetNextBuildNumber();

            Assert.AreEqual <string>(
                "35",
                nextBuildNumber,
                "The returned next build number was not correct.");
        }
Пример #25
0
        public AppReleaseInfo[] GetAppReleases(int appId)
        {
            BuildService.CheckClient();
            List <AppReleaseInfo> list = new List <AppReleaseInfo> ();

            using (UserModel m = UserModel.GetAdmin(appId)) {
                foreach (AppRelease r in m.GetAppReleases())
                {
                    list.Add(new AppReleaseInfo(m, r));
                }
                return(list.ToArray());
            }
        }
        public Task <List <Lib.Build> > GetWithStatus(BuildService buildService, BuildStatus statusFilter, BuildProviderSettings buildProviderSettings)
        {
            switch (buildService)
            {
            case BuildService.Tfs:
                return(_tfsClient.GetWithStatus(statusFilter, buildProviderSettings));

            case BuildService.DevOps:
                return(_devOpsClient.GetWithStatus(statusFilter, buildProviderSettings));

            default:
                throw new Exception($"Build service {buildService} not implemented!");
            }
        }
        public void ThrowException_When30SecondsWebExceptionsAreThrown()
        {
            IBuildAdapter buildAdapter = Mock.Create <IBuildAdapter>();

            Mock.Arrange(() => buildAdapter.GetSpecificBuildStatusXml(Arg.IsAny <string>())).Throws <WebException>("The remote server returned an error: (404) Not Found.");
            DateTime startTime    = DateTime.Now;
            var      jenkinsBuild = new BuildService(buildAdapter);

            jenkinsBuild.WaitUntilBuildStarts("32");
            DateTime endTime = DateTime.Now;
            double   seconds = (endTime - startTime).TotalSeconds;

            Assert.IsTrue(seconds > 30 && seconds < 31, "The wait time in case of web exceptions was incorrect.");
        }
Пример #28
0
 public ActionResult Index()
 {
     if (Request.IsAuthenticated)
     {
         var userId  = Guid.Parse(User.Identity.GetUserId());
         var service = new BuildService(userId);
         var model   = service.GetRandomBuilds();
         return(View(model));
     }
     else
     {
         return(View());
     }
 }
Пример #29
0
        public void CopyBuildResultAsync_ArgumentNullException_TargetDirectory()
        {
            // Arrange
            var           project    = new SqlProject("a", @"C:\TestProject\TestProject.sqlproj", "c");
            var           vsaMock    = Mock.Of <IVisualStudioAccess>();
            var           fsaMock    = Mock.Of <IFileSystemAccess>();
            var           loggerMock = Mock.Of <ILogger>();
            IBuildService service    = new BuildService(vsaMock, fsaMock, loggerMock);

            // Act & Assert
            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => service.CopyBuildResultAsync(project, null));
            // ReSharper restore AssignNullToNotNullAttribute
        }
Пример #30
0
        public void Build_InvalidRole_ErrorMessage()
        {
            var champ    = "kled";
            var role     = "bat";
            var response = BuildService.BuildSuggestedBuild(
                $"!build {champ} {role}");
            var supportedRoles      = Enum.GetNames(typeof(Enumerations.BuildRole));
            var commaSeparatedRoles = string.Join(", ", supportedRoles);
            var expectedResponse    = $"I could not find the role '{role}'. "
                                      + $"Available roles are: {commaSeparatedRoles}.\n"
                                      + "Here is the most common role for this matchup instead.\n"
                                      + $"http://euw.op.gg/champion/{champ}";

            Assert.AreEqual(expectedResponse, response);
        }
Пример #31
0
        public void GetBuild_Id_BuildNotFound()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();

            A.CallTo(() => teamCityApiClient.Get <BuildModel>("builds/id:123")).Throws(new HttpException(HttpStatusCode.NotFound));

            var buildService = new BuildService(teamCityApiClient, null, null);

            // Act
            var build = buildService.Get(123);

            // Assert
            build.Should().BeNull();
        }
Пример #32
0
        public void GetBuild_BadRequest_ExceptionRethrown()
        {
            // Arrange
            var teamCityApiClient = A.Fake <ITeamCityApiClient>();

            A.CallTo(() => teamCityApiClient.Get <BuildModel>("builds/id:123")).Throws(new HttpException(HttpStatusCode.BadRequest));

            var buildService = new BuildService(teamCityApiClient, null, null);

            // Act
            Action action = () => buildService.Get(123);

            // Assert
            action.ShouldThrow <HttpException>().Which.StatusCode.Should().Be(HttpStatusCode.BadRequest);
        }
Пример #33
0
        public async Task Watch(
            BuildService buildService,
            BuildProviderSettings buildProviderSettings,
            double refreshInterval,
            Action <LastBuildsStatus> onRefreshAction)
        {
            _buildStatusRefreshTimer.OnElapsed(async() =>
            {
                var buildsStatus = await _buildsStatusProvider.DetermineBuildStatus(buildService, buildProviderSettings);

                onRefreshAction(buildsStatus);
            });

            await _buildStatusRefreshTimer.Start(refreshInterval);
        }
Пример #34
0
 public LoggingViewModel(BuildService buildService)
     : this()
 {
     BuildService = buildService;
 }