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

Java JobConsoleLogger类代码示例

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

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



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

示例1: execute

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ExecutionResult execute(ExecutionContext context, ExecutionConfiguration config, JobConsoleLogger console) {

    try {
        final ProcessBuilder gradle = buildGradleProcess(config, context);

        int result = execute(gradle, console);

        if (!isSuccess(result)) {
            return ExecutionResult.failure(FAILURE);
        }

        return ExecutionResult.success(SUCCESS);
    } catch (Exception e) {
        logger.error("Build failed with error", e);

        console.printLine(e.getMessage());
        console.printLine(ExceptionUtils.getStackTrace(e));

        return ExecutionResult.failure(FAILURE, e);
    }
}
 
开发者ID:jmnarloch,项目名称:gocd-gradle-plugin,代码行数:26,代码来源:GradleTaskExecutor.java


示例2: shouldBuildGradleProjectUsingWrapper

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@Test
public void shouldBuildGradleProjectUsingWrapper() throws Exception {

    // given
    final ExecutionContext executionContext = createExecutionContext();
    final ExecutionConfiguration executionConfiguration =
            createExecutionConfig(singletonMap(USE_WRAPPER.getName(), TRUE.toString()));
    final JobConsoleLogger jobConsoleLogger = createConsoleLogger();

    // when
    final ExecutionResult result = instance.execute(executionContext, executionConfiguration, jobConsoleLogger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-gradle-plugin,代码行数:17,代码来源:GradleTaskExecutorTest.java


示例3: shouldBuildGradleProjectUsingWrapperAndSetExecutablePermission

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@Test
public void shouldBuildGradleProjectUsingWrapperAndSetExecutablePermission() throws Exception {

    // given
    final ExecutionContext executionContext = createExecutionContext();
    final Map<String, String> settings = new HashMap<>();
    settings.put(USE_WRAPPER.getName(), TRUE.toString());
    settings.put(MAKE_WRAPPER_EXECUTABLE.getName(), TRUE.toString());
    final ExecutionConfiguration executionConfiguration = createExecutionConfig(settings);
    final JobConsoleLogger jobConsoleLogger = createConsoleLogger();

    // when
    final ExecutionResult result = instance.execute(executionContext, executionConfiguration, jobConsoleLogger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-gradle-plugin,代码行数:19,代码来源:GradleTaskExecutorTest.java


示例4: shouldBuildGradleProjectUsingWrapperInWindowsRelativeDirectory

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@Test
public void shouldBuildGradleProjectUsingWrapperInWindowsRelativeDirectory() throws Exception {

    // given
    final ExecutionContext executionContext = createExecutionContext("src\\test\\resources\\gradle");
    final Map<String, String> settings = new HashMap<>();
    settings.put(USE_WRAPPER.getName(), TRUE.toString());
    final ExecutionConfiguration executionConfiguration = createExecutionConfig(settings);
    final JobConsoleLogger jobConsoleLogger = createConsoleLogger();

    // when
    final ExecutionResult result = instance.execute(executionContext, executionConfiguration, jobConsoleLogger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-gradle-plugin,代码行数:18,代码来源:GradleTaskExecutorTest.java


示例5: shouldSuccess

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * Tests whether the health check succeeds.
 */
@Test
public void shouldSuccess() {

    // given
    final ExecutionContext context = new ExecutionContext(new HashMap());
    final ExecutionConfiguration configuration = configuration(url("/health"), "status", "UP", 15, 30);
    final JobConsoleLogger logger = mock(JobConsoleLogger.class);

    // when
    ExecutionResult result = instance.execute(context, configuration, logger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-health-check-plugin,代码行数:19,代码来源:HealthCheckTaskExecutorTest.java


示例6: shouldSuccessWithDotNotation

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * Tests whether the health check succeeds.
 */
@Test
public void shouldSuccessWithDotNotation() {

    // given
    final ExecutionContext context = new ExecutionContext(new HashMap());
    final ExecutionConfiguration configuration = configuration(url("/health"), "service.status", "UP", 15, 30);
    final JobConsoleLogger logger = mock(JobConsoleLogger.class);

    // when
    ExecutionResult result = instance.execute(context, configuration, logger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-health-check-plugin,代码行数:19,代码来源:HealthCheckTaskExecutorTest.java


示例7: shouldTimeoutStatus

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * Tests the timeout and failure of the task on incorrect application status.
 */
@Test
public void shouldTimeoutStatus() {

    // given
    final ExecutionContext context = new ExecutionContext(new HashMap());
    final ExecutionConfiguration configuration = configuration(url("/health"), "status", "OK", 15, 30);
    final JobConsoleLogger logger = mock(JobConsoleLogger.class);

    // when
    ExecutionResult result = instance.execute(context, configuration, logger);

    // then
    assertNotNull(result);
    assertFalse(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-health-check-plugin,代码行数:19,代码来源:HealthCheckTaskExecutorTest.java


示例8: shouldTimeoutConnection

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * Tests the timeout and failure of the task on connection error.
 */
@Test
public void shouldTimeoutConnection() {

    // given
    final ExecutionContext context = new ExecutionContext(new HashMap());
    final ExecutionConfiguration configuration = configuration(url("/"), "status", "UP", 15, 30);
    final JobConsoleLogger logger = mock(JobConsoleLogger.class);

    // when
    ExecutionResult result = instance.execute(context, configuration, logger);

    // then
    assertNotNull(result);
    assertFalse(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-health-check-plugin,代码行数:19,代码来源:HealthCheckTaskExecutorTest.java


示例9: Init

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@BeforeClass
public static void Init() throws Exception {
    CheckMkStub.init();
    config = Mockito.mock(Map.class);
    consoleLogger = Mockito.mock(JobConsoleLogger.class);
    context = Mockito.mock(Context.class);

    Map serverMock = Mockito.mock(Map.class);
    Mockito.when(serverMock.get("value")).thenReturn(CheckMkStub.server);
    Mockito.when(config.get(CheckMkTask.CHECK_MK_SERVER)).thenReturn(serverMock);

    Map hostnameMock = Mockito.mock(Map.class);
    Mockito.when(hostnameMock.get("value")).thenReturn(CheckMkStub.hostName);
    Mockito.when(config.get(CheckMkTask.HOSTNAME)).thenReturn(hostnameMock);

    Map userNameMock = Mockito.mock(Map.class);
    Mockito.when(userNameMock.get("value")).thenReturn(CheckMkStub.userName);
    Mockito.when(config.get(CheckMkTask.USERNAME)).thenReturn(userNameMock);

    Map passwordMock = Mockito.mock(Map.class);
    Mockito.when(passwordMock.get("value")).thenReturn(CheckMkStub.password);
    Mockito.when(config.get(CheckMkTask.PASSWORD)).thenReturn(passwordMock);
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:24,代码来源:RemoveHostTaskExecutorTests.java


示例10: DockerMachineListCommand

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public DockerMachineListCommand(JobConsoleLogger console, ConfigVars configVars, boolean quiet, String filter, String format) {
    super(console, true);
    add("docker-machine");
    add("ls");
    if (quiet) {
        add("--quiet");
    }
    if (filter != null) {
        add("--filter");
        add(filter);
    }
    if (format != null) {
        add("--format");
        add(format);
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:17,代码来源:DockerMachineListCommand.java


示例11: DockerComposeCommand

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public DockerComposeCommand(JobConsoleLogger console, ConfigVars configVars) throws FileNotFoundException {
    super(console);

    // 1. just copy from the current environment
    addEnv(configVars.environmentVars());

    // 2. variables stated/defined explicitly
    addEnv(splitKeyValues(configVars.getValue(DockerComposeTask.ENV_VARS)));

    // 3. variables defined by the configuration settings
    addEnvFromConfig(configVars, DockerComposeTask.COMPOSE_FILE);

    // 4. variables based on the docker-machine environment settings
    addEnv(getDockerMachineEnv(configVars.getValue(DockerComposeTask.VMNAME)));

    add("docker-compose");
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:18,代码来源:DockerComposeCommand.java


示例12: DockerContainerIdCommand

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public DockerContainerIdCommand(JobConsoleLogger console, ConfigVars configVars) {
    super(console, configVars);

    disableConsoleOutput();

    try {
        add("docker");
        add("ps");
        add("-q");
        run();
        ProcessOutput output = getProcessOutput();
        if (output.isZeroReturnCode() && (output.getStdOut().size() > 0)) {
            command.clear();
            add("docker");
            add("inspect");
            for (String s : output.getStdOut()) {
                add(s);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:24,代码来源:DockerContainerIdCommand.java


示例13: execute

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ExecutionResult execute(ExecutionContext context, ExecutionConfiguration config, JobConsoleLogger console) {

    try {
        final ProcessBuilder sbt = buildSbtProcess(context, config);

        int result = execute(sbt, console);

        if (!isSuccess(result)) {
            return ExecutionResult.failure(FAILURE);
        }

        return ExecutionResult.success(SUCCESS);
    } catch (Exception e) {
        logger.error("Build failed with error", e);

        console.printLine(e.getMessage());
        console.printLine(ExceptionUtils.getStackTrace(e));

        return ExecutionResult.failure(FAILURE, e);
    }
}
 
开发者ID:jmnarloch,项目名称:gocd-sbt-plugin,代码行数:26,代码来源:SbtTaskExecutor.java


示例14: shouldBuildGradleProject

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@Test
public void shouldBuildGradleProject() throws Exception {

    // given
    final ExecutionContext executionContext = createExecutionContext();
    final ExecutionConfiguration executionConfiguration = createExecutionConfig(Collections.<String, String>emptyMap());
    final JobConsoleLogger jobConsoleLogger = createConsoleLogger();

    // when
    final ExecutionResult result = instance.execute(executionContext, executionConfiguration, jobConsoleLogger);

    // then
    assertNotNull(result);
    assertTrue(result.isSuccess());
}
 
开发者ID:jmnarloch,项目名称:gocd-gradle-plugin,代码行数:16,代码来源:GradleTaskExecutorTest.java


示例15: execute

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ExecutionResult execute(ExecutionContext context, ExecutionConfiguration config, JobConsoleLogger console) {

    try {
        final String healthCheckUrl = getProperty(config, HealthCheckTaskConfig.URL);
        final String attribute = getProperty(config, HealthCheckTaskConfig.ATTRIBUTE);
        final String status = getProperty(config, HealthCheckTaskConfig.STATUS);
        final int timeout = getIntProperty(config, HealthCheckTaskConfig.TIMEOUT, 60);
        final int retryDelay = getIntProperty(config, HealthCheckTaskConfig.DELAY, 15);

        final boolean success = RxNetty.createHttpGet(healthCheckUrl)
                .flatMap(parseJsonElement())
                .map(mapStatusAttribute(attribute))
                .map(mapAttributeValue())
                .map(matchStatus(status))
                .filter(filterStatuses())
                .switchIfEmpty(Observable.<Boolean>error(null))
                .retryWhen(retryPolicy(retryDelay, timeout))
                .timeout(timeout, TimeUnit.SECONDS)
                .toBlocking()
                .firstOrDefault(false);

        if (!success) {
            return ExecutionResult.failure("Health check failed");
        }

        return ExecutionResult.success("Health check succeeded");
    } catch (Exception e) {

        logger.error("Unexpected error occurred when executing task", e);
        return ExecutionResult.failure("Health check failed", e);
    }
}
 
开发者ID:jmnarloch,项目名称:gocd-health-check-plugin,代码行数:37,代码来源:HealthCheckTaskExecutor.java


示例16: Create

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public static CheckMkTaskExecutor Create(JobConsoleLogger console, Context context, Map config) throws JobNotSupportedException {
    String action = (String) ((Map) config.get(CheckMkTask.ACTION)).get("value");
    switch (action) {
        case "add":
            return new AddHostTaskExecutor(console, context, config);
        case "edit":
            return new EditHostTaskExecutor(console, context, config);
        case "remove":
            ((Map) config.get(CheckMkTask.FOLDER_PATH)).put("value", "");
            ((Map) config.get(CheckMkTask.HOST_IP)).put("value", "");
            return new RemoveHostTaskExecutor(console, context, config);
    }
    throw new JobNotSupportedException("Action " + action + " not supported!");
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:15,代码来源:TaskExecutorFactory.java


示例17: Init

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@BeforeClass
public static void Init() throws Exception {
    CheckMkStub.init();
    config = Mockito.mock(Map.class);
    consoleLogger = Mockito.mock(JobConsoleLogger.class);
    context = Mockito.mock(Context.class);
    Map serverMock = Mockito.mock(Map.class);
    Mockito.when(serverMock.get("value")).thenReturn(CheckMkStub.server);
    Mockito.when(config.get(CheckMkTask.CHECK_MK_SERVER)).thenReturn(serverMock);

    Map hostnameMock = Mockito.mock(Map.class);
    Mockito.when(hostnameMock.get("value")).thenReturn(CheckMkStub.hostName);
    Mockito.when(config.get(CheckMkTask.HOSTNAME)).thenReturn(hostnameMock);

    Map hostIpMock = Mockito.mock(Map.class);
    Mockito.when(hostIpMock.get("value")).thenReturn(CheckMkStub.hostIp);
    Mockito.when(config.get(CheckMkTask.HOST_IP)).thenReturn(hostIpMock);

    Map folderPathMock = Mockito.mock(Map.class);
    Mockito.when(folderPathMock.get("value")).thenReturn(CheckMkStub.folderPath);
    Mockito.when(config.get(CheckMkTask.FOLDER_PATH)).thenReturn(folderPathMock);

    Map userNameMock = Mockito.mock(Map.class);
    Mockito.when(userNameMock.get("value")).thenReturn(CheckMkStub.userName);
    Mockito.when(config.get(CheckMkTask.USERNAME)).thenReturn(userNameMock);

    Map passwordMock = Mockito.mock(Map.class);
    Mockito.when(passwordMock.get("value")).thenReturn(CheckMkStub.password);
    Mockito.when(config.get(CheckMkTask.PASSWORD)).thenReturn(passwordMock);
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:31,代码来源:AddHostTaskExecutorTests.java


示例18: Init

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
@BeforeClass
public static void Init() throws Exception {
    CheckMkStub.init();
    config = Mockito.mock(Map.class);
    consoleLogger = Mockito.mock(JobConsoleLogger.class);
    context = Mockito.mock(Context.class);
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:8,代码来源:TaskExecutorFactoryTest.java


示例19: DockerMachineStartCommand

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public DockerMachineStartCommand(JobConsoleLogger console, ConfigVars configVars) {
    super(console, true);

    add("docker-machine");
    add("start");
    add(configVars.getValue(DockerMachineTask.VMNAME));
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:8,代码来源:DockerMachineStartCommand.java


示例20: DockerMachineCommand

import com.thoughtworks.go.plugin.api.task.JobConsoleLogger; //导入依赖的package包/类
public DockerMachineCommand(JobConsoleLogger logger, ProcessRunner processRunner, boolean ignoreErrors) {
    super(logger, processRunner, ignoreErrors);

    String storagePath = ".docker/machine";
    addEnv(MACHINE_STORAGE_PATH, storagePath);

    fixPrivatKeyPermissions(storagePath);
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:9,代码来源:DockerMachineCommand.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java BDDAssertions类代码示例发布时间:2022-05-22
下一篇:
Java BaseLang类代码示例发布时间: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