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


Java BuildLogger.addBuildLogEntry方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例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 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

示例8: 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

示例9: execute

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

示例10: 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.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.build.logger.BuildLogger.addBuildLogEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。