Rename Application to Namespace

This commit is contained in:
Chris Cheetham 2021-06-25 16:09:09 -04:00
Родитель a5454a49d5
Коммит 6a857aa627
13 изменённых файлов: 18 добавлений и 72 удалений

Просмотреть файл

@ -18,11 +18,6 @@ namespace Steeltoe.InitializrApi.Config
/// </summary> /// </summary>
public Text Name { get; set; } public Text Name { get; set; }
/// <summary>
/// Gets or sets the project application name.
/// </summary>
public Text ApplicationName { get; set; }
/// <summary> /// <summary>
/// Gets or sets the project namespace. /// Gets or sets the project namespace.
/// </summary> /// </summary>
@ -43,11 +38,6 @@ namespace Steeltoe.InitializrApi.Config
/// </summary> /// </summary>
public SingleSelectList DotNetFramework { get; set; } public SingleSelectList DotNetFramework { get; set; }
/// <summary>
/// Gets or sets the DotNet template.
/// </summary>
public SingleSelectList DotNetTemplate { get; set; }
/// <summary> /// <summary>
/// Gets or sets the programming language. /// Gets or sets the programming language.
/// </summary> /// </summary>

Просмотреть файл

@ -65,7 +65,7 @@ namespace Steeltoe.InitializrApi.Controllers
var normalizedSpec = new ProjectSpec() var normalizedSpec = new ProjectSpec()
{ {
Name = spec.Name ?? defaults?.Name?.Default, Name = spec.Name ?? defaults?.Name?.Default,
Application = spec.Application ?? defaults?.Namespace?.Default, Namespace = spec.Namespace ?? defaults?.Namespace?.Default,
Description = spec.Description ?? defaults?.Description?.Default, Description = spec.Description ?? defaults?.Description?.Default,
SteeltoeVersion = spec.SteeltoeVersion ?? defaults?.SteeltoeVersion?.Default, SteeltoeVersion = spec.SteeltoeVersion ?? defaults?.SteeltoeVersion?.Default,
DotNetFramework = spec.DotNetFramework ?? defaults?.DotNetFramework?.Default, DotNetFramework = spec.DotNetFramework ?? defaults?.DotNetFramework?.Default,

Просмотреть файл

@ -88,12 +88,10 @@ namespace Steeltoe.InitializrApi.Controllers
{ {
new () { "Parameter", "Description", "Default value" }, new () { "Parameter", "Description", "Default value" },
new () { "name", "project name", uiConfig.Name.Default }, new () { "name", "project name", uiConfig.Name.Default },
new () { "applicationName", "application name", uiConfig.ApplicationName.Default },
new () { "namespace", "namespace", uiConfig.Namespace.Default }, new () { "namespace", "namespace", uiConfig.Namespace.Default },
new () { "description", "project description", uiConfig.Description.Default }, new () { "description", "project description", uiConfig.Description.Default },
new () { "steeltoeVersion", "Steeltoe version", uiConfig.SteeltoeVersion.Default }, new () { "steeltoeVersion", "Steeltoe version", uiConfig.SteeltoeVersion.Default },
new () { "dotNetFramework", "target .NET framework", uiConfig.DotNetFramework.Default }, new () { "dotNetFramework", "target .NET framework", uiConfig.DotNetFramework.Default },
new () { "dotNetTemplate", ".NET template", uiConfig.DotNetTemplate.Default },
new () { "language", "programming language", uiConfig.Language.Default }, new () { "language", "programming language", uiConfig.Language.Default },
new () { "packaging", "project packaging", uiConfig.Packaging.Default }, new () { "packaging", "project packaging", uiConfig.Packaging.Default },
}; };

Просмотреть файл

@ -74,17 +74,6 @@ namespace Steeltoe.InitializrApi.Controllers
return Ok(_uiConfigService.UiConfig.DotNetFramework.Values); return Ok(_uiConfigService.UiConfig.DotNetFramework.Values);
} }
/// <summary>
/// Implements <c>GET dotNetTemplates</c>.
/// </summary>
/// <returns>Returns a <c>GET</c> result which, if is <see cref="OkObjectResult"/>, contains Initializr .NET templates.</returns>
[HttpGet]
[Route("dotNetTemplates")]
public IActionResult GetDotNetTemplates()
{
return Ok(_uiConfigService.UiConfig.DotNetTemplate.Values);
}
/// <summary> /// <summary>
/// Implements <c>GET languages</c>. /// Implements <c>GET languages</c>.
/// </summary> /// </summary>

Просмотреть файл

@ -45,7 +45,7 @@ namespace Steeltoe.InitializrApi.Generators
.Append("packaging=").Append(spec.Packaging) .Append("packaging=").Append(spec.Packaging)
.Append('&') .Append('&')
.Append("options=") .Append("options=")
.Append("output=").Append(spec.Application) .Append("output=").Append(spec.Namespace)
.Append(",description=").Append(spec.Description) .Append(",description=").Append(spec.Description)
.Append(",steeltoe=").Append(spec.SteeltoeVersion) .Append(",steeltoe=").Append(spec.SteeltoeVersion)
.Append(",framework=").Append(spec.DotNetFramework); .Append(",framework=").Append(spec.DotNetFramework);

