本文整理汇总了Java中jetbrains.buildServer.serverSide.SBuildFeatureDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java SBuildFeatureDescriptor类的具体用法?Java SBuildFeatureDescriptor怎么用?Java SBuildFeatureDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SBuildFeatureDescriptor类属于jetbrains.buildServer.serverSide包,在下文中一共展示了SBuildFeatureDescriptor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillModel
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
@Override
protected void fillModel(@NotNull Map<String, Object> map,
@NotNull HttpServletRequest httpServletRequest,
@NotNull SBuildType sBuildType,
@NotNull SUser sUser) {
/*
* We need to send two things to the tab:
* 1) the list of historical builds
* 2) the parameters of the SinCity feature (if enabled)
*/
List<FinishedBuildWithChanges> buildsWithChanges = FinishedBuildWithChanges.getListFromBuildType(sBuildType);
map.put("buildsWithChanges", buildsWithChanges);
SBuildFeatureDescriptor sinCityFeature = SinCityBuildFeature.getSinCityFeature(sBuildType);
map.put("sinCityParameters", sinCityFeature == null ? null : sinCityFeature.getParameters());
}
示例2: handleBuildFinished
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
protected void handleBuildFinished(SRunningBuild build) {
final SBuildType bt = build.getBuildType();
if (bt == null) {
return;
}
for (SBuildFeatureDescriptor feature : bt.getBuildFeatures()) {
if (getType().equalsIgnoreCase(feature.getType())) {
handleBuildFinished(build, feature);
break;
}
}
}
示例3: main
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
public static void main(String[] args) {
ReportsDescriptor descriptor = new ReportsDescriptorMock();
ReportsConstants constants = new ReportsConstants();
ReportsFeature feature = new ReportsFeature(null, descriptor, constants);
SRunningBuild build = new SRunningBuildMock();
SBuildFeatureDescriptor fd = new SBuildFeatureDescriptorMock();
feature.handleTokens(PARAMS);
feature.handleBuildFinished(build, fd);
}
示例4: storeBuildNumberInSauce
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
/**
* Invokes the Sauce REST API to store the TeamCity build number and pass/fail status within
* Sauce.
* @param build
* @param sessionId
*/
private void storeBuildNumberInSauce(SRunningBuild build, String sessionId) {
Collection<SBuildFeatureDescriptor> features = build.getBuildType().getBuildFeatures();
if (features.isEmpty()) return;
for (SBuildFeatureDescriptor feature : features) {
if (feature.getType().equals("sauce")) {
SauceREST sauceREST = new SauceREST(getUsername(feature), getAccessKey(feature));
Map<String, Object> updates = new HashMap<String, Object>();
try {
String json = sauceREST.getJobInfo(sessionId);
JSONObject jsonObject = (JSONObject) new JSONParser().parse(json);
String buildNumber = build.getBuildTypeExternalId() + build.getBuildNumber();
logger.info("Setting build number " + buildNumber + " for job " + sessionId + " user: " + getUsername(feature));
updates.put("build", buildNumber);
if (jsonObject.get("passed") == null || jsonObject.get("passed").equals("")) {
if (build.getStatusDescriptor().getStatus().isSuccessful()) {
updates.put("passed", Boolean.TRUE.toString());
} else if (build.getStatusDescriptor().getStatus().isFailed()) {
updates.put("passed", Boolean.FALSE.toString());
}
}
sauceREST.updateJobInfo(sessionId, updates);
} catch (org.json.simple.parser.ParseException e) {
logger.error("Failed to parse JSON for session id: " + sessionId + " user: " + getUsername(feature), e);
}
}
}
}
示例5: getSauceBuildFeature
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
/**
* Returns the Sauce-specific {@link SBuildFeatureDescriptor} instance.
*
* @param build
* @return
*/
private SBuildFeatureDescriptor getSauceBuildFeature(SBuild build) {
Collection<SBuildFeatureDescriptor> features = build.getBuildType().getBuildFeatures();
if (features.isEmpty()) return null;
for (SBuildFeatureDescriptor feature : features) {
if (feature.getType().equals("sauce")) {
return feature;
}
}
return null;
}
示例6: isAvailableFor
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
/**
* @param build
* @return true if sauce is configured
*/
@Override
protected boolean isAvailableFor(@NotNull SBuild build) {
SBuildFeatureDescriptor sauceBuildFeature = getSauceBuildFeature(build);
if (sauceBuildFeature == null) {
return false;
}
if (sauceBuildFeature.getParameters().containsKey(Constants.DISABLE_RESULTS_KEY)
&& sauceBuildFeature.getParameters().get(Constants.DISABLE_RESULTS_KEY).equals("true")) {
return false;
}
return super.isAvailableFor(build); //should return true
}
示例7: getBuildFeaturesOfType
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
@NotNull
@Override
public Collection<SBuildFeatureDescriptor> getBuildFeaturesOfType(@NotNull String s) {
return null;
}
示例8: getAccessKey
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
private String getAccessKey(SBuildFeatureDescriptor feature) {
return feature.getParameters().get(Constants.SAUCE_PLUGIN_ACCESS_KEY);
}
示例9: getUsername
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
private String getUsername(SBuildFeatureDescriptor feature) {
return feature.getParameters().get(Constants.SAUCE_USER_ID_KEY);
}
示例10: retrieveJobIdsFromSauce
import jetbrains.buildServer.serverSide.SBuildFeatureDescriptor; //导入依赖的package包/类
/**
* Retrieve the list of Sauce jobs recorded against the TeamCity build.
*
* @param build
* @return
* @throws IOException
* @throws JSONException
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
*/
public List<JobInformation> retrieveJobIdsFromSauce(SBuild build) throws IOException, JSONException, InvalidKeyException, NoSuchAlgorithmException {
//invoke Sauce Rest API to find plan results with those values
List<JobInformation> jobInformation = new ArrayList<JobInformation>();
SBuildFeatureDescriptor sauceBuildFeature = getSauceBuildFeature(build);
if (sauceBuildFeature == null) {
return null;
}
String username = sauceBuildFeature.getParameters().get(Constants.SAUCE_USER_ID_KEY);
String accessKey = sauceBuildFeature.getParameters().get(Constants.SAUCE_PLUGIN_ACCESS_KEY);
String buildNumber = build.getBuildTypeExternalId() + build.getBuildNumber();
SauceREST sauceREST = new SauceREST(username, accessKey);
logger.info("Retrieving Sauce jobs for " + buildNumber + " user: " + username);
String jsonResponse = sauceREST.retrieveResults(new URL(String.format(JOB_DETAILS_URL, username, buildNumber)));
JSONObject job = new JSONObject(jsonResponse);
JSONArray jobResults = job.getJSONArray("jobs");
if (jobResults.length() == 0) {
//try query using the build number
logger.info("Retrieving Sauce jobs for " + build.getBuildNumber() + " user: " + username);
jsonResponse = sauceREST.retrieveResults(new URL(String.format(JOB_DETAILS_URL, username, build.getBuildNumber())));
job = new JSONObject(jsonResponse);
jobResults = job.getJSONArray("jobs");
}
for (int i = 0; i < jobResults.length(); i++) {
//check custom data to find job that was for build
JSONObject jobData = jobResults.getJSONObject(i);
String jobId = jobData.getString("id");
JobInformation information = new JobInformation(jobId, calcHMAC(username, accessKey, jobId));
String status = jobData.getString("passed");
if (status.equals("null")) {
status = "not set";
}
information.setStatus(status);
information.setName(jobData.getString("name"));
jobInformation.add(information);
}
//the list of results retrieved from the Sauce REST API is last-first, so reverse the list
Collections.reverse(jobInformation);
return jobInformation;
}