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


Java BuildLogger类代码示例

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


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

示例1: execute

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
@NotNull
@Override
public TaskResult execute(@NotNull TaskContext taskContext) throws TaskException {
    CurrentResult currentResult = taskContext.getCommonContext().getCurrentResult();
    BuildLogger buildLogger = taskContext.getBuildLogger();
    ErrorMemorisingInterceptor errorLines = ErrorMemorisingInterceptor.newInterceptor();
    buildLogger.getInterceptorStack().add(errorLines);

    try {
        String filePattern = taskContext.getConfigurationMap().get(TEST_FILE_PATTERN);
        boolean collectOutdatedFiles = taskContext.getConfigurationMap().getAsBoolean(COLLECT_OUTDATED_FILES);

        this.testCollationService.collateTestResults(taskContext,
                filePattern,
                new xUnitTestReportCollector(buildLogger),
                collectOutdatedFiles);
        return TaskResultBuilder.newBuilder(taskContext).checkTestFailures().build();
    } catch (Exception e) {
        throw new TaskException("Failed to execute task: " + e.getLocalizedMessage());
    } finally {
        currentResult.addBuildErrors(errorLines.getErrorStringList());
    }
}
 
开发者ID:wwwlicious,项目名称:wwwlicious.bamboo.xunit,代码行数:24,代码来源:xUnitParserTask.java

示例2: publishRiskReportFiles

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
private void publishRiskReportFiles(final IntLogger logger, final TaskContext taskContext, final SecureToken token, final RiskReportDataService riskReportDataService, final ProjectView project, final ProjectVersionView version) {

        final BuildContext buildContext = taskContext.getBuildContext();
        final PlanResultKey planResultKey = buildContext.getPlanResultKey();
        final BuildLogger buildLogger = taskContext.getBuildLogger();

        try {
            final File baseDirectory = new File(taskContext.getWorkingDirectory(), HubBambooUtils.HUB_RISK_REPORT_ARTIFACT_NAME);
            riskReportDataService.createReportFiles(baseDirectory, project, version);
            final Map<String, String> config = new HashMap<>();
            final ArtifactDefinitionContext artifact = createArtifactDefContext(token);
            final ArtifactPublishingResult publishResult = artifactManager.publish(buildLogger, planResultKey, baseDirectory, artifact, config, RISK_REPORT_MINIMUM_FILE_COUNT);
            if (!publishResult.shouldContinueBuild()) {
                logger.error("Could not publish the artifacts for the Risk Report");
            }
            cleanupReportFiles(baseDirectory);
        } catch (final IntegrationException ex) {
            logger.error("Could not publish the Risk Report", ex);
        }
    }
 
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:21,代码来源:HubScanTask.java

示例3: processThreshold

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
private void processThreshold(ConfigurationMap config, Map<String, String> checkstyleResults, String type, BuildLogger buildLogger, TaskResultBuilder builder)
{
    String thresholdName = CheckStyleTaskConfigurator.CHECKSTYLE_ERROR_PRIORITY_THRESHOLD;
    String violationName = ICheckStyleBuildProcessor.CHECKSTYLE_ERROR_PRIORITY_VIOLATIONS;
    if ( "warning".equals( type ) )
    {
        thresholdName = CheckStyleTaskConfigurator.CHECKSTYLE_WARNING_PRIORITY_THRESHOLD;
        violationName = ICheckStyleBuildProcessor.CHECKSTYLE_WARNING_PRIORITY_VIOLATIONS;
    }

    int threshold = CheckstylePluginHelper.getThreshold( config.get( thresholdName ) );
    double violations = NumberUtils.toDouble(checkstyleResults.get(violationName), 0);

    if ( threshold >= 0 && violations > threshold )
    {
        String msg = String.format( "Checkstyle %s violations [%s] exceed threshold [%s]", type, violations, threshold );

        buildLogger.addErrorLogEntry(msg);

        builder.failed();
    }
}
 
开发者ID:javiergutites,项目名称:bamboo-checkstyle-plugin,代码行数:23,代码来源:CheckStyleTask.java

示例4: execute

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

示例5: setUpBzmUtils

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

示例6: setUpLogFileHandler

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
private FileHandler setUpLogFileHandler(TaskContext context) throws Exception {
    File dd = new File(context.getWorkingDirectory().getAbsolutePath() + "/build # "
            + context.getBuildContext().getBuildNumber());
    String log = dd + File.separator + Constants.HTTP_LOG;
    File logFile = new File(log);
    BuildLogger buildLogger = context.getBuildLogger();
    try {
        logFile.getParentFile().mkdirs();
        logFile.createNewFile();
    } catch (Exception e) {
        buildLogger.addBuildLogEntry("Failed to create log file = " + log);
        logFile = new File(context.getWorkingDirectory().getAbsolutePath(), File.separator + Constants.HTTP_LOG);
        try {
            buildLogger.addBuildLogEntry("Log will be written to " + logFile.getAbsolutePath());
            logFile.createNewFile();
        } catch (Exception ex) {
            buildLogger.addBuildLogEntry("Failed to create log file = " + logFile.getAbsolutePath());
            throw e;
        }
    }
    FileHandler bzm = new FileHandler(log);
    return bzm;
}
 
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:24,代码来源:TaskType.java

