当前位置: 首页>>代码示例>>Java>>正文


Java TaskException类代码示例

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


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

示例1: generateIRX

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
public void generateIRX(TaskContext taskContext, IArtifactPublisher publisher) throws TaskException {
	
	irxBaseName = taskContext.getBuildContext().getBuildResultKey();
	
	logger.info("generate.irx", irxBaseName, workingDir); //$NON-NLS-1$
	
	ExternalProcess process = processService.executeExternalProcess(
			taskContext, 
			createExternalProcessBuilder(
					taskContext, 
					"prepare", 		//$NON-NLS-1$
					"-n", irxBaseName));	//$NON-NLS-1$
	
	publisher.publishArtifact(taskContext, "IRX", workingDir, irxBaseName + "*.*"); //$NON-NLS-1$ //$NON-NLS-2$
	
	int exitCode = process.getHandler().getExitCode();
	if (exitCode != 0)
		throw new TaskException(logger.getText("generate.irx.failed", exitCode)); //$NON-NLS-1$
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:20,代码来源:SASTScanner.java

示例2: submitIRX

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
public void submitIRX(TaskContext taskContext) throws TaskException {
	
	logger.info("submit.irx"); //$NON-NLS-1$
	
	loginToASoC(taskContext);
	
	String appId = taskContext.getConfigurationMap().get(CFG_APP_ID);
	
	ExternalProcess process = processService.executeExternalProcess(
			taskContext, 
			createExternalProcessBuilder(
					taskContext,
					"queue_analysis",  				//$NON-NLS-1$
					"-a", appId,					//$NON-NLS-1$
					"-n", irxBaseName + ".irx"));	//$NON-NLS-1$ //$NON-NLS-2$
	
	int exitCode = process.getHandler().getExitCode();
	if (exitCode != 0)
		throw new TaskException(logger.getText("submit.irx.failed", exitCode)); //$NON-NLS-1$
	
	jobId = getLastLogEntry(taskContext);
	if (!jobId.matches("^[-0-9a-zA-Z]+$"))								//$NON-NLS-1$
		throw new TaskException(logger.getText("submit.irx.failed2"));	//$NON-NLS-1$
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:25,代码来源:SASTScanner.java

示例3: waitForReady

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
public void waitForReady(TaskContext taskContext) throws TaskException, InterruptedException {
	
	int consecFails = 0;
	
	for (;;) {
		
		Thread.sleep(getTimeToSleep(taskContext) * 1000L);
		
		try {
			if (isReady(taskContext))
				return;
			
			consecFails = 0;
		}
		catch (StatusCheckException e) {
			if (++consecFails == MAX_CONSEC_FAILS)
				throw e;
		}
	}
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:21,代码来源:SASTScanner.java

示例4: downloadResult

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
public void downloadResult(TaskContext taskContext, IArtifactPublisher publisher) throws TaskException {
	
	logger.info("download.result"); //$NON-NLS-1$
	
	String html = irxBaseName + ".html"; //$NON-NLS-1$
	
	ExternalProcess process = processService.executeExternalProcess(
			taskContext, 
			createExternalProcessBuilder(
					taskContext,
					"get_result",  	//$NON-NLS-1$
					"-i", jobId,	//$NON-NLS-1$
					"-d", html));	//$NON-NLS-1$
	
	publisher.publishArtifact(taskContext, logger.getText("result.artifact"), workingDir, html); //$NON-NLS-1$
	
	int exitCode = process.getHandler().getExitCode();
	if (exitCode != 0)
		throw new TaskException(logger.getText("download.result.failed", exitCode)); //$NON-NLS-1$
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:21,代码来源:SASTScanner.java

示例5: execute

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

示例6: execute

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

示例7: setUpBzmUtils

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
private BambooBzmUtils setUpBzmUtils(TaskContext context, FileHandler logHandler) throws TaskException {
    List<TaskDefinition> tds = context.getBuildContext().getBuildDefinition().getTaskDefinitions();
    final BuildLogger logger = context.getBuildLogger();

    String apiId = null;
    String apiSecret = null;
    String url = null;
    for (TaskDefinition d : tds) {
        if (d.getPluginKey().equals(Constants.PLUGIN_KEY)) {
            Map<String, String> conf = d.getConfiguration();
            apiId = conf.get(AdminServlet.API_ID);
            apiSecret = conf.get(AdminServlet.API_SECRET);
            url = conf.get(AdminServlet.URL);
        }
    }
    if (StringUtils.isBlank(apiId)) {
        logger.addBuildLogEntry("BlazeMeter user key not defined!");
        throw new TaskException("BlazeMeter user key not defined!");
    }
    UserNotifier notifier = new AgentUserNotifier(logger);
    Logger log = new AgentLogger(logHandler);
    BambooBzmUtils utils = new BambooBzmUtils(apiId, apiSecret, url, url, notifier, log);
    return utils;
}
 
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:25,代码来源:TaskType.java

示例8: copyArtifacts

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
private File copyArtifacts(TaskContext taskContext) throws TaskException {
	
	File workingDir = taskContext.getWorkingDirectory();
	File dirToScan = new File(workingDir, SA_DIR);
	
	if (dirToScan.exists())
		FileUtils.deleteDir(dirToScan);
	
	dirToScan.mkdirs();
	
	Collection<ArtifactDefinitionContext> artifacts = taskContext.getBuildContext().getArtifactContext().getDefinitionContexts();
	
	if (artifacts.isEmpty())
		throw new TaskException(logger.getText("err.no.artifacts")); //$NON-NLS-1$
	
	try {
		for (ArtifactDefinitionContext artifact : artifacts) {
			logger.info("copy.artifact", artifact.getName(), dirToScan); //$NON-NLS-1$
			FileSet fileSet = ArtifactHandlingUtils.createFileSet(workingDir, artifact, true, null);
			ArtifactHandlingUtils.copyFileSet(fileSet, dirToScan);
		}
		
		return dirToScan;
	}
	catch (IOException e) {
		throw new TaskException(e.getLocalizedMessage(), e);
	}
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:29,代码来源:SASTScanTask.java

示例9: execute

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

示例10: isReady

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
private boolean isReady(TaskContext taskContext) throws TaskException {
	
	logger.info("status.check"); //$NON-NLS-1$
	
	JsonNode response = pollForStatus(taskContext);
	if (response == null) {
		loginToASoC(taskContext);
		response = pollForStatus(taskContext);
		if (response == null)
			throw new StatusCheckException(logger.getText("status.check.failed")); //$NON-NLS-1$
	}
	
	String status = response.at(STATUS).asText(STATUS_FAILED);
	logger.info("status.check.is", status); //$NON-NLS-1$
	
	if (!STATUS_FAILED.equals(status)) {
		
		if (!STATUS_READY.equals(status))
			return false;
		
		high = response.at(HIGH).asLong(-1);
		medium = response.at(MEDIUM).asLong(-1);
		low = response.at(LOW).asLong(-1);
		
		return true;
	}
	
	throw new TaskException(logger.getText("scan.failed")); //$NON-NLS-1$
}
 
开发者ID:AppSecDev,项目名称:asoc-bamboo-plugin,代码行数:30,代码来源:SASTScanner.java

示例11: execute

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

示例12: execute

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

示例13: execute

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

示例14: execute

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

示例15: setUpCiBuild

import com.atlassian.bamboo.task.TaskException; //导入依赖的package包/类
private BambooCiBuild setUpCiBuild(TaskContext context, FileHandler logHandler) throws TaskException {
    ConfigurationMap configMap = context.getConfigurationMap();
    BuildContext buildContext = context.getBuildContext();
    buildContext.getBuildDefinition().getTaskDefinitions().get(0).getPluginKey();
    String testId = Utils.cutTestType(configMap.get(Constants.SETTINGS_SELECTED_TEST_ID));
    final BuildLogger logger = context.getBuildLogger();
    BlazeMeterUtils utils;
    try {
        utils = setUpBzmUtils(context, logHandler);
    } catch (Exception e) {
        logger.addBuildLogEntry("Failed to find test = " + testId + " on server.");
        throw new TaskException("");
    }
    String jmeterProps = configMap.get(Constants.SETTINGS_JMETER_PROPERTIES);
    boolean jtlReport = configMap.getAsBoolean(Constants.SETTINGS_JTL_REPORT);
    boolean junitReport = configMap.getAsBoolean(Constants.SETTINGS_JUNIT_REPORT);
    String notes = configMap.get(Constants.SETTINGS_NOTES);
    String jtlPath = configMap.get(Constants.SETTINGS_JTL_PATH);
    String junitPath = configMap.get(Constants.SETTINGS_JUNIT_PATH);

    String dd = context.getWorkingDirectory().getAbsolutePath() + "/build # "
            + context.getBuildContext().getBuildNumber();

    BambooCiPostProcess ciPostProcess = new BambooCiPostProcess(jtlReport, junitReport, jtlPath, junitPath, dd, utils.getNotifier(), utils.getLogger());
    BambooCiBuild build = new BambooCiBuild(utils, testId, jmeterProps, notes, ciPostProcess);
    return build;
}
 
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:28,代码来源:TaskType.java


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