private String getBranch(SBuild build) { Branch branch = build.getBranch(); if (branch != null && branch.getName() != "<default>") { return branch.getDisplayName(); } else { return ""; } }
private String getBranch(SBuild build) { Branch branch = build.getBranch(); if (branch != null && branch.getName() != "<default>") { return branch.getDisplayName(); } else { return ""; } }
private void setupSbuildMock() { when(sRunningBuild.getBranch()).thenReturn(new Branch() { @Override public boolean isDefaultBranch() { return false; } @Override public String getName() { return "release-branch"; } @Override public String getDisplayName() { return "Release Branch"; } }); }
public WebHookTemplateContent findTemplateForState( SBuild sRunningBuild, BuildStateEnum state, String payloadtemplateName, WebHookPayload payloadFormat) { WebHookTemplateContent templateForThisBuild; if (sRunningBuild.getBranch() != null){ // We have a branch aware sBuild. Get the branch template. templateForThisBuild = webHookTemplateResolver.findWebHookBranchTemplate(state, sRunningBuild.getBuildType(), payloadFormat.getFormatShortName(), payloadtemplateName); } else { // Branch is null. TeamCity is not aware of branch support for this sBuild, so get the non-branch template. templateForThisBuild = webHookTemplateResolver.findWebHookTemplate(state, sRunningBuild.getBuildType(), payloadFormat.getFormatShortName(), payloadtemplateName); } return templateForThisBuild; }