本文整理汇总了Java中jetbrains.buildServer.serverSide.SRunningBuild类的典型用法代码示例。如果您正苦于以下问题:Java SRunningBuild类的具体用法?Java SRunningBuild怎么用?Java SRunningBuild使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SRunningBuild类属于jetbrains.buildServer.serverSide包,在下文中一共展示了SRunningBuild类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildObjecToModel
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
private Map<String, String> buildObjecToModel(SRunningBuild build) {
Map<String, String> result = new HashMap<>();
String buildId = String.valueOf(build.getBuildId());
result.put(TemplateModel.MODEL_VARS.BRANCH.getVarName(), build.getBranch().getDisplayName());
result.put(TemplateModel.MODEL_VARS.BUILD_ID.getVarName(), buildId);
result.put(TemplateModel.MODEL_VARS.BUILD_NUM.getVarName(), build.getBuildNumber());
result.put(TemplateModel.MODEL_VARS.COMPLETED.getVarName(), String.valueOf(build.getCompletedPercent()));
result.put(TemplateModel.MODEL_VARS.DURATION.getVarName(), String.valueOf(build.getDuration()));
result.put(TemplateModel.MODEL_VARS.CONFIGURATION.getVarName(), build.getFullName());
result.put(TemplateModel.MODEL_VARS.TC_BASE_URL.getVarName(), storageDB.readSettings().getTcBaseUrl());
result.put(TemplateModel.MODEL_VARS.BUILD_URL.getVarName(), storageDB.readSettings().getTcBaseUrl() +
"/viewLog.html?buildId=" + buildId + "&tab=buildResultsDiv");
result.put(TemplateModel.MODEL_VARS.TRIGGERED.getVarName(), build.getTriggeredBy().getAsString());
return result;
}
示例2: setUp
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@Before
public void setUp() {
NotificationSettingsDB realOnes = new NotificationSettingsDB();
realOnes.init();
NotificationSettingsDB spied = PowerMockito.spy(realOnes);
PowerMockito.when(spied.readSettings()).thenReturn(realOnes.getDefaultSettings());
template = new NotificationTemplate(spied);
Branch branch = PowerMockito.mock(Branch.class);
PowerMockito.when(branch.getDisplayName()).thenReturn("testBranch");
runningBuild = PowerMockito.mock(SRunningBuild.class);
PowerMockito.when(runningBuild.getBranch()).thenReturn(branch);
PowerMockito.when(runningBuild.getBuildId()).thenReturn(111L);
PowerMockito.when(runningBuild.getBuildNumber()).thenReturn("333");
}
示例3: translateMessages
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@NotNull
public List<BuildMessage1> translateMessages(@NotNull final SRunningBuild build,
@NotNull final List<BuildMessage1> messages
) {
final UserDataStorage storage = ((RunningBuildEx) build).getUserDataStorage();
Set<String> storedPasswords = storage.getValue(myUtil.passwordsKEY);
List<BuildMessage1> result = new ArrayList<BuildMessage1>();
for (BuildMessage1 originalMessage : messages) {
final Object data = originalMessage.getValue();
if (!DefaultMessagesInfo.MSG_TEXT.equals(originalMessage.getTypeId()) || data == null || !(data instanceof String)) {
result.add(originalMessage);
continue;
}
String text = (String) data;
if (storedPasswords != null) {
for (String value : storedPasswords) {
if (!value.equals(""))
text = text.replaceAll(value, "******");
}
}
result.add(DefaultMessagesInfo.createTextMessage(originalMessage, text));
}
return result;
}
示例4: setUp
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@BeforeMethod
public void setUp()
{
myCtx = new Mockery();
myServerExtensionHolder = myCtx.mock(ServerExtensionHolder.class);
myBuildDataStorage = myCtx.mock(BuildDataStorage.class);
myMetricComparer = myCtx.mock(MetricComparer.class);
myStatisticKeyFactory = myCtx.mock(StatisticKeyFactory.class);
myStatisticProvider = myCtx.mock(StatisticProvider.class);
myHistory = myCtx.mock(History.class);
myRunningBuild = myCtx.mock(SRunningBuild.class);
myBuildType = myCtx.mock(SBuildType.class);
buildMessage1 = new BuildMessage1("sourceId", "typeId", Status.NORMAL, new Date(1234567), "value", Arrays.asList("a", "b"));
myBuild1 = myCtx.mock(SFinishedBuild.class, "Build1");
myBuild2 = myCtx.mock(SFinishedBuild.class, "Build2");
myHistoryElement1 = myCtx.mock(HistoryElement.class, "HistoryElement1");
myHistoryElement2 = myCtx.mock(HistoryElement.class, "HistoryElement2");
}
示例5: translate
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@NotNull
@Override
public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1,
@NotNull ServiceMessage serviceMessage)
{
final Map<String, String> messageAttributes = serviceMessage.getAttributes();
if (messageAttributes.isEmpty())
{
LOG.warning("Could not translate service message with empty attributes.");
return Arrays.asList(buildMessage1);
}
dataStoreServices.get(activeDataStoreName)
.saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"),
Arrays.asList(messageAttributes.get("text")),
valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info),
valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded),
valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none)));
return Arrays.asList(buildMessage1);
}
示例6: ReportsFeature
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
public ReportsFeature(EventDispatcher<BuildServerListener> dispatcher, @NotNull ReportsDescriptor descriptor, @NotNull ReportsConstants constants) {
this.editParametersUrl = descriptor.getFeaturePath();
this.constants = constants;
this.jsonFactory = JacksonFactory.getDefaultInstance();
try {
this.httpTransport = GoogleNetHttpTransport.newTrustedTransport();
} catch (GeneralSecurityException | IOException e) {
throw new RuntimeException(e);
}
if (dispatcher != null) {
dispatcher.addListener(new BuildServerAdapter() {
@Override
public void buildFinished(SRunningBuild build) {
handleBuildFinished(build);
}
});
}
}
示例7: buildFinished
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
/**
* Invoked when a build is finished. Iterates over the build output and identifies lines which contains 'SauceOnDemandSessionID',
* and for each line, invokes the Sauce REST API to associate the TeamCity build number with the Sauce Job.
* @param build
*/
@Override
public void buildFinished(SRunningBuild build) {
super.buildFinished(build);
Iterator<LogMessage> iterator = build.getBuildLog().getMessagesIterator();
while (iterator.hasNext()) {
LogMessage logMessage = iterator.next();
String line = logMessage.getText();
if (StringUtils.containsIgnoreCase(line, SAUCE_ON_DEMAND_SESSION_ID)) {
//extract session id
String sessionId = StringUtils.substringBetween(line, SAUCE_ON_DEMAND_SESSION_ID + "=", " ");
if (sessionId == null) {
//we might not have a space separating the session id and job-name, so retrieve the text up to the end of the string
sessionId = StringUtils.substringAfter(line, SAUCE_ON_DEMAND_SESSION_ID + "=");
}
if (sessionId != null && !sessionId.equalsIgnoreCase("null")) {
storeBuildNumberInSauce(build, sessionId);
//build.getTags().add(sessionId);
}
}
}
}
示例8: buildFinished
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@Override
public void buildFinished(@NotNull SRunningBuild build) {
if (buildScanDisplayArbiter.showBuildScanInfo(build)) {
// prepare the cache to be ready when queried by the UI
BuildScanReferences buildScans = buildScanLookup.getBuildScansForBuild(build);
// notify external integration points
if (!buildScans.isEmpty()) {
TeamCityBuildStatus teamCityBuildStatus = TeamCityBuildStatus.from(build.getBuildStatus());
TeamCityConfiguration teamCityConfiguration = new TeamCityConfiguration(build.getFullName(), build.getParametersProvider().getAll());
externalIntegration.handle(buildScans, teamCityBuildStatus, teamCityConfiguration);
}
}
}
示例9: fixRunBuildParameters
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
@Override
public void fixRunBuildParameters(@NotNull final SRunningBuild build, @NotNull final Map<String, String> runParameters, @NotNull final Map<String, String> buildParameters) {
log = build.getBuildLog();
if (isHubBuildStepConfigured(runParameters)) {
handleLog("Hub Plugin enabled.", null);
addGlobalParameterMap(runParameters);
addPluginData(runParameters);
}
}
示例10: getMockedSRunningBuild
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
public static SRunningBuild getMockedSRunningBuild(TestBuildLog buildLog) {
final SRunningBuild mockedSRunningBuild = Mockito.mock(SRunningBuild.class);
if (buildLog == null) {
buildLog = new TestBuildLog();
}
Mockito.when(mockedSRunningBuild.getBuildLog()).thenReturn(buildLog);
return mockedSRunningBuild;
}
示例11: mapBuildNotification
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
public static BuildNotification mapBuildNotification(final String status, final Map<String, Object> buildMap) {
final BuildData data = new BuildData();
data.status = status;
data.agentName = (String) buildMap.get("agentName");
final SBuild build = (SBuild) buildMap.get("build");
data.buildName = build.getFullName();
data.buildNumber = build.getBuildNumber();
data.personal = build.isPersonal();
if (build instanceof SRunningBuild){
final SRunningBuild runningBuild = (SRunningBuild)build;
data.elapsedTime = runningBuild.getElapsedTime();
data.estimatedTime = runningBuild.getDurationEstimate();
data.overTime = runningBuild.getDurationOvertime();
}
data.url = (String)buildMap.get("buildResultsLink");
data.compilationError = (String)buildMap.get("buildCompilationErrors");
BuildStatistics statistics = build.getBuildStatistics(BuildStatisticsOptions.ALL_TESTS_NO_DETAILS);
data.tests.failed = statistics.getFailedTestCount();
data.tests.ignored = statistics.getIgnoredTestCount();
data.tests.passed = statistics.getPassedTestCount();
return new BuildNotification(data);
}
示例12: sendNotification
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
private void sendNotification(SRunningBuild build, NotificationTemplate.TEMPLATE_TYPES templateType) {
Log.info("Sending notification about '%s' using the settings '%s'", templateType, templateFactory.getCurrentSettings());
if (templateFactory.getCurrentSettings().isEnabled()) {
String nofification = null;
try {
nofification = templateFactory.createAndProcessTemplate(build, templateType).toString();
NotificationHttpSender.sendPost(templateFactory.getCurrentSettings().getApiUrl(), nofification);
} catch (Exception e) {
Log.error("There was some error while we were sending the Notification", e);
Log.info("The failed notification message was '%'", nofification != null ? nofification : "NULL");
}
}
}
示例13: getCompletedPercent
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
public int getCompletedPercent() {
if (isBuilding()) {
return ((SRunningBuild) build).getCompletedPercent();
} else {
return 100;
}
}
示例14: testStatistics
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
private TestStatisticsViewState testStatistics() {
if (isBuilding()) {
ShortStatistics stats = ((SRunningBuild) latestBuild.get()).getShortStatistics();
return new TestStatisticsViewState(
stats.getPassedTestCount(), stats.getFailedTestCount(), stats.getIgnoredTestCount());
} else {
return new TestStatisticsViewState(0, 0, 0);
}
}
示例15: getActivity
import jetbrains.buildServer.serverSide.SRunningBuild; //导入依赖的package包/类
public String getActivity() {
if (isBuilding()) {
return ((SRunningBuild) latestBuild.get()).getShortStatistics().getCurrentStage();
} else {
return status().toString();
}
}