本文整理汇总了Java中com.atlassian.bamboo.task.TaskResult类的典型用法代码示例。如果您正苦于以下问题:Java TaskResult类的具体用法?Java TaskResult怎么用?Java TaskResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskResult类属于com.atlassian.bamboo.task包,在下文中一共展示了TaskResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult execute(final TaskContext taskContext)
throws TaskException {
Build build = new Build(taskContext);
init(taskContext, build);
buildLogger = taskContext.getBuildLogger();
TaskResultBuilder builder = TaskResultBuilder.newBuilder(taskContext);
ProcessHandler packaging = processHandlerService.packaging();
packaging.execute();
if (packaging.hasFailed()) {
return builder.failedWithError().build();
}
else {
return builder.checkReturnCode(packaging.getExternalProcess()).build();
}
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:20,代码来源:PackagingTask.java
示例2: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
public TaskResult execute(TaskContext context) throws TaskException {
TaskResultBuilder resultBuilder = TaskResultBuilder.create(context);
final BuildLogger logger = context.getBuildLogger();
logger.addBuildLogEntry("Executing BlazeMeter task...");
logger.addBuildLogEntry("BlazemeterBamboo plugin v." + Utils.getVersion());
BambooCiBuild build = null;
FileHandler logHandler = null;
BuildResult buildResult = null;
try {
logHandler = setUpLogFileHandler(context);
build = setUpCiBuild(context, logHandler);
buildResult = build.execute();
} catch (Exception e) {
logger.addErrorLogEntry("Failed to start build: ",e);
return resultBuilder.failed().build();
} finally {
logHandler.close();
}
switch (buildResult) {
case FAILED:
return resultBuilder.failed().build();
case ERROR:
return resultBuilder.failedWithError().build();
case SUCCESS:
return resultBuilder.success().build();
default:
return resultBuilder.success().build();
}
}
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:31,代码来源:TaskType.java
示例3: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
protected TaskResult execute(final TaskContext taskContext, final VirtualMachine vm) throws Throwable
{
final BuildLogger buildLogger = taskContext.getBuildLogger();
final String name = vm.getName();
VirtualMachineRuntimeInfo vmri = (VirtualMachineRuntimeInfo) vm.getRuntime();
if (vmri.getPowerState() == VirtualMachinePowerState.poweredOff) {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' is already in a powered off state.");
return TaskResultBuilder.create(taskContext).success().build();
}
buildLogger.addBuildLogEntry("Requesting that the virtual machine '" + name + "' power off.");
Task task = vm.powerOffVM_Task();
if(task.waitForMe()==Task.SUCCESS) {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' has was succesfully powered off.");
}
else {
buildLogger.addBuildLogEntry("Failed to power off the virtual machine '" + name + "'.");
}
return TaskResultBuilder.create(taskContext).success().build();
}
开发者ID:bloudraak,项目名称:blueprint-bamboo-vmware-tasks,代码行数:23,代码来源:PowerOffVirtualMachineTask.java
示例4: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
public TaskResult execute(TaskContext taskContext) throws TaskException {
logger.setLogger(taskContext.getBuildLogger());
setUsernameAndPassword(taskContext);
scanner.setWorkingDir(copyArtifacts(taskContext));
scanner.setUtilPath(getUtilPath(taskContext));
scanner.generateIRX(taskContext, this);
scanner.submitIRX(taskContext);
TaskResultBuilder result = TaskResultBuilder.newBuilder(taskContext);
try {
if (taskContext.getConfigurationMap().getAsBoolean(CFG_SUSPEND)) {
scanner.waitForReady(taskContext);
scanner.downloadResult(taskContext, this);
return calculateResult(taskContext, result).build();
}
return result.success().build();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
return result.failedWithError().build();
}
}
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:30,代码来源:SASTScanTask.java
示例5: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult execute(CommonTaskContext commonTaskContext) throws TaskException {
Deploy deploy = new Deploy(commonTaskContext);
init(commonTaskContext, deploy);
TaskResultBuilder builder = TaskResultBuilder.newBuilder(commonTaskContext);
buildLogger.addBuildLogEntry("Deployment (in Bamboo-Deploy context) has started...");
return doExecute(builder);
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:10,代码来源:DeploymentTask.java
示例6: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult execute(CommonTaskContext commonTaskContext)
throws TaskException {
TaskResultBuilder builder = TaskResultBuilder.newBuilder(commonTaskContext);
buildLogger = commonTaskContext.getBuildLogger();
buildLogger.addBuildLogEntry("Preparing Statistics (in Bamboo-Deploy context).");
Deploy deploy = new Deploy(commonTaskContext);
init(commonTaskContext, deploy);
return doExecute(commonTaskContext, deploy, builder,commonTaskContext.getConfigurationMap());
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:13,代码来源:StatisticsTask.java
示例7: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult execute(CommonTaskContext commonTaskContext)
throws TaskException {
TaskResultBuilder builder = TaskResultBuilder.newBuilder(commonTaskContext);
buildLogger = commonTaskContext.getBuildLogger();
buildLogger.addBuildLogEntry("Preparing test runs (in Bamboo-Deploy context).");
Deploy deploy = new Deploy(commonTaskContext);
init(commonTaskContext, deploy);
check = new DeploymentCheckReportCollector(this, buildLogger);
return doExecute(commonTaskContext, deploy, builder, commonTaskContext.getConfigurationMap());
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:15,代码来源:DeploymentCheckTask.java
示例8: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult execute(CommonTaskContext commonTaskContext)
throws TaskException {
TaskResultBuilder builder = TaskResultBuilder.newBuilder(commonTaskContext);
buildLogger = commonTaskContext.getBuildLogger();
buildLogger.addBuildLogEntry("Preparing Rollback (in Bamboo-Deploy context).");
Deploy deploy = new Deploy(commonTaskContext);
init(commonTaskContext, deploy);
return doExecute(commonTaskContext, deploy, builder,commonTaskContext.getConfigurationMap());
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:13,代码来源:RollbackTask.java
示例9: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
protected TaskResult execute(final TaskContext taskContext, final VirtualMachine vm) throws Throwable
{
final BuildLogger buildLogger = taskContext.getBuildLogger();
final String name = vm.getName();
VirtualMachineRuntimeInfo vmri = (VirtualMachineRuntimeInfo) vm.getRuntime();
if (vmri.getPowerState() == VirtualMachinePowerState.poweredOff) {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' is already in a powered off state.");
return TaskResultBuilder.create(taskContext).success().build();
}
buildLogger.addBuildLogEntry("Requesting that the guest of virtual machine '" + name + "' shutdown.");
int timeout = 1000 * 60 * 5;
int ms = timeout;
vm.shutdownGuest();
vmri = (VirtualMachineRuntimeInfo) vm.getRuntime();
while (vmri.getPowerState() != VirtualMachinePowerState.poweredOff && ms > 0) {
buildLogger.addBuildLogEntry("Waiting for the guest of virtual machine '" + name + "' to shutdown and power off the machine.");
Thread.sleep(5000);
ms -= 5000;
vmri = (VirtualMachineRuntimeInfo) vm.getRuntime();
}
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' has was succesfully shutdown and powered off.");
return TaskResultBuilder.create(taskContext).success().build();
}
开发者ID:bloudraak,项目名称:blueprint-bamboo-vmware-tasks,代码行数:29,代码来源:ShutdownVirtualMachineTask.java
示例10: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
public TaskResult execute(final TaskContext taskContext) throws TaskException
{
final BuildLogger buildLogger = taskContext.getBuildLogger();
final String server = taskContext.getConfigurationMap().get(VirtualMachineTaskConfigurator.HOST);
final String username = taskContext.getConfigurationMap().get(VirtualMachineTaskConfigurator.USERNAME);
final String password = encryptionService.decrypt(taskContext.getConfigurationMap().get(VirtualMachineTaskConfigurator.PASSWORD));
final String name = taskContext.getConfigurationMap().get(VirtualMachineTaskConfigurator.NAME);
TaskResult result = null;
buildLogger.addBuildLogEntry("Starting the virtual machine '" + name + "' on '" + server + "' using username '" + username + "'");
try {
buildLogger.addBuildLogEntry("Connecting to server '" + server + "' using username '" + username + "'.");
ServiceInstance serviceInstance = new ServiceInstance(new URL(server), username, password, true);
buildLogger.addBuildLogEntry("Connected to server '" + server + "' using username '" + username + "'.");
try {
Folder rootFolder = serviceInstance.getRootFolder();
InventoryNavigator inventory = new InventoryNavigator(rootFolder);
VirtualMachine vm = (VirtualMachine)inventory.searchManagedEntity("VirtualMachine", name);
if (vm == null) {
throw new VirtualMachineNotFoundException("The virtual machine with name '" + name + "' could not be found");
}
buildLogger.addBuildLogEntry("Found the virtual machine '" + name + "' on '" + server + "' using username '" + username + "'");
result = execute(taskContext, vm);
}
finally {
buildLogger.addBuildLogEntry("Disconnecting from server '" + server + "'.");
serviceInstance.getServerConnection().logout();
buildLogger.addBuildLogEntry("Disconnected from server '" + server + "'.");
}
}
catch(Throwable throwable) {
throw new TaskException("The operation failed for virtual machine '" + name + "' on '" + server + "' using username '" + username + "'", throwable);
}
return result;
}
开发者ID:bloudraak,项目名称:blueprint-bamboo-vmware-tasks,代码行数:36,代码来源:VirtualMachineTaskType.java
示例11: logTaskResult
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
private void logTaskResult(final IntLogger logger, final TaskResult result) {
logger.info("HUB Scan Task result: " + result.getTaskState());
}
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:4,代码来源:HubScanTask.java
示例12: doExecute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
public TaskResult doExecute(CommonTaskContext taskContext, BuildEnv buildEnv, TaskResultBuilder builder, ConfigurationMap configMap) {
builder.success();
try {
ProcessHandler applicationGetStatus = processHandlerService.applicationGetStatus();
applicationGetStatus.execute();
ResultParserApplicationGetStatus statusParser;
String filename = applicationGetStatus.getOutputFilename();
statusParser = new ResultParserApplicationGetStatus(filename);
String deploymentTime = statusParser.getDeploymentTime(configMap.get("app_name"));
String deployedVersion = statusParser.getDeployedVersion(configMap.get("app_name"));
buildDates(deploymentTime);
ProcessHandler issuesListPeriodAfterDeploy = processHandlerService.monitorGetIssuesListPredefinedFilter(deploymentTimstamp, nowTimestamp, false);
issuesListPeriodAfterDeploy.execute();
ResultParserMonitorGetIssuesListPredefinedFilter parserPeriodAfterDeploy = new ResultParserMonitorGetIssuesListPredefinedFilter(issuesListPeriodAfterDeploy.getOutputFilename());
ProcessHandler issuesListPeriodBeforeDeploy = processHandlerService.monitorGetIssuesListPredefinedFilter(comparisonPeriodTimestamp, deploymentTimstamp, true);
issuesListPeriodBeforeDeploy.execute();
ResultParserMonitorGetIssuesListPredefinedFilter parserPeriodBeforeDeploy = new ResultParserMonitorGetIssuesListPredefinedFilter(issuesListPeriodBeforeDeploy.getOutputFilename());
if (issuesListPeriodAfterDeploy.getBuildEnv() instanceof Build) {
final Map<String, String> customBuildData = errorCollatorListener.getTaskContext().getBuildContext().getBuildResult().getCustomBuildData();
customBuildData.put(OUTPUT_FILE_KEY_ISSUES_LIST_BEFORE_DEPLOY, issuesListPeriodBeforeDeploy.getOutputFilename());
customBuildData.put(OUTPUT_FILE_KEY_ISSUES_LIST_AFTER_DEPLOY, issuesListPeriodAfterDeploy.getOutputFilename());
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMATTER_PATTERN);
customBuildData.put(TIME_DEPLOY, sdf.format(deploymentDate));
customBuildData.put(TIME_START_PERIOD_BEFORE_DEPLOY, sdf.format(comparisonPeriodDate));
customBuildData.put(TIME_END_PERIOD_BEFORE_DEPLOY, sdf.format(deploymentDate));
customBuildData.put(TIME_START_PERIOD_AFTER_DEPLOY, sdf.format(deploymentDate));
customBuildData.put(TIME_END_PERIOD_AFTER_DEPLOY, sdf.format(nowDate));
customBuildData.put(APP_VERSION, deployedVersion);
}
}
catch (Exception e) {
buildLogger.addErrorLogEntry("Exception: " + e.getMessage());
builder.failed();
}
return builder.build();
}
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:46,代码来源:StatisticsTask.java
示例13: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@NotNull
@java.lang.Override
public TaskResult execute(@NotNull final TaskContext taskContext)
throws TaskException {
final BuildLogger buildLogger = taskContext.getBuildLogger();
final String hammer = taskContext.getConfigurationMap().get("hammer");
final String drivers = taskContext.getConfigurationMap().get("drivers");
final String projectDir = taskContext.getConfigurationMap().get("projectDir");
final String command = taskContext.getConfigurationMap().get("command");
final String exportSQL = taskContext.getConfigurationMap().get("exportSQL");
final String exportRollbackSQL = taskContext.getConfigurationMap().get("exportRollbackSQL");
buildLogger.addBuildLogEntry("Export SQL: " + exportSQL);
buildLogger.addBuildLogEntry("Export Rollback SQL: " + exportRollbackSQL);
// TODO: test sql and add the following to command array
//--genSQL --genRollbackSQL
String genSQL = "";
if (exportSQL.equals("true")) {
genSQL = "--genSQL";
}
String genRollbackSQL = "";
if (exportRollbackSQL.equals("true")) {
genRollbackSQL = "--genRollbackSQL";
}
//command
final Map<String, String> commandMap = new HashMap<String, String>();
commandMap.put("Change Log Sync", "changelogSync");
commandMap.put("Check Drivers", "checkdrivers");
commandMap.put("Clear Check Sums", "clearCheckSums");
commandMap.put("List all Datbases in a Project", "dbshow");
commandMap.put("Deploy", "deploy");
commandMap.put("Deploy with Auto Rollback", "deploy-autoRollback");
commandMap.put("Compare Schemas (Report)", "diff");
commandMap.put("Compare Schemas (Change Log)", "diffChangelog");
commandMap.put("Forecast", "forecast");
commandMap.put("Show History", "history");
commandMap.put("Install a License File", "installLicense");
commandMap.put("Rollback", "rollback");
commandMap.put("Display Summary Schema Info", "schemaStats");
commandMap.put("Set Property", "set");
commandMap.put("Show Property", "show");
commandMap.put("Snapshot", "snapshot");
commandMap.put("Show Status", "status");
commandMap.put("Show Status (Detailed)", "statusDetails");
commandMap.put("Create New Datical DB Project", "newProj");
commandMap.put("Create New Database Definition", "newDBDef");
String realcommand = commandMap.get(command);
final String args = taskContext.getConfigurationMap().get("args");
//String[] myArgs = args.split(" ");
buildLogger.addBuildLogEntry("Location of Datical DB: " + hammer);
TaskResultBuilder builder = TaskResultBuilder.create(taskContext);
ExternalProcess process = processService.createProcess(taskContext,
new ExternalProcessBuilder().command(Arrays.asList(hammer, "-drivers", drivers, "--project", projectDir, genSQL, genRollbackSQL, realcommand, args))
.workingDirectory(taskContext.getWorkingDirectory()));
process.execute();
return builder.checkReturnCode(process, 0).build();
//return TaskResultBuilder.create(taskContext).success().build();
}
开发者ID:Datical,项目名称:DaticalDB4Bamboo,代码行数:76,代码来源:DaticalDBTask.java
示例14: execute
import com.atlassian.bamboo.task.TaskResult; //导入依赖的package包/类
@Override
protected TaskResult execute(final TaskContext taskContext, final VirtualMachine vm) throws Throwable
{
final BuildLogger buildLogger = taskContext.getBuildLogger();
final String name = vm.getName();
VirtualMachineRuntimeInfo vmri = (VirtualMachineRuntimeInfo) vm.getRuntime();
if (vmri.getPowerState() != VirtualMachinePowerState.poweredOn) {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' is not powered on.");
Task task = vm.powerOnVM_Task(null);
if(task.waitForMe()==Task.SUCCESS) {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' has been powered on.");
}
else {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' failed to powered on.");
}
}
else {
buildLogger.addBuildLogEntry("The virtual machine '" + name + "' is already in a powered on state.");
}
int timeout = 60 * 5 * 1000;
int ms = timeout;
while (!vm.getGuest().getToolsRunningStatus().equals("guestToolsRunning") && ms > 0) {
buildLogger.addBuildLogEntry("The guest virtual machine '" + name + "' is not running.");
Thread.sleep(5000);
ms -= 5000;
}
if (ms <= 0) {
buildLogger.addBuildLogEntry("The guest of the virtual machine '" + name + "' did not respond within " + timeout + "ms");
throw new InterruptedException("The guest tools did not startup in '" + timeout + "ms'");
}
buildLogger.addBuildLogEntry("The guest of the virtual machine '" + name + "' is running.");
vm.getResourcePool();
String guestHostName = vm.getGuest().getHostName();
while ((guestHostName == null || "".equals(guestHostName)) && ms > 0) {
buildLogger.addBuildLogEntry("The guest of the virtual machine '" + name + "' is running, but cannot be accessed.");
Thread.sleep(5000);
ms -= 5000;
guestHostName = vm.getGuest().getHostName();
}
if (ms <= 0) {
buildLogger.addBuildLogEntry("The guest of the virtual machine '" + name + "' did not provide a name within " + timeout + "ms");
throw new InterruptedException("The guest tools did not startup in '" + timeout + "ms'");
}
buildLogger.addBuildLogEntry("The guest of the virtual machine '" + name + "' is ready to be used.");
return TaskResultBuilder.create(taskContext).success().build();
}
开发者ID:bloudraak,项目名称:blueprint-bamboo-vmware-tasks,代码行数:54,代码来源:StartVirtualMachineTask.java
注:本文中的com.atlassian.bamboo.task.TaskResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论