示例7: execute

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

示例8: processThreshold

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
public static void processThreshold(
    BuildContext context, Map<String, String> checkstyleResults, String type, BuildLogger buildLogger)
{
    Map<String, String> customConfiguration = context.getBuildDefinition().getCustomConfiguration();
    String thresholdName = CheckStyleTaskConfigurator.CHECKSTYLE_ERROR_PRIORITY_THRESHOLD;
    String violationName = ICheckStyleBuildProcessor.CHECKSTYLE_ERROR_PRIORITY_VIOLATIONS;
    if ( "warning".equals( type ) )
    {
        thresholdName = CheckStyleTaskConfigurator.CHECKSTYLE_WARNING_PRIORITY_THRESHOLD;
        violationName = ICheckStyleBuildProcessor.CHECKSTYLE_WARNING_PRIORITY_VIOLATIONS;
    }
    
    int threshold = CheckstylePluginHelper.getThreshold( customConfiguration.get( thresholdName ) );
    double violations = NumberUtils.toDouble( checkstyleResults.get( violationName ), 0 );
    
    if ( threshold >= 0 && violations > threshold )
    {
        String msg = String.format( "Checkstyle %s violations [%s] exceed threshold [%s]", type, violations, threshold );
        
        //Save Why the build failed in build result
        context.getBuildResult().getBuildErrors().add( msg );
        context.getBuildResult().getCustomBuildData().put( "failedMessage", msg );
        
        //Save Why the build failed in the build log
        buildLogger.addErrorLogEntry( msg );
        
        //Failed this build
        context.getBuildResult().setBuildState( BuildState.FAILED );
    }
}
 
开发者ID:javiergutites,项目名称:bamboo-checkstyle-plugin,代码行数:31,代码来源:CheckstylePluginHelper.java

示例9: OutputHandler

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
public OutputHandler (PluggableProcessHandler processHandler, String filename, BuildLogger buildLogger) {
	this.filename = filename;
	this.buildLogger = buildLogger;
	
	this.processOutputHandler = new StringOutputHandler();
	
	processHandler.setOutputHandler(processOutputHandler);
       processHandler.setErrorHandler(processOutputHandler);
}
 
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:10,代码来源:OutputHandler.java

示例10: setUpCiBuild

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

示例11: LoggingProcessHandler

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
public LoggingProcessHandler(BuildLogger logger, String input, String encoding) {
    if (input != null) {
        setInputHandler(new StringInputHandler(encoding, input));
    }

    outputHandler = new LogOutputHandler(logger);
    setOutputHandler(outputHandler);

    errorHandler = new LogOutputHandler(logger);
    setErrorHandler(errorHandler);
}
 
开发者ID:bschramke,项目名称:bamboo_plugin_gradlew,代码行数:12,代码来源:LoggingProcessHandler.java

示例12: execute

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
@NotNull
    @Override
    public TaskResult execute(@NotNull TaskContext taskContext) throws TaskException {
        final BuildLogger buildLogger = taskContext.getBuildLogger();
        final CurrentBuildResult currentBuildResult = taskContext.getBuildContext().getBuildResult();
        TaskResultBuilder builder = TaskResultBuilder.newBuilder(taskContext);

        try {
            final ConfigurationMap configuration = taskContext.getConfigurationMap();
            final Map<String, String> environment = getEnvironment(taskContext);


            final String gradleTask = configuration.get("gradleTask");
            Preconditions.checkNotNull(gradleTask);

            final File workingDirectory = taskContext.getWorkingDirectory();

            buildLogger.addBuildLogEntry(workingDirectory.getAbsolutePath());
            final String runnerPath = GradlewExtractor.getGradlewPath(workingDirectory.getAbsolutePath());
            buildLogger.addBuildLogEntry(runnerPath);

            final List<String> command = Lists.newArrayList(runnerPath, "tasks");

            final LoggingProcessHandler processHandler = new LoggingProcessHandler(buildLogger);
            final ExternalProcess process = new ExternalProcessBuilder()
                    .command(command, workingDirectory)
                    .handler(processHandler)
                    .addMonitor(new LoggingProcessMonitor(buildLogger))
                    .env(environment).build();

            process.execute();
//            buildLogger.addBuildLogEntry(processHandler.getOutput());

            return builder.checkReturnCode(process, 0).build();

        } finally {
            currentBuildResult.addBuildErrors(Lists.newArrayList("Irgendwas lief hier falsch"));
        }

    }
 
开发者ID:bschramke,项目名称:bamboo_plugin_gradlew,代码行数:41,代码来源:GradleBuildTask.java

示例13: execute

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

示例14: execute

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

示例15: xUnitParser

import com.atlassian.bamboo.build.logger.BuildLogger; //导入依赖的package包/类
public xUnitParser(BuildLogger logger, File file) {
    log = logger;
    this.file = file;
}
 
开发者ID:wwwlicious,项目名称:wwwlicious.bamboo.xunit,代码行数:5,代码来源:xUnitParser.java


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