com.atlassian.bamboo.plugins.builder.php
Class PhpUnitBuilder

java.lang.Object
  extended by com.atlassian.bamboo.command.Command
      extended by com.atlassian.bamboo.builder.AbstractBuilder
          extended by com.atlassian.bamboo.plugins.builder.php.PhpUnitBuilder
All Implemented Interfaces:
Builder, EnvironmentVariablesAwareBuilder, MutableEnvironmentVariablesAwareBuilder, InitablePluginModule, BambooPluginModule, BuilderV2, ConfigurablePlugin, java.io.Serializable

public class PhpUnitBuilder
extends AbstractBuilder

This class provides a PHPUnit version of Builder.

See Also:
Serialized Form

Field Summary
protected  java.lang.String arguments
           
protected static java.lang.String BUILD_SUCCESSFUL_MARKER
           
protected  java.lang.String coverageHtmlDirectory
           
protected  boolean coverageHtmlEnabled
           
protected  boolean logXmlEnabled
           
protected  java.lang.String logXmlFile
           
protected  java.lang.String myTestDirectoryOption
           
static java.lang.String NAME
           
protected  java.lang.String options
           
static java.lang.String PATHHELP
           
 
Fields inherited from class com.atlassian.bamboo.builder.AbstractBuilder
BUILD_FAILED_MARKER, buildDirectoryManager, DEFAULT_TEST_REPORTS_XML, errorUpdateHandler, FIND_FAILURE_MESSAGE_IN_LAST, FIND_SUCCESS_MESSAGE_IN_LAST, PARAM_BUILD_LABEL, PARAM_BUILDJDK, PARAM_ENV_VAR, PARAM_HASTESTS, PARAM_HOME, PARAM_PROJECT_FILE, PARAM_TEST_RESULTS_DIRECTORY, PARAM_WORKING_SUB_DIR, SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE, templateRenderer
 
Fields inherited from class com.atlassian.bamboo.command.Command
buildLoggerManager, substitutionBean
 
Fields inherited from interface com.atlassian.bamboo.builder.Builder
CAPABILITY_BUILDER_PREFIX, CAPABILITY_BUILDER_TYPE
 
Constructor Summary
PhpUnitBuilder()
           
 
Method Summary
 java.util.Map<java.lang.String,LabelPathMap> addDefaultLabelPathMaps(java.util.Map<java.lang.String,LabelPathMap> labelPathMaps)
           
 void addDefaultValues(BuildConfiguration configuration)
          Extension point for adding default values to the form for ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
 int executeCommand(BuildContext buildContext, CommandExecuteStreamHandler commandExecuteStreamHandler, java.lang.String extraEnvironmentVariables, java.lang.String javaHome, ReadOnlyCapabilitySet capabilitySet)
          Check if output directories for PHPUnit are created.
 java.lang.String getArguments()
           
 java.lang.String[] getCommandArguments(ReadOnlyCapabilitySet capabilitySet)
          What are the arguments for the command line to execute
 java.lang.String getCommandExecutable(ReadOnlyCapabilitySet capabilitySet)
          What is the executable for the command line to execute
 java.lang.String getCoverageHtmlDirectory()
           
protected  java.lang.String[] getCustomEnvironmentVars(ReadOnlyCapabilitySet capabilitySet)
           
 java.util.Map<java.lang.String,java.lang.String> getFullParams()
          Gets the full params that's used to persist.
 java.lang.String getLogXmlFile()
           
 java.lang.String getName()
          Returns a human readable version of the current Builder type
 java.lang.String getPathHelp()
          Help text for the builder type
 java.lang.String getTestResultsDirectory()
          What are the build's junit test results stored? Can be a comma separated list
 boolean hasPassed(int returnCode, int buildNumber, java.lang.String planKey)
          Determines based on the return code and/or logs whether the build has passed.
 boolean hasTests()
          Does the build have any tests to be included in the build results web pages?
 boolean isCoverageHtmlEnabled()
           
 boolean isLogXmlEnabled()
           
 boolean isPathValid(java.lang.String path)
          Check for a full path to phpunit script
 void setArguments(java.lang.String arguments)
           
 void setCoverageHtmlDirectory(java.lang.String coverageHtmlDirectory)
           
 void setCoverageHtmlEnabled(boolean coverageHtmlEnabled)
           
 void setLogXmlEnabled(boolean logXmlEnabled)
           
 void setLogXmlFile(java.lang.String logXmlFile)
           
 void setParams(FilteredMap filteredBuilderParams)
          Updates the current builder object with
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 ErrorCollection validate(FilteredMap filteredParams)
          Validate that the goal has been defined
 
