Documentation ¶
Overview ¶
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0
Index ¶
- Constants
- func AddJavaRuntimeToMock(fileSystem files.FileSystem, baseJavaFolderName string)
- func CaptureLog(fileSystem files.FileSystem, logFileName string) error
- func GetBearerTokenFromTokenJsonFile(fileSystem files.FileSystem, galasaHome GalasaHome, timeService TimeService) (string, error)
- func GetGalasaBootJarPath(fs files.FileSystem, home GalasaHome) (string, error)
- func InitialiseGalasaHomeFolder(home GalasaHome, fileSystem files.FileSystem, ...) error
- func InitialiseM2Folder(fileSystem files.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem, ...) error
- func IsBearerTokenValid(bearerTokenString string, timeService TimeService) bool
- func UppercaseFirstLetter(s string) string
- func ValidateJavaHome(fileSystem files.FileSystem, javaHome string) error
- func ValidateJavaPackageName(javaPackageName string) error
- func WriteBearerTokenJsonFile(fileSystem files.FileSystem, galasaHome GalasaHome, jwt string) error
- type BearerTokenJson
- type BlankTemplateParameters
- type Console
- type Environment
- type FileGenerator
- type GalasaHome
- type GeneratedFileDef
- type JavaClassDef
- type MavenCoordinates
- type MockConsole
- type MockEnv
- type MockTimeService
- type OSEnvironment
- type RealConsole
- type RunsSubmitCmdValues
- type TestSelectionFlagValues
- type TimeService
Constants ¶
const ( LOWER_CASE_LETTERS = "abcdefghijklmnopqrstuvwxyz" DIGITS = "0123456789" SEPARATOR = "." )
const ( MAVEN_REPO_URL_GALASA_BLEEDING_EDGE = "https://development.galasa.dev/main/maven-repo/obr" MAVEN_REPO_URL_MAVEN_CENTRAL = "https://repo.maven.apache.org/maven2" )
const ( SECONDS_BETWEEN_INTERRUPTED_CHECKS = 3 DURATION_BETWEEN_INTERRUPTED_CHECKS = SECONDS_BETWEEN_INTERRUPTED_CHECKS * time.Second )
const (
TOKEN_EXPIRY_BUFFER_MINUTES = 10
)
Variables ¶
This section is empty.
Functions ¶
func AddJavaRuntimeToMock ¶
func AddJavaRuntimeToMock(fileSystem files.FileSystem, baseJavaFolderName string)
func CaptureLog ¶
func CaptureLog(fileSystem files.FileSystem, logFileName string) error
* CaptureLog(logFileName) decides whether to re-direct the log information to the * specified file, or if the file name is "-" or empty, the log information won't be * re-directed, but will appear on stderr.
func GetBearerTokenFromTokenJsonFile ¶ added in v0.33.0
func GetBearerTokenFromTokenJsonFile(fileSystem files.FileSystem, galasaHome GalasaHome, timeService TimeService) (string, error)
Gets the JWT from the bearer-token.json file if it exists, errors if the file does not exist or if the token is invalid
func GetGalasaBootJarPath ¶
func GetGalasaBootJarPath(fs files.FileSystem, home GalasaHome) (string, error)
func InitialiseGalasaHomeFolder ¶
func InitialiseGalasaHomeFolder(home GalasaHome, fileSystem files.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem) error
func InitialiseM2Folder ¶
func InitialiseM2Folder(fileSystem files.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem, isDevelopment bool) error
func IsBearerTokenValid ¶ added in v0.33.0
func IsBearerTokenValid(bearerTokenString string, timeService TimeService) bool
Checks whether a given bearer token is valid or not, returning true if it is valid and false otherwise
func UppercaseFirstLetter ¶
UppercaseFirstLetter - takes a string and returns the same string, but with the first letter turned into an uppercase letter.
func ValidateJavaHome ¶
func ValidateJavaHome(fileSystem files.FileSystem, javaHome string) error
validateJavaHome validate that JAVA_HOME is set correctly. If $JAVA_HOME ends with a '/' (or '\' for windows, the trailing slash is removed before checks are made.
Constraints: - It must be set. - JAVA_HOME/bin must be a folder which exists. - JAVA_HOME/bin/java must exist as a file.
func ValidateJavaPackageName ¶
To validate the string as a valid java package name before we start to use it.
func WriteBearerTokenJsonFile ¶ added in v0.33.0
func WriteBearerTokenJsonFile(fileSystem files.FileSystem, galasaHome GalasaHome, jwt string) error
Writes a new bearer-token.json file containing a JWT in the following format:
{ "jwt": "<bearer-token-here>" }
Types ¶
type BearerTokenJson ¶ added in v0.33.0
type BearerTokenJson struct {
Jwt string `json:"jwt"`
}
type BlankTemplateParameters ¶
type BlankTemplateParameters struct{}
type Console ¶
------------------------------------------------- A console where things can be written to so the user can see them.
type Environment ¶
Environment is a thin interface layer above the os package which can be mocked out
func NewEnvironment ¶
func NewEnvironment() Environment
type FileGenerator ¶
type FileGenerator struct {
// contains filtered or unexported fields
}
func NewFileGenerator ¶
func NewFileGenerator(fileSystem files.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem) *FileGenerator
func (*FileGenerator) CreateFile ¶
func (generator *FileGenerator) CreateFile( generatedFile GeneratedFileDef, forceOverwrite bool, isExistsAnError bool) error
createFile creates a file on the file system. If forceOverwrite is false, and there is already a file there, then an error will occur.
func (*FileGenerator) CreateFolder ¶
func (generator *FileGenerator) CreateFolder(targetFolderPath string) error
type GalasaHome ¶
func NewGalasaHome ¶
func NewGalasaHome(fs files.FileSystem, env Environment, cmdFlagGalasaHome string) (GalasaHome, error)
type GeneratedFileDef ¶
type JavaClassDef ¶
type MavenCoordinates ¶
func ValidateObr ¶
func ValidateObr(obr string) (MavenCoordinates, error)
We expect a parameter to be of the form: mvn:dev.galasa.example.banking/dev.galasa.example.banking.obr/0.0.1-SNAPSHOT/obr Validate that the --obr parameter or portfolio field passed by the user conform to this convention by splitting the input into pieces.
func ValidateObrs ¶
func ValidateObrs(obrInputs []string) ([]MavenCoordinates, error)
We expect a parameter to be of the form: mvn:dev.galasa.example.banking/dev.galasa.example.banking.obr/0.0.1-SNAPSHOT/obr Validate that the --obr parameter or portfolio field passed by the user conform to this convention by splitting the input into pieces.
type MockConsole ¶
type MockConsole struct {
// contains filtered or unexported fields
}
------------------------------------------------- A mock implementation which writes text to a buffer Useful for unit testing.
func NewMockConsole ¶
func NewMockConsole() *MockConsole
func (*MockConsole) ReadText ¶
func (data *MockConsole) ReadText() string
func (*MockConsole) WriteString ¶
func (this *MockConsole) WriteString(text string) error
type MockEnv ¶
func NewMockEnv ¶
func NewMockEnv() *MockEnv
func (*MockEnv) GetUserName ¶
func (*MockEnv) SetUserName ¶
type MockTimeService ¶
func NewMockTimeServiceAsMock ¶
func NewMockTimeServiceAsMock(now time.Time) *MockTimeService
func (*MockTimeService) Interrupt ¶
func (ts *MockTimeService) Interrupt(message string)
func (*MockTimeService) Now ¶
func (ts *MockTimeService) Now() time.Time
func (*MockTimeService) Sleep ¶
func (ts *MockTimeService) Sleep(duration time.Duration)
type OSEnvironment ¶
type OSEnvironment struct { }
func NewOSEnvironment ¶
func NewOSEnvironment() *OSEnvironment
NewOSEnvironment creates a real wrapper over the os environment
func (OSEnvironment) GetEnv ¶
func (osEnv OSEnvironment) GetEnv(propertyName string) string
func (OSEnvironment) GetUserName ¶
func (osEnv OSEnvironment) GetUserName() (string, error)
type RealConsole ¶
type RealConsole struct { }
------------------------------------------------- A real implementation which writes text to stdout.
func NewRealConsole ¶
func NewRealConsole() *RealConsole
func (*RealConsole) WriteString ¶
func (*RealConsole) WriteString(text string) error
type RunsSubmitCmdValues ¶
type RunsSubmitCmdValues struct { PollIntervalSeconds int NoExitCodeOnTestFailures bool ReportYamlFilename string ReportJsonFilename string ReportJunitFilename string GroupName string ProgressReportIntervalMinutes int Throttle int Overrides []string Trace bool Requestor string RequestType string ThrottleFileName string PortfolioFileName string OverrideFilePath string TestSelectionFlagValues *TestSelectionFlagValues }
RunsSubmitCmdParameters - Holds variables set by cobra's command-line parsing. We collect the parameters here so that our unit tests can feed in different values easily.
type TestSelectionFlagValues ¶
type TimeService ¶
type TimeService interface { Sleep(duration time.Duration) Now() time.Time Interrupt(message string) }
func NewMockTimeService ¶
func NewMockTimeService() TimeService
func NewOverridableMockTimeService ¶
func NewOverridableMockTimeService(now time.Time) TimeService
func NewRealTimeService ¶
func NewRealTimeService() TimeService