com.atlassian.bamboo.task
Class TaskResultBuilder

java.lang.Object
  extended by com.atlassian.bamboo.task.TaskResultBuilder

public class TaskResultBuilder
extends java.lang.Object

Evaluates the execution of TaskTypes to produce a TaskResult

Since:
3.1

Method Summary
 TaskResult build()
           
 TaskResultBuilder checkInterceptorMatches(ContentMatchingInterceptor interceptor, int maximumAge)
           
 TaskResultBuilder checkInterceptorNotMatches(ContentMatchingInterceptor interceptor, int maximumAge)
           
 TaskResultBuilder checkReturnCode(com.atlassian.utils.process.ExternalProcess externalProcess)
          Checks that the return code of the ExternalProcess was zero Will only check return codes if the build state has not been set to Failed for some other reason.
 TaskResultBuilder checkReturnCode(com.atlassian.utils.process.ExternalProcess externalProcess, int expectedReturnCode)
          Checks that the return code of the ExternalProcess was of the expected type.
 TaskResultBuilder checkTestFailures()
          Checks whether any test failures have been recorded against the buildResult and updates the state accordingly Will only check tests if the build state has not been set to Failed for some other reason.
static TaskResult copyWithNewState(TaskResult taskResult, TaskState newTaskState)
          Coppies a taskResult and changes the state
static TaskResultBuilder create(TaskContext taskContext)
          Creates a new TaskResultBuilder for a TaskContext
 TaskResultBuilder failed()
          Sets the Task Result Status as TaskState.FAILED
 TaskResultBuilder failedWithError()
          Sets the Task Result Status as TaskState.ERROR
 TaskState getTaskState()
           
 TaskResultBuilder setState(TaskState taskState)
           
 TaskResultBuilder success()
          Sets the Task Result Status as TaskState.SUCCESS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static TaskResultBuilder create(@NotNull
                                       TaskContext taskContext)
Creates a new TaskResultBuilder for a TaskContext

Parameters:
taskContext - of the executing TaskType
Returns:
evaluator

copyWithNewState

public static TaskResult copyWithNewState(@NotNull
                                          TaskResult taskResult,
                                          @NotNull
                                          TaskState newTaskState)
Coppies a taskResult and changes the state

Parameters:
taskResult - to copy
newTaskState - to replace the old taskState
Returns:
the new TaskResult

success

public TaskResultBuilder success()
Sets the Task Result Status as TaskState.SUCCESS

Returns:
the current TaskResultBuilder with updated status

failed

public TaskResultBuilder failed()
Sets the Task Result Status as TaskState.FAILED

Returns:
the current TaskResultBuilder with updated status

failedWithError

public TaskResultBuilder failedWithError()
Sets the Task Result Status as TaskState.ERROR

Returns:
the current TaskResultBuilder with updated status

checkReturnCode

public TaskResultBuilder checkReturnCode(@NotNull
                                         com.atlassian.utils.process.ExternalProcess externalProcess)
Checks that the return code of the ExternalProcess was zero Will only check return codes if the build state has not been set to Failed for some other reason.

Parameters:
externalProcess - - to check return code of
Returns:
the current TaskResultBuilder with updated status based on the return code

checkReturnCode

public TaskResultBuilder checkReturnCode(@NotNull
                                         com.atlassian.utils.process.ExternalProcess externalProcess,
                                         int expectedReturnCode)
Checks that the return code of the ExternalProcess was of the expected type. Will only check return codes if the build state has not been set to Failed for some other reason.

Parameters:
externalProcess - - process to check return code from
expectedReturnCode- - the return code to be considered a success.
Returns:
the current TaskResultBuilder with updated status based on the return code

checkTestFailures

public TaskResultBuilder checkTestFailures()
Checks whether any test failures have been recorded against the buildResult and updates the state accordingly Will only check tests if the build state has not been set to Failed for some other reason.

Returns:
the current TaskResultBuilder with updated status based on the test outcome

checkInterceptorMatches

public TaskResultBuilder checkInterceptorMatches(@NotNull
                                                 ContentMatchingInterceptor interceptor,
                                                 int maximumAge)

checkInterceptorNotMatches

public TaskResultBuilder checkInterceptorNotMatches(@NotNull
                                                    ContentMatchingInterceptor interceptor,
                                                    int maximumAge)

build

public TaskResult build()

getTaskState

public TaskState getTaskState()

setState

public TaskResultBuilder setState(TaskState taskState)


Copyright © 2012 Atlassian. All Rights Reserved.