Methods inherited from class com.atlassian.bamboo.builder.AbstractBuilder
collateTestResults, customiseLabelTypeMap, customizeBuildRequirements, executeBuild, getBuildDir, getBuildDirectoryManager, getBuildJdk, getCompleteKey, getEditHtml, getEnvironmentVariables, getFilteredParams, getKey, getKeyPrefix, getLabel, getPath, getProjectFile, getTemplateContext, getTestChecked, getViewHtml, getWorkingDirectory, getWorkingSubDirectory, init, isJdkValid, isLabelPathMapConfigurable, outputEndsWith, populateBuildErrors, prepareConfigObject, removeBuildRequirements, runBuild, setAdministrationConfiguration, setBuildDir, setBuildDirectoryManager, setBuildJdk, setBuildLogFileAccessorFactory, setEnvironmentVariables, setErrorUpdateHandler, setHasTests, setJdkManager, setKey, setLabel, setProjectFile, setTemplateRenderer, setTestChecked, setTestResultsDirectory, setWorkingSubDirectory, toString, validate
 
Methods inherited from class com.atlassian.bamboo.command.Command
decorateCommandLine, getBuildLoggerManager, getCommandLine, getEnvironmentSetting, getSubstitutedCommandLine, getVariableSubstitutionBean, isWindowsPlatform, setBuildLoggerManager, setPluginAccessor, setVariableSubstitutionBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

PATHHELP

public static final java.lang.String PATHHELP
See Also:
Constant Field Values

BUILD_SUCCESSFUL_MARKER

protected static final java.lang.String BUILD_SUCCESSFUL_MARKER
See Also:
Constant Field Values

myTestDirectoryOption

protected java.lang.String myTestDirectoryOption

arguments

protected java.lang.String arguments

logXmlEnabled

protected boolean logXmlEnabled

logXmlFile

protected java.lang.String logXmlFile

coverageHtmlEnabled

protected boolean coverageHtmlEnabled

coverageHtmlDirectory

protected java.lang.String coverageHtmlDirectory

options

protected java.lang.String options
Constructor Detail

PhpUnitBuilder

public PhpUnitBuilder()
Method Detail

getCommandExecutable

@NotNull
public java.lang.String getCommandExecutable(ReadOnlyCapabilitySet capabilitySet)
What is the executable for the command line to execute

Overrides:
getCommandExecutable in class Command
Parameters:
capabilitySet - - for the current context
Returns:
the executable as a string

getCommandArguments

@NotNull
public java.lang.String[] getCommandArguments(ReadOnlyCapabilitySet capabilitySet)
What are the arguments for the command line to execute

Overrides:
getCommandArguments in class Command
Parameters:
capabilitySet - - for the current context
Returns:
the executable as a string[]. Spaces/division of strings in the array should not matter

validate

public ErrorCollection validate(FilteredMap filteredParams)
Validate that the goal has been defined

Specified by:
validate in class AbstractBuilder
Returns:
The collection of validation errors. An empty list if there are no errors

validate

@NotNull
public ErrorCollection validate(@NotNull
                                        BuildConfiguration buildConfiguration)
Description copied from interface: ConfigurablePlugin
Validates the properties in the BuildConfiguration object. The name of the properties match those passed in through the form fragments in ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) template.

Parameters:
buildConfiguration - - @NotNull
Returns:
ErrorCollection keyed by the field name. @NotNull

addDefaultValues

public void addDefaultValues(@NotNull
                             BuildConfiguration configuration)
Description copied from interface: ConfigurablePlugin
Extension point for adding default values to the form for ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)

Parameters:
configuration - - @NotNull

addDefaultLabelPathMaps

