diff --git a/src/InitializrApi.Config/UiConfig.cs b/src/InitializrApi.Config/UiConfig.cs index 79cfe79..07c89e1 100644 --- a/src/InitializrApi.Config/UiConfig.cs +++ b/src/InitializrApi.Config/UiConfig.cs @@ -18,11 +18,6 @@ namespace Steeltoe.InitializrApi.Config /// public Text Name { get; set; } - /// - /// Gets or sets the project application name. - /// - public Text ApplicationName { get; set; } - /// /// Gets or sets the project namespace. /// @@ -43,11 +38,6 @@ namespace Steeltoe.InitializrApi.Config /// public SingleSelectList DotNetFramework { get; set; } - /// - /// Gets or sets the DotNet template. - /// - public SingleSelectList DotNetTemplate { get; set; } - /// /// Gets or sets the programming language. /// diff --git a/src/InitializrApi/Controllers/ProjectController.cs b/src/InitializrApi/Controllers/ProjectController.cs index 99454c8..25989bc 100644 --- a/src/InitializrApi/Controllers/ProjectController.cs +++ b/src/InitializrApi/Controllers/ProjectController.cs @@ -65,7 +65,7 @@ namespace Steeltoe.InitializrApi.Controllers var normalizedSpec = new ProjectSpec() { Name = spec.Name ?? defaults?.Name?.Default, - Application = spec.Application ?? defaults?.Namespace?.Default, + Namespace = spec.Namespace ?? defaults?.Namespace?.Default, Description = spec.Description ?? defaults?.Description?.Default, SteeltoeVersion = spec.SteeltoeVersion ?? defaults?.SteeltoeVersion?.Default, DotNetFramework = spec.DotNetFramework ?? defaults?.DotNetFramework?.Default, diff --git a/src/InitializrApi/Controllers/RootController.cs b/src/InitializrApi/Controllers/RootController.cs index 85213a8..83ed247 100644 --- a/src/InitializrApi/Controllers/RootController.cs +++ b/src/InitializrApi/Controllers/RootController.cs @@ -88,12 +88,10 @@ namespace Steeltoe.InitializrApi.Controllers { new () { "Parameter", "Description", "Default value" }, new () { "name", "project name", uiConfig.Name.Default }, - new () { "applicationName", "application name", uiConfig.ApplicationName.Default }, new () { "namespace", "namespace", uiConfig.Namespace.Default }, new () { "description", "project description", uiConfig.Description.Default }, new () { "steeltoeVersion", "Steeltoe version", uiConfig.SteeltoeVersion.Default }, new () { "dotNetFramework", "target .NET framework", uiConfig.DotNetFramework.Default }, - new () { "dotNetTemplate", ".NET template", uiConfig.DotNetTemplate.Default }, new () { "language", "programming language", uiConfig.Language.Default }, new () { "packaging", "project packaging", uiConfig.Packaging.Default }, }; diff --git a/src/InitializrApi/Controllers/UiConfigController.cs b/src/InitializrApi/Controllers/UiConfigController.cs index ae1bbaf..ffdc05a 100644 --- a/src/InitializrApi/Controllers/UiConfigController.cs +++ b/src/InitializrApi/Controllers/UiConfigController.cs @@ -74,17 +74,6 @@ namespace Steeltoe.InitializrApi.Controllers return Ok(_uiConfigService.UiConfig.DotNetFramework.Values); } - /// - /// Implements GET dotNetTemplates. - /// - /// Returns a GET result which, if is , contains Initializr .NET templates. - [HttpGet] - [Route("dotNetTemplates")] - public IActionResult GetDotNetTemplates() - { - return Ok(_uiConfigService.UiConfig.DotNetTemplate.Values); - } - /// /// Implements GET languages. /// diff --git a/src/InitializrApi/Generators/NetCoreToolProjectGenerator.cs b/src/InitializrApi/Generators/NetCoreToolProjectGenerator.cs index 8b823ae..2c8ab12 100644 --- a/src/InitializrApi/Generators/NetCoreToolProjectGenerator.cs +++ b/src/InitializrApi/Generators/NetCoreToolProjectGenerator.cs @@ -45,7 +45,7 @@ namespace Steeltoe.InitializrApi.Generators .Append("packaging=").Append(spec.Packaging) .Append('&') .Append("options=") - .Append("output=").Append(spec.Application) + .Append("output=").Append(spec.Namespace) .Append(",description=").Append(spec.Description) .Append(",steeltoe=").Append(spec.SteeltoeVersion) .Append(",framework=").Append(spec.DotNetFramework); diff --git a/src/InitializrApi/Models/ProjectSpec.cs b/src/InitializrApi/Models/ProjectSpec.cs index 60b0779..7dc130f 100644 --- a/src/InitializrApi/Models/ProjectSpec.cs +++ b/src/InitializrApi/Models/ProjectSpec.cs @@ -14,7 +14,7 @@ namespace Steeltoe.InitializrApi.Models /* ----------------------------------------------------------------- * * fields * * ----------------------------------------------------------------- */ - private string _application; + private string _namespace; /* ----------------------------------------------------------------- * * properties * @@ -26,12 +26,12 @@ namespace Steeltoe.InitializrApi.Models public string Name { get; set; } /// - /// Gets or sets the project application. + /// Gets or sets the project namespace. /// - public string Application + public string Namespace { - get => _application ?? Name; - set => _application = value; + get => _namespace ?? Name; + set => _namespace = value; } /// @@ -79,9 +79,9 @@ namespace Steeltoe.InitializrApi.Models delim = ","; } - if (Application != null) + if (Namespace != null) { - buf.Append(delim).Append("app=").Append(Application); + buf.Append(delim).Append("app=").Append(Namespace); delim = ","; } diff --git a/src/InitializrApi/Resources/uiconfig.Development.json b/src/InitializrApi/Resources/uiconfig.Development.json index 176a400..ebe9da9 100644 --- a/src/InitializrApi/Resources/uiconfig.Development.json +++ b/src/InitializrApi/Resources/uiconfig.Development.json @@ -3,17 +3,13 @@ "type": "text", "default": "Sample" }, - "applicationName": { - "type": "text", - "default": "SampleApplication" - }, "namespace": { "type": "text", - "default": "Sample" + "default": "Sample.Namespace" }, "description": { "type": "text", - "default": "Sample project application" + "default": "Sample application" }, "steeltoeVersion": { "type": "single-select", diff --git a/test/InitializrApi.Test.Integration/HttpTests.cs b/test/InitializrApi.Test.Integration/HttpTests.cs index be439a2..80e2128 100644 --- a/test/InitializrApi.Test.Integration/HttpTests.cs +++ b/test/InitializrApi.Test.Integration/HttpTests.cs @@ -51,18 +51,6 @@ namespace Steeltoe.InitializrApi.Test.Integration frameworks.Length.Should().BeGreaterThan(0); } - [Fact] - public async Task Get_Config_DotNet_Templates_Should_Return_DotNet_Templates() - { - // Act - var response = await HttpClient.GetAsync(UiConfigEndpoint + "/dotNetTemplates"); - - // Assert - response.StatusCode.Should().Be(HttpStatusCode.OK); - var templates = await response.Content.ReadFromJsonAsync(); - templates.Length.Should().BeGreaterThan(0); - } - [Fact] public async Task Get_Config_Languages_Should_Return_Languages() { diff --git a/test/InitializrApi.Test.Integration/ModelTests.cs b/test/InitializrApi.Test.Integration/ModelTests.cs index 26307b9..7a4a380 100644 --- a/test/InitializrApi.Test.Integration/ModelTests.cs +++ b/test/InitializrApi.Test.Integration/ModelTests.cs @@ -27,11 +27,9 @@ namespace Steeltoe.InitializrApi.Test.Integration var uiConfig = Serializer.DeserializeJson(bits); uiConfig.SteeltoeVersion.Default.Should().Be("3.0.2"); uiConfig.DotNetFramework.Default.Should().Be("netcoreapp3.1"); - uiConfig.DotNetTemplate.Default.Should().Be("webapi"); uiConfig.Language.Default.Should().Be("csharp"); uiConfig.Name.Default.Should().Be("Dev"); uiConfig.Namespace.Default.Should().Be("DevNamespace"); - uiConfig.ApplicationName.Default.Should().Be("DevApplication"); uiConfig.Description.Default.Should().Be("Development project application"); uiConfig.Dependencies.Values[0].Name.Should().Be("Focus Group"); uiConfig.Dependencies.Values[0].Values[0].Name.Should().Be("Focus Dependency"); diff --git a/test/InitializrApi.Test.Unit/Controllers/ProjectControllerTests.cs b/test/InitializrApi.Test.Unit/Controllers/ProjectControllerTests.cs index d216727..269e026 100644 --- a/test/InitializrApi.Test.Unit/Controllers/ProjectControllerTests.cs +++ b/test/InitializrApi.Test.Unit/Controllers/ProjectControllerTests.cs @@ -34,7 +34,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers Namespace = new UiConfig.Text { Default = "my namespace" }, SteeltoeVersion = new UiConfig.SingleSelectList { Default = "my steeltoe version" }, DotNetFramework = new UiConfig.SingleSelectList { Default = "my dotnet framework" }, - DotNetTemplate = new UiConfig.SingleSelectList { Default = "my dotnet template" }, Language = new UiConfig.SingleSelectList { Default = "my language" }, Packaging = new UiConfig.SingleSelectList { Default = "myarchive" }, }; @@ -49,8 +48,8 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers // Assert projectPackage.Should().Contain("project name=my project name"); - projectPackage.Should().Contain("description=my description"); projectPackage.Should().Contain("namespace=my namespace"); + projectPackage.Should().Contain("description=my description"); projectPackage.Should().Contain("steeltoe version=my steeltoe version"); projectPackage.Should().Contain("dotnet framework=my dotnet framework"); projectPackage.Should().Contain("language=my language"); @@ -227,7 +226,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers buffer.Append(newline); buffer.Append("description=").Append(spec.Description ?? "" ); buffer.Append(newline); - buffer.Append("namespace=").Append(spec.Application ?? "" ); + buffer.Append("namespace=").Append(spec.Namespace ?? "" ); buffer.Append(newline); buffer.Append("steeltoe version=").Append(spec.SteeltoeVersion ?? "" ); buffer.Append(newline); diff --git a/test/InitializrApi.Test.Unit/Controllers/RootControllerTests.cs b/test/InitializrApi.Test.Unit/Controllers/RootControllerTests.cs index da44507..ea97f1e 100644 --- a/test/InitializrApi.Test.Unit/Controllers/RootControllerTests.cs +++ b/test/InitializrApi.Test.Unit/Controllers/RootControllerTests.cs @@ -33,10 +33,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers { Default = "MyProject" }, - ApplicationName = new UiConfig.Text - { - Default = "MyApplication" - }, Namespace = new UiConfig.Text { Default = "MyNamespace" @@ -53,10 +49,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers { Default = "1.2" }, - DotNetTemplate = new UiConfig.SingleSelectList - { - Default = "mytemplate" - }, Language = new UiConfig.SingleSelectList { Default = "mylang" @@ -119,12 +111,10 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers help.Should().MatchRegex("Examples:"); help.Should().MatchRegex(@"\|\s+Parameter\s+\|\s+Description\s+\|\s+Default value\s+\|"); help.Should().MatchRegex(@"\|\s+name\s+\|\s+project name\s+\|\s+MyProject\s+\|"); - help.Should().MatchRegex(@"\|\s+applicationName\s+\|\s+application name\s+\|\s+MyApplication\s+\|"); help.Should().MatchRegex(@"\|\s+namespace\s+\|\s+namespace\s+\|\s+MyNamespace\s+\|"); help.Should().MatchRegex(@"\|\s+description\s+\|\s+project description\s+\|\s+my description\s+\|"); help.Should().MatchRegex(@"\|\s+steeltoeVersion\s+\|\s+Steeltoe version\s+\|\s+1.2.3\s+\|"); help.Should().MatchRegex(@"\|\s+dotNetFramework\s+\|\s+target .NET framework\s+\|\s+1.2\s+\|"); - help.Should().MatchRegex(@"\|\s+dotNetTemplate\s+\|\s+.NET template\s+\|\s+mytemplate\s+\|"); help.Should().MatchRegex(@"\|\s+language\s+\|\s+programming language\s+\|\s+mylang\s+\|"); help.Should().MatchRegex(@"\|\s+packaging\s+\|\s+project packaging\s+\|\s+mypkg\s+\|"); help.Should().MatchRegex(@"\|\s+Id\s+\|\s+Description\s+\|\s+Required Steeltoe version\s+\|"); diff --git a/test/InitializrApi.Test.Unit/Models/ProjectSpecTests.cs b/test/InitializrApi.Test.Unit/Models/ProjectSpecTests.cs index 26e727a..34c7895 100644 --- a/test/InitializrApi.Test.Unit/Models/ProjectSpecTests.cs +++ b/test/InitializrApi.Test.Unit/Models/ProjectSpecTests.cs @@ -25,7 +25,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models // Assert spec.Name.Should().BeNull(); spec.Description.Should().BeNull(); - spec.Application.Should().BeNull(); + spec.Namespace.Should().BeNull(); spec.SteeltoeVersion.Should().BeNull(); spec.DotNetFramework.Should().BeNull(); spec.Language.Should().BeNull(); @@ -42,13 +42,13 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models spec.Name = "foo"; // Assert - spec.Application.Should().Be("foo"); + spec.Namespace.Should().Be("foo"); // Act - spec.Application = "bar"; + spec.Namespace = "bar"; // Assert - spec.Application.Should().Be("bar"); + spec.Namespace.Should().Be("bar"); } [Fact] @@ -102,7 +102,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models "[steeltoe=mysteeltoeversion,framework=myframework,lang=mylanguage,pkg=mypackaging]"); // Arrange - spec.Application = "myapp"; + spec.Namespace = "myapp"; // Act s = spec.ToString(); diff --git a/test/InitializrApi.Test.Unit/Models/UiConfigTests.cs b/test/InitializrApi.Test.Unit/Models/UiConfigTests.cs index 25727a6..0b448a1 100644 --- a/test/InitializrApi.Test.Unit/Models/UiConfigTests.cs +++ b/test/InitializrApi.Test.Unit/Models/UiConfigTests.cs @@ -25,11 +25,9 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models // Assert uiConfig.Name.Should().BeNull(); uiConfig.Namespace.Should().BeNull(); - uiConfig.ApplicationName.Should().BeNull(); uiConfig.Description.Should().BeNull(); uiConfig.SteeltoeVersion.Should().BeNull(); uiConfig.DotNetFramework.Should().BeNull(); - uiConfig.DotNetTemplate.Should().BeNull(); uiConfig.Language.Should().BeNull(); uiConfig.Packaging.Should().BeNull(); uiConfig.Dependencies.Should().BeNull();