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

Java TaskException类代码示例

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

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



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


示例16: execute

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


示例17: execute

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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