public java.util.Map<java.lang.String,LabelPathMap> addDefaultLabelPathMaps(java.util.Map<java.lang.String,LabelPathMap> labelPathMaps)
Returns:

hasPassed

public boolean hasPassed(int returnCode,
                         int buildNumber,
                         java.lang.String planKey)
Description copied from interface: BuilderV2
Determines based on the return code and/or logs whether the build has passed. Implementors should log how they came up with their conclusions -

Specified by:
hasPassed in interface BuilderV2
Overrides:
hasPassed in class AbstractBuilder
Parameters:
returnCode - return code from build execution command
planKey - @return true if build has passed

setParams

public void setParams(@NotNull
                      FilteredMap filteredBuilderParams)
Description copied from interface: Builder
Updates the current builder object with

Specified by:
setParams in interface Builder
Overrides:
setParams in class AbstractBuilder
Parameters:
filteredBuilderParams - - Filtered Map with the prefix builder key stripped out

getFullParams

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getFullParams()
Description copied from interface: Builder
Gets the full params that's used to persist.

Specified by:
getFullParams in interface Builder
Overrides:
getFullParams in class AbstractBuilder
Returns:
Map key by the full param key (e.g. builder.ant.label). Never null

executeCommand

public int executeCommand(@NotNull
                          BuildContext buildContext,
                          @NotNull
                          CommandExecuteStreamHandler commandExecuteStreamHandler,
                          java.lang.String extraEnvironmentVariables,
                          java.lang.String javaHome,
                          ReadOnlyCapabilitySet capabilitySet)
                   throws CommandException
Check if output directories for PHPUnit are created.

Overrides:
executeCommand in class Command
Parameters:
buildContext - The BuildContext for the current build
commandExecuteStreamHandler - Stream Handler for the output of the execute command
extraEnvironmentVariables - environment variable additional to those already in the env (e.g provided by the user via UI)
javaHome - The java home value for this command
capabilitySet - Capability set
Returns:
-1 if the command failed
Throws:
CommandException

hasTests

public boolean hasTests()
Description copied from class: AbstractBuilder
Does the build have any tests to be included in the build results web pages?

Specified by:
hasTests in interface Builder
Overrides:
hasTests in class AbstractBuilder
Returns:
true if the build should have tests.

getTestResultsDirectory

public java.lang.String getTestResultsDirectory()
Description copied from class: AbstractBuilder
What are the build's junit test results stored? Can be a comma separated list

Overrides:
getTestResultsDirectory in class AbstractBuilder
Returns:
Directory containing the Junit xml test files

isPathValid

public boolean isPathValid(java.lang.String path)
Check for a full path to phpunit script

Returns:
true if valid

getName

@NotNull
public java.lang.String getName()
Description copied from interface: Builder
Returns a human readable version of the current Builder type

Returns:

getCustomEnvironmentVars

protected java.lang.String[] getCustomEnvironmentVars(ReadOnlyCapabilitySet capabilitySet)
Overrides:
getCustomEnvironmentVars in class Command

getPathHelp

@NotNull
public java.lang.String getPathHelp()
Description copied from interface: Builder
Help text for the builder type

Specified by:
getPathHelp in interface Builder
Overrides:
getPathHelp in class AbstractBuilder
Returns:

setArguments

public void setArguments(java.lang.String arguments)

getArguments

public java.lang.String getArguments()

isLogXmlEnabled

public boolean isLogXmlEnabled()

setLogXmlEnabled

public void setLogXmlEnabled(boolean logXmlEnabled)

getLogXmlFile

public java.lang.String getLogXmlFile()

setLogXmlFile

public void setLogXmlFile(java.lang.String logXmlFile)

isCoverageHtmlEnabled

public boolean isCoverageHtmlEnabled()

setCoverageHtmlEnabled

public void setCoverageHtmlEnabled(boolean coverageHtmlEnabled)

getCoverageHtmlDirectory

public java.lang.String getCoverageHtmlDirectory()

setCoverageHtmlDirectory

public void setCoverageHtmlDirectory(java.lang.String coverageHtmlDirectory)


Copyright © 2010 Atlassian. All Rights Reserved.