Просмотреть файл

@ -14,7 +14,7 @@ namespace Steeltoe.InitializrApi.Models
/* ----------------------------------------------------------------- * /* ----------------------------------------------------------------- *
* fields * * fields *
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
private string _application; private string _namespace;
/* ----------------------------------------------------------------- * /* ----------------------------------------------------------------- *
* properties * * properties *
@ -26,12 +26,12 @@ namespace Steeltoe.InitializrApi.Models
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the project application. /// Gets or sets the project namespace.
/// </summary> /// </summary>
public string Application public string Namespace
{ {
get => _application ?? Name; get => _namespace ?? Name;
set => _application = value; set => _namespace = value;
} }
/// <summary> /// <summary>
@ -79,9 +79,9 @@ namespace Steeltoe.InitializrApi.Models
delim = ","; delim = ",";
} }
if (Application != null) if (Namespace != null)
{ {
buf.Append(delim).Append("app=").Append(Application); buf.Append(delim).Append("app=").Append(Namespace);
delim = ","; delim = ",";
} }

Просмотреть файл

@ -3,17 +3,13 @@
"type": "text", "type": "text",
"default": "Sample" "default": "Sample"
}, },
"applicationName": {
"type": "text",
"default": "SampleApplication"
},
"namespace": { "namespace": {
"type": "text", "type": "text",
"default": "Sample" "default": "Sample.Namespace"
}, },
"description": { "description": {
"type": "text", "type": "text",
"default": "Sample project application" "default": "Sample application"
}, },
"steeltoeVersion": { "steeltoeVersion": {
"type": "single-select", "type": "single-select",

Просмотреть файл

@ -51,18 +51,6 @@ namespace Steeltoe.InitializrApi.Test.Integration
frameworks.Length.Should().BeGreaterThan(0); 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<UiConfig.SelectItem[]>();
templates.Length.Should().BeGreaterThan(0);
}
[Fact] [Fact]
public async Task Get_Config_Languages_Should_Return_Languages() public async Task Get_Config_Languages_Should_Return_Languages()
{ {

Просмотреть файл

@ -27,11 +27,9 @@ namespace Steeltoe.InitializrApi.Test.Integration
var uiConfig = Serializer.DeserializeJson<UiConfig>(bits); var uiConfig = Serializer.DeserializeJson<UiConfig>(bits);
uiConfig.SteeltoeVersion.Default.Should().Be("3.0.2"); uiConfig.SteeltoeVersion.Default.Should().Be("3.0.2");
uiConfig.DotNetFramework.Default.Should().Be("netcoreapp3.1"); uiConfig.DotNetFramework.Default.Should().Be("netcoreapp3.1");
uiConfig.DotNetTemplate.Default.Should().Be("webapi");
uiConfig.Language.Default.Should().Be("csharp"); uiConfig.Language.Default.Should().Be("csharp");
uiConfig.Name.Default.Should().Be("Dev"); uiConfig.Name.Default.Should().Be("Dev");
uiConfig.Namespace.Default.Should().Be("DevNamespace"); uiConfig.Namespace.Default.Should().Be("DevNamespace");
uiConfig.ApplicationName.Default.Should().Be("DevApplication");
uiConfig.Description.Default.Should().Be("Development project application"); uiConfig.Description.Default.Should().Be("Development project application");
uiConfig.Dependencies.Values[0].Name.Should().Be("Focus Group"); uiConfig.Dependencies.Values[0].Name.Should().Be("Focus Group");
uiConfig.Dependencies.Values[0].Values[0].Name.Should().Be("Focus Dependency"); uiConfig.Dependencies.Values[0].Values[0].Name.Should().Be("Focus Dependency");

Просмотреть файл

@ -34,7 +34,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
Namespace = new UiConfig.Text { Default = "my namespace" }, Namespace = new UiConfig.Text { Default = "my namespace" },
SteeltoeVersion = new UiConfig.SingleSelectList { Default = "my steeltoe version" }, SteeltoeVersion = new UiConfig.SingleSelectList { Default = "my steeltoe version" },
DotNetFramework = new UiConfig.SingleSelectList { Default = "my dotnet framework" }, DotNetFramework = new UiConfig.SingleSelectList { Default = "my dotnet framework" },
DotNetTemplate = new UiConfig.SingleSelectList { Default = "my dotnet template" },
Language = new UiConfig.SingleSelectList { Default = "my language" }, Language = new UiConfig.SingleSelectList { Default = "my language" },
Packaging = new UiConfig.SingleSelectList { Default = "myarchive" }, Packaging = new UiConfig.SingleSelectList { Default = "myarchive" },
}; };
@ -49,8 +48,8 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
// Assert // Assert
projectPackage.Should().Contain("project name=my project name"); projectPackage.Should().Contain("project name=my project name");
projectPackage.Should().Contain("description=my description");
projectPackage.Should().Contain("namespace=my namespace"); projectPackage.Should().Contain("namespace=my namespace");
projectPackage.Should().Contain("description=my description");
projectPackage.Should().Contain("steeltoe version=my steeltoe version"); projectPackage.Should().Contain("steeltoe version=my steeltoe version");
projectPackage.Should().Contain("dotnet framework=my dotnet framework"); projectPackage.Should().Contain("dotnet framework=my dotnet framework");
projectPackage.Should().Contain("language=my language"); projectPackage.Should().Contain("language=my language");
@ -227,7 +226,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
buffer.Append(newline); buffer.Append(newline);
buffer.Append("description=").Append(spec.Description ?? "<na>" ); buffer.Append("description=").Append(spec.Description ?? "<na>" );
buffer.Append(newline); buffer.Append(newline);
buffer.Append("namespace=").Append(spec.Application ?? "<na>" ); buffer.Append("namespace=").Append(spec.Namespace ?? "<na>" );
buffer.Append(newline); buffer.Append(newline);
buffer.Append("steeltoe version=").Append(spec.SteeltoeVersion ?? "<na>" ); buffer.Append("steeltoe version=").Append(spec.SteeltoeVersion ?? "<na>" );
buffer.Append(newline); buffer.Append(newline);

Просмотреть файл

@ -33,10 +33,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
{ {
Default = "MyProject" Default = "MyProject"
}, },
ApplicationName = new UiConfig.Text
{
Default = "MyApplication"
},
Namespace = new UiConfig.Text Namespace = new UiConfig.Text
{ {
Default = "MyNamespace" Default = "MyNamespace"
@ -53,10 +49,6 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
{ {
Default = "1.2" Default = "1.2"
}, },
DotNetTemplate = new UiConfig.SingleSelectList
{
Default = "mytemplate"
},
Language = new UiConfig.SingleSelectList Language = new UiConfig.SingleSelectList
{ {
Default = "mylang" Default = "mylang"
@ -119,12 +111,10 @@ namespace Steeltoe.InitializrApi.Test.Unit.Controllers
help.Should().MatchRegex("Examples:"); help.Should().MatchRegex("Examples:");
help.Should().MatchRegex(@"\|\s+Parameter\s+\|\s+Description\s+\|\s+Default value\s+\|"); 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+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+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+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+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+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+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+packaging\s+\|\s+project packaging\s+\|\s+mypkg\s+\|");
help.Should().MatchRegex(@"\|\s+Id\s+\|\s+Description\s+\|\s+Required Steeltoe version\s+\|"); help.Should().MatchRegex(@"\|\s+Id\s+\|\s+Description\s+\|\s+Required Steeltoe version\s+\|");

Просмотреть файл

@ -25,7 +25,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models
// Assert // Assert
spec.Name.Should().BeNull(); spec.Name.Should().BeNull();
spec.Description.Should().BeNull(); spec.Description.Should().BeNull();
spec.Application.Should().BeNull(); spec.Namespace.Should().BeNull();
spec.SteeltoeVersion.Should().BeNull(); spec.SteeltoeVersion.Should().BeNull();
spec.DotNetFramework.Should().BeNull(); spec.DotNetFramework.Should().BeNull();
spec.Language.Should().BeNull(); spec.Language.Should().BeNull();
@ -42,13 +42,13 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models
spec.Name = "foo"; spec.Name = "foo";
// Assert // Assert
spec.Application.Should().Be("foo"); spec.Namespace.Should().Be("foo");
// Act // Act
spec.Application = "bar"; spec.Namespace = "bar";
// Assert // Assert
spec.Application.Should().Be("bar"); spec.Namespace.Should().Be("bar");
} }
[Fact] [Fact]
@ -102,7 +102,7 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models
"[steeltoe=mysteeltoeversion,framework=myframework,lang=mylanguage,pkg=mypackaging]"); "[steeltoe=mysteeltoeversion,framework=myframework,lang=mylanguage,pkg=mypackaging]");
// Arrange // Arrange
spec.Application = "myapp"; spec.Namespace = "myapp";
// Act // Act
s = spec.ToString(); s = spec.ToString();

Просмотреть файл

@ -25,11 +25,9 @@ namespace Steeltoe.InitializrApi.Test.Unit.Models
// Assert // Assert
uiConfig.Name.Should().BeNull(); uiConfig.Name.Should().BeNull();
uiConfig.Namespace.Should().BeNull(); uiConfig.Namespace.Should().BeNull();
uiConfig.ApplicationName.Should().BeNull();
uiConfig.Description.Should().BeNull(); uiConfig.Description.Should().BeNull();
uiConfig.SteeltoeVersion.Should().BeNull(); uiConfig.SteeltoeVersion.Should().BeNull();
uiConfig.DotNetFramework.Should().BeNull(); uiConfig.DotNetFramework.Should().BeNull();
uiConfig.DotNetTemplate.Should().BeNull();
uiConfig.Language.Should().BeNull(); uiConfig.Language.Should().BeNull();
uiConfig.Packaging.Should().BeNull(); uiConfig.Packaging.Should().BeNull();
uiConfig.Dependencies.Should().BeNull(); uiConfig.Dependencies.Should().BeNull();