Skip to content

Commit

Permalink
Merge pull request #219 from galasa-dev/mcobbett-deploy-test-catalog
Browse files Browse the repository at this point in the history
generate pom.xml capable of deploying a test catalog
  • Loading branch information
techcobweb authored Mar 8, 2024
2 parents 13206b2 + 1fc75af commit 8c3830a
Show file tree
Hide file tree
Showing 36 changed files with 542 additions and 392 deletions.
2 changes: 1 addition & 1 deletion docs/generated/galasactl_properties_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ galasactl properties set [flags]
-h, --help Displays the options for the 'properties set' command.
-n, --name string A mandatory field indicating the name of a property in the namespace.The first character of the name must be in the 'a'-'z' or 'A'-'Z' ranges, and following characters can be 'a'-'z', 'A'-'Z', '0'-'9', '.' (period), '-' (dash) or '_' (underscore)
-s, --namespace string A mandatory flag that describes the container for a collection of properties.The first character of the namespace must be in the 'a'-'z' range, and following characters can be 'a'-'z' or '0'-'9'
--value string A mandatory flag indicating the value of the property you want to create. Empty values and values with spaces must be put in quotation marks().
--value string A mandatory flag indicating the value of the property you want to create. Empty values and values with spaces must be put in quotation marks.
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/authLogin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAuthLoginHelpFlagSetCorrectly(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'auth login' command.", "", "", factory, t)
checkOutput("Displays the options for the 'auth login' command.", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -55,5 +55,5 @@ func TestAuthLoginNoFlagsReturnsOk(t *testing.T) {
assert.Nil(t, err)

// Check what the user saw is reasonable.
checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)
}
11 changes: 5 additions & 6 deletions pkg/cmd/authLogout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ func TestAuthogoutCommandInCommandCollectionHasName(t *testing.T) {

authLogoutommand, err := commands.GetCommand(COMMAND_NAME_AUTH_LOGOUT)
assert.Nil(t, err)

assert.NotNil(t, authLogoutommand)
assert.Equal(t, COMMAND_NAME_AUTH_LOGOUT, authLogoutommand.Name())
assert.Nil(t, authLogoutommand.Values())
assert.NotNil(t, authLogoutommand.CobraCommand())
}


func TestAuthLogoutHelpFlagSetCorrectly(t *testing.T) {
// Given...
factory := NewMockFactory()

var args []string = []string{"auth", "logout", "--help"}

// When...
Expand All @@ -38,7 +37,7 @@ func TestAuthLogoutHelpFlagSetCorrectly(t *testing.T) {
// Then...

// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'auth logout' command.", "", "", factory, t)
checkOutput("Displays the options for the 'auth logout' command.", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -53,7 +52,7 @@ func TestAuthLogoutNoFlagsExecutesOk(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Nil(t, err)
}
}
12 changes: 5 additions & 7 deletions pkg/cmd/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package cmd

import (
"testing"
"github.com/stretchr/testify/assert"
"testing"
)

func TestAuthCommandInCommandCollection(t *testing.T) {
Expand All @@ -17,15 +17,13 @@ func TestAuthCommandInCommandCollection(t *testing.T) {

authCommand, err := commands.GetCommand(COMMAND_NAME_AUTH)
assert.Nil(t, err)

assert.NotNil(t, authCommand)
assert.Equal(t, COMMAND_NAME_AUTH, authCommand.Name())
assert.Nil(t, authCommand.Values())
assert.NotNil(t, authCommand.CobraCommand())
}



func TestAuthHelpFlagSetCorrectly(t *testing.T) {
// Given...
factory := NewMockFactory()
Expand All @@ -37,7 +35,7 @@ func TestAuthHelpFlagSetCorrectly(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'auth' command.", "", "", factory, t)
checkOutput("Displays the options for the 'auth' command.", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -53,7 +51,7 @@ func TestAuthNoCommandsProducesUsageReport(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("Usage:\n galasactl auth [command]", "", "", factory, t)
checkOutput("Usage:\n galasactl auth [command]", "", factory, t)

assert.Nil(t, err)
}
}
8 changes: 4 additions & 4 deletions pkg/cmd/localInit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestCommandCollectionContainsLocalInitCommand(t *testing.T) {
commands, _ := NewCommandCollection(factory)
localInitCommand, err := commands.GetCommand(COMMAND_NAME_LOCAL_INIT)
assert.Nil(t, err)

assert.NotNil(t, localInitCommand)
assert.Equal(t, COMMAND_NAME_LOCAL_INIT, localInitCommand.Name())
assert.NotNil(t, localInitCommand.Values())
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestLocalInitHelpFlagSetCorrectly(t *testing.T) {
// Then...

// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'local init' command.", "", "", factory, t)
checkOutput("Displays the options for the 'local init' command.", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -174,7 +174,7 @@ func TestLocalInitNoFlagsReturnsNoError(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Nil(t, err)
}
}
6 changes: 3 additions & 3 deletions pkg/cmd/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestLocalHelpFlagSetCorrectly(t *testing.T) {

// Then...
// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'local' command", "", "", factory, t)
checkOutput("Displays the options for the 'local' command", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -54,5 +54,5 @@ func TestLocalNoCommandsProducesUsageReport(t *testing.T) {
assert.Nil(t, err)

// Check what the user saw was reasonable
checkOutput("Usage:\n galasactl local [command]", "", "", factory, t)
}
checkOutput("Usage:\n galasactl local [command]", "", factory, t)
}
10 changes: 5 additions & 5 deletions pkg/cmd/projectCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ func (cmd *ProjectCreateCommand) init(factory Factory, projectCmd GalasaCommand,
}

func (cmd *ProjectCreateCommand) createCobraCommand(
factory Factory,
projectCmd GalasaCommand,
factory Factory,
projectCmd GalasaCommand,
rootCmd GalasaCommand,
) (*cobra.Command, error) {
) (*cobra.Command, error) {

var err error = nil

Expand Down Expand Up @@ -476,7 +476,7 @@ func createTestProject(
}

if err == nil {
err = createTestResourceFolder(fileGenerator, targetFolderPath, packageName, forceOverwrite)
err = createTestResourceFolder(fileGenerator, targetFolderPath, forceOverwrite)
}

if err == nil {
Expand Down Expand Up @@ -541,7 +541,7 @@ func createJavaSourceFolder(fileGenerator *utils.FileGenerator, testFolderPath s

func createTestResourceFolder(
fileGenerator *utils.FileGenerator, targetSrcFolderPath string,
packageName string, forceOverwrite bool) error {
forceOverwrite bool) error {

var err error

Expand Down
37 changes: 18 additions & 19 deletions pkg/cmd/projectCreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func TestCreateProjectUsingCommandLineNoPackageSet(t *testing.T) {
assert.NotNil(t, err)

// Check what the user saw is reasonable.
checkOutput("", "Error: required flag(s) \"package\" not set", "", factory, t)
checkOutput("", "Error: required flag(s) \"package\" not set", factory, t)
}

func TestCreateProjectUsingCommandLineNoFeaturesSetWorks(t *testing.T) {
Expand All @@ -596,7 +596,7 @@ func TestCreateProjectUsingCommandLineNoFeaturesSetWorks(t *testing.T) {
fmt.Printf("error returned by Execute method: %v\n", err)

// Check what the user saw no output
checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

// Check that the default folder was created.
fs := factory.GetFileSystem()
Expand All @@ -619,7 +619,7 @@ func TestCreateProjectUsingCommandLineNoMavenNorGradleFails(t *testing.T) {
// Then...

// Check what the user saw is reasonable.
checkOutput("", "Error: GAL1089E: Need to use --maven and/or --gradle parameter", "", factory, t)
checkOutput("", "Error: GAL1089E: Need to use --maven and/or --gradle parameter", factory, t)

assert.NotNil(t, err)
assert.Contains(t, err.Error(), "GAL1089E:")
Expand All @@ -633,18 +633,17 @@ func TestCommandsCollectionContainsProjectCreateCommand(t *testing.T) {
commands, _ := NewCommandCollection(factory)
projectCreateCommand, err := commands.GetCommand(COMMAND_NAME_PROJECT_CREATE)
assert.Nil(t, err)

assert.NotNil(t, projectCreateCommand)
assert.IsType(t, &ProjectCreateCmdValues{}, projectCreateCommand.Values())
assert.NotNil(t, projectCreateCommand.CobraCommand())
assert.Equal(t, COMMAND_NAME_PROJECT_CREATE, projectCreateCommand.Name())
}


func TestProjectCreateHelpFlagSetCorrectly(t *testing.T) {
// Given...
factory := NewMockFactory()

var args []string = []string{"project", "create", "--help"}

// When...
Expand All @@ -654,7 +653,7 @@ func TestProjectCreateHelpFlagSetCorrectly(t *testing.T) {
assert.Nil(t, err)

// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'project create' command", "", "", factory, t)
checkOutput("Displays the options for the 'project create' command", "", factory, t)
}

func TestProjectCreateNoFlagReturnsError(t *testing.T) {
Expand All @@ -672,7 +671,7 @@ func TestProjectCreateNoFlagReturnsError(t *testing.T) {
assert.Contains(t, err.Error(), "required flag(s) \"package\" not set")

// Check what the user saw is reasonable.
checkOutput("", "required flag(s) \"package\" not set", "", factory, t)
checkOutput("", "required flag(s) \"package\" not set", factory, t)
}

func TestProjectCreatePackageFlagReturnsNoError(t *testing.T) {
Expand All @@ -688,8 +687,8 @@ func TestProjectCreatePackageFlagReturnsNoError(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
}

Expand All @@ -707,7 +706,7 @@ func TestProjectCreatePackageFlagNoPackageReturnsError(t *testing.T) {
assert.NotNil(t, err)
assert.Contains(t, err.Error(), "flag needs an argument: --package")

checkOutput("", "flag needs an argument: --package", "", factory, t)
checkOutput("", "flag needs an argument: --package", factory, t)
}

func TestProjectCreatePackageAndFeatureFlagsReturnsOk(t *testing.T) {
Expand All @@ -723,7 +722,7 @@ func TestProjectCreatePackageAndFeatureFlagsReturnsOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).featureNamesCommaSeparated, "comma,seperated,test,list")
Expand All @@ -742,8 +741,8 @@ func TestProjectCreatePackageAndForceFlagsReturnsNoOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).force, true)
}
Expand All @@ -761,7 +760,7 @@ func TestProjectCreatePackageAndObrFlagsReturnsNoOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).isOBRProjectRequired, true)
Expand All @@ -780,7 +779,7 @@ func TestProjectCreatePackageAndMavenFlagsReturnsNoOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).useMaven, true)
Expand All @@ -799,7 +798,7 @@ func TestProjectCreatePackageAndGradleFlagsReturnsNoOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).useGradle, true)
Expand All @@ -818,12 +817,12 @@ func TestProjectCreateAllFlagsReturnsNoOk(t *testing.T) {
// Then...
assert.Nil(t, err)

checkOutput("", "", "", factory, t)
checkOutput("", "", factory, t)

assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).packageName, "package.name")
assert.Contains(t, cmd.Values().(*ProjectCreateCmdValues).featureNamesCommaSeparated, "feature,list")
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).force, true)
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).isOBRProjectRequired, true)
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).useMaven, true)
assert.Equal(t, cmd.Values().(*ProjectCreateCmdValues).useGradle, true)
}
}
8 changes: 4 additions & 4 deletions pkg/cmd/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func TestCommandListContainsProjectCommand(t *testing.T) {
func TestProjectHelpFlagSetCorrectly(t *testing.T) {
// Given...
factory := NewMockFactory()

var args []string = []string{"project", "--help"}

// When...
err := Execute(factory, args)

// Then...
// Check what the user saw is reasonable.
checkOutput("Displays the options for the 'project' command.", "", "", factory, t)
checkOutput("Displays the options for the 'project' command.", "", factory, t)

assert.Nil(t, err)
}
Expand All @@ -54,5 +54,5 @@ func TestProjectNoCommandsProducesUsageReport(t *testing.T) {
assert.Nil(t, err)

// Check what the user saw was reasonable
checkOutput("Usage:\n galasactl project [command]", "", "", factory, t)
}
checkOutput("Usage:\n galasactl project [command]", "", factory, t)
}
Loading

0 comments on commit 8c3830a

Please sign in to comment.