Rename Application to Namespace
This commit is contained in:
Родитель
a5454a49d5
Коммит
6a857aa627
|
@ -18,11 +18,6 @@ namespace Steeltoe.InitializrApi.Config
|
|||
/// </summary>
|
||||
public Text Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the project application name.
|
||||
/// </summary>
|
||||
public Text ApplicationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the project namespace.
|
||||
/// </summary>
|
||||
|
@ -43,11 +38,6 @@ namespace Steeltoe.InitializrApi.Config
|
|||
/// </summary>
|
||||
public SingleSelectList DotNetFramework { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DotNet template.
|
||||
/// </summary>
|
||||
public SingleSelectList DotNetTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the programming language.
|
||||
/// </summary>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 },
|
||||
};
|
||||
|
|
|
@ -74,17 +74,6 @@ namespace Steeltoe.InitializrApi.Controllers
|
|||
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>
|
||||
/// Implements <c>GET languages</c>.
|
||||
/// </summary>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the project application.
|
||||
/// Gets or sets the project namespace.
|
||||
/// </summary>
|
||||
public string Application
|
||||
public string Namespace
|
||||
{
|
||||
get => _application ?? Name;
|
||||
set => _application = value;
|
||||
get => _namespace ?? Name;
|
||||
set => _namespace = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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 = ",";
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<UiConfig.SelectItem[]>();
|
||||
templates.Length.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_Config_Languages_Should_Return_Languages()
|
||||
{
|
||||
|
|
|
@ -27,11 +27,9 @@ namespace Steeltoe.InitializrApi.Test.Integration
|
|||
var uiConfig = Serializer.DeserializeJson<UiConfig>(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");
|
||||
|
|
|
@ -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 ?? "<na>" );
|
||||
buffer.Append(newline);
|
||||
buffer.Append("namespace=").Append(spec.Application ?? "<na>" );
|
||||
buffer.Append("namespace=").Append(spec.Namespace ?? "<na>" );
|
||||
buffer.Append(newline);
|
||||
buffer.Append("steeltoe version=").Append(spec.SteeltoeVersion ?? "<na>" );
|
||||
buffer.Append(newline);
|
||||
|
|
|
@ -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+\|");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче