public static String getInternalBuildId(SBuildType buildType){ try { return buildType.getInternalId(); } catch (NoSuchMethodError ex) { return buildType.getBuildTypeId(); } }
public static String getBuildTypeId(SBuildType buildType){ try { return buildType.getExternalId(); } catch (NoSuchMethodError ex) { return buildType.getBuildTypeId(); } }
public static String getExternalBuildId(SBuildType buildType){ try { return buildType.getExternalId(); } catch (NoSuchMethodError ex) { return buildType.getBuildTypeId(); } }
public String getBuildTypeId() { return this.sBuildType.getBuildTypeId(); }
public static String getInternalBuildId(SBuildType buildType){ try { return buildType.getInternalId(); } catch (NoSuchMethodError ex) { LOGGER.log(Level.INFO,ex.getMessage(),ex); return buildType.getBuildTypeId(); } }
public static String getBuildTypeId(SBuildType buildType){ try { return buildType.getExternalId(); } catch (NoSuchMethodError ex) { LOGGER.log(Level.INFO,ex.getMessage(),ex); return buildType.getBuildTypeId(); } }
public static String getExternalBuildId(SBuildType buildType){ try { return buildType.getExternalId(); } catch (NoSuchMethodError ex) { LOGGER.log(Level.INFO,ex.getMessage(),ex); return buildType.getBuildTypeId(); } }
public void addANewBuildTypeToTheMock(SBuildType build){ this.buildTypes.put(build.getBuildTypeId(), build); }
public static ProjectHistoryBean getBuildHistory(SBuildType type) { Date now = new Date(); List<ProjectHistoryItemBean> finishedBuilds = new ArrayList<>(); List<SFinishedBuild> builds = type.getHistory(); for (int i = 0; i < builds.size(); i++) { finishedBuilds.add(ProjectHistoryItemBean.build(now, builds.get(i))); if (i > MAX_BUILDS_PER_BUILD_TYPE){ break; } } return new ProjectHistoryBean(type.getProjectId(), type.getBuildTypeId(), finishedBuilds); }
public static ProjectWebHooksBean buildWithoutNew(WebHookProjectSettings projSettings, SBuildType sBuildType, SProject project, Collection<WebHookPayload> registeredPayloads, List<WebHookPayloadTemplate> templateList){ ProjectWebHooksBean bean = new ProjectWebHooksBean(projSettings, project); List<SBuildType> projectBuildTypes = TeamCityIdResolver.getOwnBuildTypes(project); Set<String> enabledBuildTypes = new HashSet<>(); enabledBuildTypes.add(sBuildType.getBuildTypeId()); /* Iterate over the rest of the webhooks in this project and add them to the json config */ for (WebHookConfig config : projSettings.getBuildWebHooksAsList(sBuildType)){ addWebHookConfigHolder(bean, projectBuildTypes, config, registeredPayloads, templateList); } return bean; }
@Override public void buildFinished(SRunningBuild build) { super.buildFinished(build); SBuildType type = build.getBuildType(); if (type != null) { CustomDataStorage checkConfigChanges = type.getCustomDataStorage(CustomDataStorageKeys.CHECKOUT_CONFIGURATION_CHANGE_HISTORY); String oldCheckoutConfigurationName = checkConfigChanges.getValue(type.getBuildTypeId()); if (StringUtils.isNotBlank(oldCheckoutConfigurationName)) { type.setCheckoutType(BuildTypeDescriptor.CheckoutType.valueOf(oldCheckoutConfigurationName)); checkConfigChanges.putValue(type.getBuildTypeId(), null); } } }
@Override protected void fillModel(Map<String,Object> model, HttpServletRequest request, @NotNull SBuildType buildType, SUser user) { List<ProjectAndBuildWebhooksBean> projectAndParents = new ArrayList<>(); List<SProject> parentProjects = buildType.getProject().getProjectPath(); for (SProject projectParent : parentProjects){ projectAndParents.add( ProjectAndBuildWebhooksBean.newInstance( projectParent, (WebHookProjectSettings) this.myProjectSettingsManager.getSettings(projectParent.getProjectId(), "webhooks"), buildType, user.isPermissionGrantedForProject(projectParent.getProjectId(), Permission.EDIT_PROJECT), myWebAddressTransformer ) ); } model.put("projectAndParents", projectAndParents); model.put("projectId", buildType.getProject().getProjectId()); model.put("projectExternalId", TeamCityIdResolver.getExternalProjectId(buildType.getProject())); model.put("projectName", buildType.getProject().getName()); model.put("buildTypeId", buildType.getBuildTypeId()); model.put("buildExternalId", TeamCityIdResolver.getExternalBuildId(buildType)); model.put("buildName", buildType.getName()); model.put("items", myWebHookHistoryRepository.findHistoryItemsForBuildType(buildType.getBuildTypeId(), 1, 50)); }
private static void addWebHookConfigHolder(ProjectWebHooksBean bean, List<SBuildType> projectBuildTypes, WebHookConfig config, Collection<WebHookPayload> registeredPayloads, List<WebHookPayloadTemplate> templateList) { WebhookConfigAndBuildTypeListHolder holder = new WebhookConfigAndBuildTypeListHolder(config, registeredPayloads, templateList); for (SBuildType sBuildType : projectBuildTypes){ holder.addWebHookBuildType(new WebhookBuildTypeEnabledStatusBean( sBuildType.getBuildTypeId(), sBuildType.getName(), config.isEnabledForBuildType(sBuildType) ) ); } bean.webHookList.put(holder.getUniqueKey(), holder); }
private static void addSlackNotificationConfigHolder(ProjectSlackNotificationsBean bean, List<SBuildType> projectBuildTypes, SlackNotificationConfig config, SlackNotificationMainSettings mainSettings) { SlacknotificationConfigAndBuildTypeListHolder holder = new SlacknotificationConfigAndBuildTypeListHolder(config, mainSettings); for (SBuildType sBuildType : projectBuildTypes){ holder.addSlackNotificationBuildType(new SlacknotificationBuildTypeEnabledStatusBean( sBuildType.getBuildTypeId(), sBuildType.getName(), config.isEnabledForBuildType(sBuildType) ) ); } bean.slackNotificationList.put(holder.getUniqueKey(), holder); } }
protected WebHookHistoryItem(WebHookConfig whc, WebHookExecutionStats webHookExecutionStats, SBuildType sBuildType, WebHookErrorStatus errorStatus) { this.projectId = sBuildType.getProjectId(); this.buildTypeId = sBuildType.getBuildTypeId(); this.buildTypeName = sBuildType.getName(); this.buildTypeExternalId = sBuildType.getExternalId(); this.webHookConfig = whc; this.webHookExecutionStats = webHookExecutionStats; this.timestamp = findTimeStamp(webHookExecutionStats); this.webhookErrorStatus = checkAndSetHttpStatusInfo(errorStatus); }
public static ProjectSlackNotificationsBean build(SlackNotificationProjectSettings projSettings, SBuildType sBuildType, SProject project, SlackNotificationMainSettings mainSettings){ ProjectSlackNotificationsBean bean = new ProjectSlackNotificationsBean(); List<SBuildType> projectBuildTypes = TeamCityIdResolver.getOwnBuildTypes(project); Set<String> enabledBuildTypes = new HashSet<String>(); enabledBuildTypes.add(sBuildType.getBuildTypeId()); bean.projectId = TeamCityIdResolver.getInternalProjectId(project); bean.slackNotificationList = new LinkedHashMap<String, SlacknotificationConfigAndBuildTypeListHolder>(); /* Create a "new" config with blank stuff so that clicking the "new" button has a bunch of defaults to load in */ SlackNotificationConfig newBlankConfig = new SlackNotificationConfig("", "", "", true, new BuildState().setAllEnabled(), false, false, enabledBuildTypes, true, true, true, true); newBlankConfig.setUniqueKey("new"); /* And add it to the list */ addSlackNotificationConfigHolder(bean, projectBuildTypes, newBlankConfig, mainSettings); /* Iterate over the rest of the slacknotifications in this project and add them to the json config */ for (SlackNotificationConfig config : projSettings.getBuildSlackNotificationsAsList(sBuildType)){ addSlackNotificationConfigHolder(bean, projectBuildTypes, config, mainSettings); } return bean; }
public static ProjectWebHooksBean build(WebHookProjectSettings projSettings, SBuildType sBuildType, SProject project, Collection<WebHookPayload> registeredPayloads, List<WebHookPayloadTemplate> templateList){ ProjectWebHooksBean bean = new ProjectWebHooksBean(projSettings, project); List<SBuildType> projectBuildTypes = TeamCityIdResolver.getOwnBuildTypes(project); Set<String> enabledBuildTypes = new HashSet<>(); enabledBuildTypes.add(sBuildType.getBuildTypeId()); /* Create a "new" config with blank stuff so that clicking the "new" button has a bunch of defaults to load in */ WebHookConfig newBlankConfig = new WebHookConfig(project.getProjectId(), project.getExternalId(), "", true, new BuildState().setAllEnabled(), null, null, false, false, enabledBuildTypes, null); newBlankConfig.setUniqueKey("new"); /* And add it to the list */ addWebHookConfigHolder(bean, projectBuildTypes, newBlankConfig, registeredPayloads, templateList); /* Iterate over the rest of the webhooks in this project and add them to the json config */ for (WebHookConfig config : projSettings.getBuildWebHooksAsList(sBuildType)){ addWebHookConfigHolder(bean, projectBuildTypes, config, registeredPayloads, templateList); } return bean; }
/** * Used by RepsonsiblityChanged. * Therefore, does not have access to a specific build instance. * @param server * @param buildType * @param state */ private void populateCommonContent(SBuildServer server, SBuildType buildType, BuildStateEnum state) { setBuildFullName(buildType.getFullName()); setBuildName(buildType.getName()); setBuildTypeId(TeamCityIdResolver.getBuildTypeId(buildType)); setBuildStatusUrl(server.getRootUrl() + "/viewLog.html?buildTypeId=" + buildType.getBuildTypeId() + "&buildId=lastFinished"); }
when(projectSettingsManager.getSettings(sRunningBuild.getProjectId(), "webhooks")).thenReturn(webHookProjectSettings); when(build2.getBuildTypeId()).thenReturn("bt2"); when(build2.getInternalId()).thenReturn("bt2"); when(build2.getName()).thenReturn("This is Build 2"); when(build3.getBuildTypeId()).thenReturn("bt3"); when(build3.getInternalId()).thenReturn("bt3"); when(build3.getName()).thenReturn("This is Build 3");
/** * Used by RepsonsiblityChanged. * Therefore, does not have access to a specific build instance. * @param server * @param buildType * @param state */ private void populateCommonContent(VariableResolverFactory variableResolverFactory, SBuildServer server, SBuildType buildType, BuildStateEnum state, Map<String,String> templates) { setNotifyType(state.getShortName()); setBuildRunners(buildType.getBuildRunners()); setBuildFullName(buildType.getFullName()); setBuildName(buildType.getName()); setBuildTypeId(TeamCityIdResolver.getBuildTypeId(buildType)); setBuildInternalTypeId(TeamCityIdResolver.getInternalBuildId(buildType)); setBuildExternalTypeId(TeamCityIdResolver.getExternalBuildId(buildType)); setProjectName(buildType.getProjectName()); setProjectId(TeamCityIdResolver.getProjectId(buildType.getProject())); setProjectInternalId(TeamCityIdResolver.getInternalProjectId(buildType.getProject())); setProjectExternalId(TeamCityIdResolver.getExternalProjectId(buildType.getProject())); setRootUrl(StringUtils.stripTrailingSlash(server.getRootUrl()) + "/"); setBuildStatusUrl(getRootUrl() + "viewLog.html?buildTypeId=" + buildType.getBuildTypeId() + "&buildId=lastFinished"); setBuildStateDescription(state.getDescriptionSuffix()); }