• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TaskResultBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.atlassian.bamboo.task.TaskResultBuilder的典型用法代码示例。如果您正苦于以下问题:Java TaskResultBuilder类的具体用法?Java TaskResultBuilder怎么用?Java TaskResultBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TaskResultBuilder类属于com.atlassian.bamboo.task包,在下文中一共展示了TaskResultBuilder类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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.TaskResultBuilder; //导入依赖的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.TaskResultBuilder; //导入依赖的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.TaskResultBuilder; //导入依赖的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: checkPolicyFailures

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的package包/类
private TaskResultBuilder checkPolicyFailures(final TaskResultBuilder resultBuilder, final TaskContext taskContext, final IntLogger logger, final HubServicesFactory services, final MetaService metaService,
        final ProjectVersionView version, final boolean isDryRun) {
    try {
        if (isDryRun) {
            logger.warn("Will not run the Failure conditions because this was a dry run scan.");
            return resultBuilder.success();
        }
        final String policyStatusLink = metaService.getFirstLink(version, MetaService.POLICY_STATUS_LINK);

        final VersionBomPolicyStatusView policyStatusItem = services.createHubResponseService().getItem(policyStatusLink, VersionBomPolicyStatusView.class);
        if (policyStatusItem == null) {
            logger.error("Could not find any information about the Policy status of the bom.");
            return resultBuilder.failed();
        }

        final PolicyStatusDescription policyStatusDescription = new PolicyStatusDescription(policyStatusItem);
        final String policyStatusMessage = policyStatusDescription.getPolicyStatusMessage();
        if (policyStatusItem.overallStatus == VersionBomPolicyStatusOverallStatusEnum.IN_VIOLATION) {
            logger.error(policyStatusMessage);
            return resultBuilder.failedWithError();
        }
        logger.info(policyStatusMessage);
        return resultBuilder.success();
    } catch (final IntegrationException e) {
        logger.error(e.getMessage(), e);
        return resultBuilder.failed();
    }
}
 
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:29,代码来源:HubScanTask.java


示例6: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例7: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例8: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例9: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例10: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例11: doExecute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例12: getBuilder

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的package包/类
public TaskResultBuilder getBuilder() {
	return builder;
}
 
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:4,代码来源:EventListener.java


示例13: setBuilder

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的package包/类
public void setBuilder(TaskResultBuilder builder) {
	this.builder = builder;
}
 
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:4,代码来源:EventListener.java


示例14: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例15: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的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


示例16: execute

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的package包/类
protected TaskResult execute(final TaskContext taskContext, final VirtualMachine vm) throws Throwable
{
	return TaskResultBuilder.create(taskContext).success().build();
}
 
开发者ID:bloudraak,项目名称:blueprint-bamboo-vmware-tasks,代码行数:5,代码来源:VirtualMachineTaskType.java


示例17: calculateResult

import com.atlassian.bamboo.task.TaskResultBuilder; //导入依赖的package包/类
private TaskResultBuilder calculateResult(TaskContext taskContext, TaskResultBuilder result) {
	
	ConfigurationMap config = taskContext.getConfigurationMap();
	
	boolean failed = checkFail(config, CFG_MAX_HIGH, scanner.getHighCount());
	failed |= checkFail(config, CFG_MAX_MEDIUM, scanner.getMediumCount()); 
	failed |= checkFail(config, CFG_MAX_LOW, scanner.getLowCount());
	
	if (failed)
		return result.failed();
	
	return result.success();
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:14,代码来源:SASTScanTask.java



注:本文中的com.atlassian.bamboo.task.TaskResultBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RetireJobInfo类代码示例发布时间:2022-05-23
下一篇:
Java SWTFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap