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
* 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 spi.FileSystem, baseJavaFolderName string)
- func CaptureLog(fileSystem spi.FileSystem, logFileName string) error
- func Decrypt(secret string, encryptedText string) (string, error)
- func DeleteAllBearerTokenFiles(fileSystem spi.FileSystem, galasaHome spi.GalasaHome) error
- func Encrypt(secret string, textToEncrypt string) (string, error)
- func GetGalasaBootJarPath(fs spi.FileSystem, home spi.GalasaHome) (string, error)
- func InitialiseGalasaHomeFolder(home spi.GalasaHome, fileSystem spi.FileSystem, ...) error
- func InitialiseM2Folder(fileSystem spi.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem, ...) error
- func ListAllBearerTokenFiles(fileSystem spi.FileSystem, galasaHome spi.GalasaHome) ([]string, error)
- func NewEnvironment() spi.Environment
- func NewGalasaHome(fs spi.FileSystem, env spi.Environment, cmdFlagGalasaHome string) (spi.GalasaHome, error)
- func NewMockAuthenticator() spi.Authenticator
- func NewMockFinalWordHandler() spi.FinalWordHandler
- func NewMockTimeService() spi.TimeService
- func NewOverridableMockTimeService(now time.Time) spi.TimeService
- func NewRealTimeService() spi.TimeService
- func UppercaseFirstLetter(s string) string
- func ValidateJavaHome(fileSystem spi.FileSystem, javaHome string) error
- func ValidateJavaPackageName(javaPackageName string) error
- type BearerTokenFile
- type BearerTokenFileImpl
- type BearerTokenJson
- type BlankTemplateParameters
- type FileGenerator
- type GeneratedFileDef
- type JavaClassDef
- type MavenCoordinates
- type MockAuthenticator
- type MockConsole
- type MockEnv
- type MockFactory
- func (factory *MockFactory) GetAuthenticator(apiServerUrl string, galasaHome spi.GalasaHome) spi.Authenticator
- func (factory *MockFactory) GetEnvironment() spi.Environment
- func (factory *MockFactory) GetFileSystem() spi.FileSystem
- func (factory *MockFactory) GetFinalWordHandler() spi.FinalWordHandler
- func (factory *MockFactory) GetStdErrConsole() spi.Console
- func (factory *MockFactory) GetStdOutConsole() spi.Console
- func (factory *MockFactory) GetTimeService() spi.TimeService
- type MockFinalWordHandler
- type MockTimeService
- type OSEnvironment
- type RealConsole
- type RunsSubmitCmdValues
- type TestSelectionFlagValues
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 ( // The maximum value we can cope with for the encryption. // We hold all the data in memory so need to be defensive we don't try to encrypt too much. MAX_TEXT_TO_ENCRYPT = 2048 )
Variables ¶
This section is empty.
Functions ¶
func AddJavaRuntimeToMock ¶
func AddJavaRuntimeToMock(fileSystem spi.FileSystem, baseJavaFolderName string)
func CaptureLog ¶
func CaptureLog(fileSystem spi.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 DeleteAllBearerTokenFiles ¶ added in v0.34.0
func DeleteAllBearerTokenFiles(fileSystem spi.FileSystem, galasaHome spi.GalasaHome) error
func GetGalasaBootJarPath ¶
func GetGalasaBootJarPath(fs spi.FileSystem, home spi.GalasaHome) (string, error)
func InitialiseGalasaHomeFolder ¶
func InitialiseGalasaHomeFolder(home spi.GalasaHome, fileSystem spi.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem) error
func InitialiseM2Folder ¶
func InitialiseM2Folder(fileSystem spi.FileSystem, embeddedFileSystem embedded.ReadOnlyFileSystem, isDevelopment bool) error
func ListAllBearerTokenFiles ¶ added in v0.34.0
func ListAllBearerTokenFiles(fileSystem spi.FileSystem, galasaHome spi.GalasaHome) ([]string, error)
func NewEnvironment ¶
func NewEnvironment() spi.Environment
func NewGalasaHome ¶
func NewGalasaHome(fs spi.FileSystem, env spi.Environment, cmdFlagGalasaHome string) (spi.GalasaHome, error)
func NewMockAuthenticator ¶ added in v0.34.0
func NewMockAuthenticator() spi.Authenticator
func NewMockFinalWordHandler ¶ added in v0.34.0
func NewMockFinalWordHandler() spi.FinalWordHandler
func NewMockTimeService ¶
func NewMockTimeService() spi.TimeService
func NewOverridableMockTimeService ¶
func NewOverridableMockTimeService(now time.Time) spi.TimeService
func NewRealTimeService ¶
func NewRealTimeService() spi.TimeService
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 spi.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.
Types ¶
type BearerTokenFile ¶ added in v0.34.0
type BearerTokenFile interface {
WriteJwt(jwt string, encryptionSecret string) error
ReadJwt(encryptionSecret string) (string, error)
DeleteJwt() error
Exists() (bool, error)
}
func NewBearerTokenFile ¶ added in v0.34.0
func NewBearerTokenFile( fileSystem spi.FileSystem, galasaHome spi.GalasaHome, baseFileName string, timeService spi.TimeService, ) BearerTokenFile
type BearerTokenFileImpl ¶ added in v0.34.0
type BearerTokenFileImpl struct {
// contains filtered or unexported fields
}
func (*BearerTokenFileImpl) DeleteJwt ¶ added in v0.34.0
func (file *BearerTokenFileImpl) DeleteJwt() error
func (*BearerTokenFileImpl) Exists ¶ added in v0.34.0
func (file *BearerTokenFileImpl) Exists() (bool, error)
type BearerTokenJson ¶ added in v0.33.0
type BearerTokenJson struct {
Jwt string `json:"jwt"`
}
type BlankTemplateParameters ¶
type BlankTemplateParameters struct{}
type FileGenerator ¶
type FileGenerator struct {
// contains filtered or unexported fields
}
func NewFileGenerator ¶
func NewFileGenerator(fileSystem spi.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 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 MockAuthenticator ¶ added in v0.34.0
type MockAuthenticator struct {
}
func (*MockAuthenticator) GetAuthenticatedAPIClient ¶ added in v0.34.0
func (authenticator *MockAuthenticator) GetAuthenticatedAPIClient() (*galasaapi.APIClient, error)
Gets a new authenticated API client, attempting to log in if a bearer token file does not exist
func (*MockAuthenticator) GetBearerToken ¶ added in v0.34.0
func (authenticator *MockAuthenticator) GetBearerToken() (string, error)
func (*MockAuthenticator) Login ¶ added in v0.34.0
func (authenticator *MockAuthenticator) Login() error
Login - performs all the logic to implement the `galasactl auth login` command
func (*MockAuthenticator) LogoutOfEverywhere ¶ added in v0.34.0
func (authenticator *MockAuthenticator) LogoutOfEverywhere() error
Login - performs all the logic to implement the `galasactl auth login` command
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 MockFactory ¶ added in v0.34.0
type MockFactory struct {
FinalWordHandler spi.FinalWordHandler
FileSystem spi.FileSystem
Env spi.Environment
StdOutConsole spi.Console
StdErrConsole spi.Console
TimeService spi.TimeService
Authenticator spi.Authenticator
}
func NewMockFactory ¶ added in v0.34.0
func NewMockFactory() *MockFactory
func (*MockFactory) GetAuthenticator ¶ added in v0.34.0
func (factory *MockFactory) GetAuthenticator(apiServerUrl string, galasaHome spi.GalasaHome) spi.Authenticator
func (*MockFactory) GetEnvironment ¶ added in v0.34.0
func (factory *MockFactory) GetEnvironment() spi.Environment
func (*MockFactory) GetFileSystem ¶ added in v0.34.0
func (factory *MockFactory) GetFileSystem() spi.FileSystem
func (*MockFactory) GetFinalWordHandler ¶ added in v0.34.0
func (factory *MockFactory) GetFinalWordHandler() spi.FinalWordHandler
func (*MockFactory) GetStdErrConsole ¶ added in v0.34.0
func (factory *MockFactory) GetStdErrConsole() spi.Console
func (*MockFactory) GetStdOutConsole ¶ added in v0.34.0
func (factory *MockFactory) GetStdOutConsole() spi.Console
func (*MockFactory) GetTimeService ¶ added in v0.34.0
func (factory *MockFactory) GetTimeService() spi.TimeService
type MockFinalWordHandler ¶ added in v0.34.0
type MockFinalWordHandler struct {
ReportedObject interface{}
}
func (*MockFinalWordHandler) FinalWord ¶ added in v0.34.0
func (handler *MockFinalWordHandler) FinalWord(rootCmd spi.GalasaCommand, errorToExctractFrom interface{})
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.
Source Files
¶
- authenticatorMock.go
- bearerTokenFile.go
- console.go
- crypto.go
- env.go
- envMock.go
- factoryMock.go
- fileGenerator.go
- finalWordHandlerMock.go
- galasaHome.go
- homeFolderCreator.go
- java.go
- javaPacakageName.go
- java_testUtils.go
- logRedirector.go
- m2FolderCreator.go
- maven.go
- runSubmitCmdValues.go
- testSelectionValues.go
- timeService.go
- timeServiceMock.go