diff --git a/lfr/pkg/generate/docker/docker_test.go b/lfr/pkg/generate/docker/docker_test.go index 1435b15..2912c76 100644 --- a/lfr/pkg/generate/docker/docker_test.go +++ b/lfr/pkg/generate/docker/docker_test.go @@ -1,17 +1,18 @@ package docker import ( - "github.com/lgdd/liferay-cli/lfr/pkg/generate/workspace" - "github.com/lgdd/liferay-cli/lfr/pkg/project" "os" "path/filepath" "strings" "testing" + + "github.com/lgdd/liferay-cli/lfr/pkg/generate/workspace" + "github.com/lgdd/liferay-cli/lfr/pkg/project" ) func Test_GenerateDocker_ShouldCreateDockerfileAndCompose(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -29,7 +30,7 @@ func Test_GenerateDocker_ShouldCreateDockerfileAndCompose(t *testing.T) { func Test_GenerateDocker_WithMultiStageAndGradle_ShouldContainExpectedStages(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -52,7 +53,7 @@ func Test_GenerateDocker_WithMultiStageAndGradle_ShouldContainExpectedStages(t * func Test_GenerateDocker_WithMultiStageAndMaven_ShouldContainExpectedStages(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Maven, "7.3") + err := workspace.Generate(liferayWorkspace, project.Maven, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -75,7 +76,7 @@ func Test_GenerateDocker_WithMultiStageAndMaven_ShouldContainExpectedStages(t *t func Test_GenerateDocker_WithWrongJavaVersion_ShouldFail(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3", "portal") if err != nil { t.Fatal(err) } diff --git a/lfr/pkg/generate/sb/service_builder_test.go b/lfr/pkg/generate/sb/service_builder_test.go index 3c0b028..a9d0e8a 100644 --- a/lfr/pkg/generate/sb/service_builder_test.go +++ b/lfr/pkg/generate/sb/service_builder_test.go @@ -14,7 +14,7 @@ import ( func Test_GenerateServiceBuilder_WithGradle_ShouldCreateExpectedFiles(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -41,7 +41,7 @@ func Test_GenerateServiceBuilder_WithGradle_ShouldCreateExpectedFiles(t *testing func Test_GenerateServiceBuilder_WithMaven_ShouldCreateExpectedFiles(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Maven, "7.3") + err := workspace.Generate(liferayWorkspace, project.Maven, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -97,7 +97,7 @@ func Test_GenerateServiceBuilder_WithMaven_ShouldCreateExpectedFiles(t *testing. func Test_GenerateServiceBuilder_With73_ShouldContainCorrespondingDoctype(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.3", "portal") if err != nil { t.Fatal(err) } @@ -118,7 +118,7 @@ func Test_GenerateServiceBuilder_With73_ShouldContainCorrespondingDoctype(t *tes func Test_GenerateServiceBuilder_With72_ShouldContainCorrespondingDoctype(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.2") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.2", "portal") if err != nil { t.Fatal(err) } @@ -139,7 +139,7 @@ func Test_GenerateServiceBuilder_With72_ShouldContainCorrespondingDoctype(t *tes func Test_GenerateServiceBuilder_With71_ShouldContainCorrespondingDoctype(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.1") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.1", "portal") if err != nil { t.Fatal(err) } @@ -160,7 +160,7 @@ func Test_GenerateServiceBuilder_With71_ShouldContainCorrespondingDoctype(t *tes func Test_GenerateServiceBuilder_With70_ShouldContainCorrespondingDoctype(t *testing.T) { liferayWorkspace := filepath.Join(t.TempDir(), "liferay-workspace") - err := workspace.Generate(liferayWorkspace, project.Gradle, "7.0") + err := workspace.Generate(liferayWorkspace, project.Gradle, "7.0", "portal") if err != nil { t.Fatal(err) } diff --git a/lfr/pkg/generate/workspace/workspace_test.go b/lfr/pkg/generate/workspace/workspace_test.go index e880776..72b2f93 100644 --- a/lfr/pkg/generate/workspace/workspace_test.go +++ b/lfr/pkg/generate/workspace/workspace_test.go @@ -11,7 +11,7 @@ import ( func TestGenerate_Gradle_ShouldHaveExpectedFiles(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") - err := Generate(workspaceDir, "gradle", "7.3") + err := Generate(workspaceDir, "gradle", "7.3", "portal") if err != nil { t.Fatal(err) @@ -46,7 +46,7 @@ func TestGenerate_Gradle_ShouldHaveExpectedFiles(t *testing.T) { t.Fatal(err) } - metadata, err := project.NewMetadata(workspaceDir, "7.3") + metadata, err := project.NewMetadata(workspaceDir, "7.3", "portal") if err != nil { t.Fatal(err) @@ -74,7 +74,7 @@ func TestGenerate_Gradle_ShouldHaveExpectedFiles(t *testing.T) { func TestGenerate_Maven_ShouldHaveExpectedFiles(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") - err := Generate(workspaceDir, "maven", "7.3") + err := Generate(workspaceDir, "maven", "7.3", "portal") defer t.Cleanup(func() { err = os.RemoveAll(workspaceDir) @@ -114,7 +114,7 @@ func TestGenerate_Maven_ShouldHaveExpectedFiles(t *testing.T) { t.Fatal(err) } - metadata, err := project.NewMetadata(workspaceDir, "7.3") + metadata, err := project.NewMetadata(workspaceDir, "7.3", "portal") if err != nil { t.Fatal(err) @@ -219,7 +219,7 @@ func TestGenerate_Maven_ShouldHaveExpectedFiles(t *testing.T) { func TestGenerateWorkspace_WithWrongVersion_ShouldFail(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") - err := Generate(workspaceDir, "gradle", "6.2") + err := Generate(workspaceDir, "gradle", "6.2", "portal") if err == nil { t.Fatal("workspace with wrong version should fail") @@ -234,7 +234,7 @@ func TestGenerateWorkspace_WithWrongVersion_ShouldFail(t *testing.T) { func TestGenerateWorkspace_WithWrongBuildTool_ShouldFail(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") - err := Generate(workspaceDir, "ant", "7.3") + err := Generate(workspaceDir, "ant", "7.3", "portal") if err == nil { t.Fatal("workspace with wrong build tool should fail") @@ -250,7 +250,7 @@ func TestGenerateWorkspace_WithWrongBuildTool_ShouldFail(t *testing.T) { func TestGenerateWorkspace_WithMaven_ShouldHaveDefaultPackageName(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") project.PackageName = "org.acme" - err := Generate(workspaceDir, "maven", "7.3") + err := Generate(workspaceDir, "maven", "7.3", "portal") if err != nil { t.Fatal(err) } @@ -266,7 +266,7 @@ func TestGenerateWorkspace_WithMaven_ShouldHaveDefaultPackageName(t *testing.T) func TestGenerateWorkspace_WithGradle_ShouldHaveDefaultPackageName(t *testing.T) { workspaceDir := filepath.Join(t.TempDir(), "liferay-workspace") project.PackageName = "org.acme" - err := Generate(workspaceDir, "gradle", "7.3") + err := Generate(workspaceDir, "gradle", "7.3", "portal") if err != nil { t.Fatal(err) }