From aa9a7c1ad1865825db79a1bbc31107409ff4b860 Mon Sep 17 00:00:00 2001 From: Chris Cheetham Date: Mon, 17 Feb 2020 08:55:09 -0500 Subject: [PATCH] factor out models --- src/Steeltoe.Cli/AddDependencyCommand.cs | 4 +- src/Steeltoe.Cli/Command.cs | 7 +- src/Steeltoe.Cli/DefineDependencyCommand.cs | 4 +- src/Steeltoe.Cli/DoctorCommand.cs | 8 +-- src/Steeltoe.Cli/ListConfigurationsCommand.cs | 4 +- src/Steeltoe.Cli/ListDependenciesCommand.cs | 4 +- src/Steeltoe.Cli/ListTemplatesCommand.cs | 4 +- src/Steeltoe.Cli/NewCommand.cs | 4 +- src/Steeltoe.Cli/NewConfigurationCommand.cs | 4 +- src/Steeltoe.Cli/RemoveDependencyCommand.cs | 4 +- src/Steeltoe.Cli/RunCommand.cs | 4 +- src/Steeltoe.Cli/ShowCommand.cs | 4 +- src/Steeltoe.Cli/ShowConfigurationCommand.cs | 4 +- src/Steeltoe.Cli/ShowTopicCommand.cs | 4 +- src/Steeltoe.Cli/StopCommand.cs | 4 +- src/Steeltoe.Cli/UndefineDependencyCommand.cs | 4 +- src/Steeltoe.Tooling/ConfigurationFile.cs | 1 + src/Steeltoe.Tooling/Context.cs | 1 + .../Executor.cs => Controllers/Controller.cs} | 10 +-- .../Drivers/CloudFoundry/CloudFoundryCli.cs | 23 ------ .../CloudFoundry/CloudFoundryManifestFile.cs | 1 + .../Drivers/Dummy/DummyServiceDatabase.cs | 70 ------------------- .../KubernetesDeploymentConfigFile.cs | 1 + .../KubernetesDotnetAppDockerfileFile.cs | 1 + .../Kubernetes/KubernetesServiceConfigFile.cs | 1 + src/Steeltoe.Tooling/{ => Models}/AppInfo.cs | 4 +- .../{ => Models}/Configuration.cs | 2 +- .../{ => Models}/IConfigurationListener.cs | 2 +- src/Steeltoe.Tooling/{ => Models}/Registry.cs | 2 +- .../{ => Models}/ServiceInfo.cs | 2 +- .../{ => Models}/ServiceTypeInfo.cs | 2 +- .../{ => Models}/TargetConfiguration.cs | 4 +- src/Steeltoe.Tooling/Scanners/AppScanner.cs | 1 + src/Steeltoe.Tooling/Steeltoe.Tooling.csproj | 2 +- .../{ => Templaters}/TemplateManager.cs | 2 +- .../Steeltoe.Cli.Test/ListTemplatesFeature.cs | 12 ++-- test/Steeltoe.Tooling.Test/ContextTest.cs | 1 + .../{ => Models}/ConfigurationTest.cs | 3 +- .../{ => Models}/RegistryConfigurationTest.cs | 1 + .../{ => Models}/RegistryTest.cs | 3 +- test/Steeltoe.Tooling.Test/ToolingTest.cs | 1 + 41 files changed, 69 insertions(+), 155 deletions(-) rename src/Steeltoe.Tooling/{Executors/Executor.cs => Controllers/Controller.cs} (83%) delete mode 100644 src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryCli.cs delete mode 100644 src/Steeltoe.Tooling/Drivers/Dummy/DummyServiceDatabase.cs rename src/Steeltoe.Tooling/{ => Models}/AppInfo.cs (91%) rename src/Steeltoe.Tooling/{ => Models}/Configuration.cs (99%) rename src/Steeltoe.Tooling/{ => Models}/IConfigurationListener.cs (96%) rename src/Steeltoe.Tooling/{ => Models}/Registry.cs (99%) rename src/Steeltoe.Tooling/{ => Models}/ServiceInfo.cs (97%) rename src/Steeltoe.Tooling/{ => Models}/ServiceTypeInfo.cs (97%) rename src/Steeltoe.Tooling/{ => Models}/TargetConfiguration.cs (94%) rename src/Steeltoe.Tooling/{ => Templaters}/TemplateManager.cs (97%) rename test/Steeltoe.Tooling.Test/{ => Models}/ConfigurationTest.cs (99%) rename test/Steeltoe.Tooling.Test/{ => Models}/RegistryConfigurationTest.cs (99%) rename test/Steeltoe.Tooling.Test/{ => Models}/RegistryTest.cs (96%) diff --git a/src/Steeltoe.Cli/AddDependencyCommand.cs b/src/Steeltoe.Cli/AddDependencyCommand.cs index f5dbce2..d8f7be0 100644 --- a/src/Steeltoe.Cli/AddDependencyCommand.cs +++ b/src/Steeltoe.Cli/AddDependencyCommand.cs @@ -15,7 +15,7 @@ using System; using System.ComponentModel.DataAnnotations; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -50,7 +50,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/Command.cs b/src/Steeltoe.Cli/Command.cs index 33269fd..694dce9 100644 --- a/src/Steeltoe.Cli/Command.cs +++ b/src/Steeltoe.Cli/Command.cs @@ -16,7 +16,8 @@ using System; using McMaster.Extensions.CommandLineUtils; using Microsoft.Extensions.Logging; using Steeltoe.Tooling; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; +using Steeltoe.Tooling.Models; namespace Steeltoe.Cli { @@ -57,7 +58,7 @@ namespace Steeltoe.Cli _console.Out, new CommandShell() ); - GetExecutor().Execute(context); + GetController().Execute(context); return 0; } catch (ArgumentException e) @@ -86,6 +87,6 @@ namespace Steeltoe.Cli } } - protected abstract Executor GetExecutor(); + protected abstract Controller GetController(); } } diff --git a/src/Steeltoe.Cli/DefineDependencyCommand.cs b/src/Steeltoe.Cli/DefineDependencyCommand.cs index f14683f..fd88ac0 100644 --- a/src/Steeltoe.Cli/DefineDependencyCommand.cs +++ b/src/Steeltoe.Cli/DefineDependencyCommand.cs @@ -15,7 +15,7 @@ using System; using System.ComponentModel.DataAnnotations; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -64,7 +64,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/DoctorCommand.cs b/src/Steeltoe.Cli/DoctorCommand.cs index 8cc56bd..274f38b 100644 --- a/src/Steeltoe.Cli/DoctorCommand.cs +++ b/src/Steeltoe.Cli/DoctorCommand.cs @@ -13,7 +13,7 @@ // limitations under the License. using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -26,13 +26,13 @@ namespace Steeltoe.Cli { } - protected override Executor GetExecutor() + protected override Controller GetController() { - return new DoctorExecutor(); + return new DoctorController(); } } - internal class DoctorExecutor : Executor + internal class DoctorController : Controller { protected override void Execute() { diff --git a/src/Steeltoe.Cli/ListConfigurationsCommand.cs b/src/Steeltoe.Cli/ListConfigurationsCommand.cs index 623e748..2d83a09 100644 --- a/src/Steeltoe.Cli/ListConfigurationsCommand.cs +++ b/src/Steeltoe.Cli/ListConfigurationsCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -30,7 +30,7 @@ Overview: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/ListDependenciesCommand.cs b/src/Steeltoe.Cli/ListDependenciesCommand.cs index 72f6f0f..63a7661 100644 --- a/src/Steeltoe.Cli/ListDependenciesCommand.cs +++ b/src/Steeltoe.Cli/ListDependenciesCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -30,7 +30,7 @@ Overview: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/ListTemplatesCommand.cs b/src/Steeltoe.Cli/ListTemplatesCommand.cs index 52bd1a4..20c3b77 100644 --- a/src/Steeltoe.Cli/ListTemplatesCommand.cs +++ b/src/Steeltoe.Cli/ListTemplatesCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -30,7 +30,7 @@ Overview: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/NewCommand.cs b/src/Steeltoe.Cli/NewCommand.cs index ee007aa..bebdc42 100644 --- a/src/Steeltoe.Cli/NewCommand.cs +++ b/src/Steeltoe.Cli/NewCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -80,7 +80,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/NewConfigurationCommand.cs b/src/Steeltoe.Cli/NewConfigurationCommand.cs index 30d87fa..4f553cd 100644 --- a/src/Steeltoe.Cli/NewConfigurationCommand.cs +++ b/src/Steeltoe.Cli/NewConfigurationCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -88,7 +88,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/RemoveDependencyCommand.cs b/src/Steeltoe.Cli/RemoveDependencyCommand.cs index fee1959..facdb8f 100644 --- a/src/Steeltoe.Cli/RemoveDependencyCommand.cs +++ b/src/Steeltoe.Cli/RemoveDependencyCommand.cs @@ -15,7 +15,7 @@ using System; using System.ComponentModel.DataAnnotations; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -44,7 +44,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/RunCommand.cs b/src/Steeltoe.Cli/RunCommand.cs index 5a9c5b1..5f2d334 100644 --- a/src/Steeltoe.Cli/RunCommand.cs +++ b/src/Steeltoe.Cli/RunCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -45,7 +45,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/ShowCommand.cs b/src/Steeltoe.Cli/ShowCommand.cs index df3a456..9648149 100644 --- a/src/Steeltoe.Cli/ShowCommand.cs +++ b/src/Steeltoe.Cli/ShowCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -41,7 +41,7 @@ Examples: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/ShowConfigurationCommand.cs b/src/Steeltoe.Cli/ShowConfigurationCommand.cs index 0078f2c..4cbc939 100644 --- a/src/Steeltoe.Cli/ShowConfigurationCommand.cs +++ b/src/Steeltoe.Cli/ShowConfigurationCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -41,7 +41,7 @@ Examples: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/ShowTopicCommand.cs b/src/Steeltoe.Cli/ShowTopicCommand.cs index 174b08b..ebb2088 100644 --- a/src/Steeltoe.Cli/ShowTopicCommand.cs +++ b/src/Steeltoe.Cli/ShowTopicCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -38,7 +38,7 @@ Examples: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/StopCommand.cs b/src/Steeltoe.Cli/StopCommand.cs index 4414f16..2cc1d71 100644 --- a/src/Steeltoe.Cli/StopCommand.cs +++ b/src/Steeltoe.Cli/StopCommand.cs @@ -14,7 +14,7 @@ using System; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -37,7 +37,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Cli/UndefineDependencyCommand.cs b/src/Steeltoe.Cli/UndefineDependencyCommand.cs index 5ffbd6e..23dbd1e 100644 --- a/src/Steeltoe.Cli/UndefineDependencyCommand.cs +++ b/src/Steeltoe.Cli/UndefineDependencyCommand.cs @@ -15,7 +15,7 @@ using System; using System.ComponentModel.DataAnnotations; using McMaster.Extensions.CommandLineUtils; -using Steeltoe.Tooling.Executors; +using Steeltoe.Tooling.Controllers; namespace Steeltoe.Cli { @@ -48,7 +48,7 @@ See Also: { } - protected override Executor GetExecutor() + protected override Controller GetController() { throw new NotImplementedException(); } diff --git a/src/Steeltoe.Tooling/ConfigurationFile.cs b/src/Steeltoe.Tooling/ConfigurationFile.cs index 2adc118..6dac1ef 100644 --- a/src/Steeltoe.Tooling/ConfigurationFile.cs +++ b/src/Steeltoe.Tooling/ConfigurationFile.cs @@ -14,6 +14,7 @@ using System.IO; using Microsoft.Extensions.Logging; +using Steeltoe.Tooling.Models; using YamlDotNet.Serialization; namespace Steeltoe.Tooling diff --git a/src/Steeltoe.Tooling/Context.cs b/src/Steeltoe.Tooling/Context.cs index a7b196a..bb62438 100644 --- a/src/Steeltoe.Tooling/Context.cs +++ b/src/Steeltoe.Tooling/Context.cs @@ -13,6 +13,7 @@ // limitations under the License. using System.IO; +using Steeltoe.Tooling.Models; namespace Steeltoe.Tooling { diff --git a/src/Steeltoe.Tooling/Executors/Executor.cs b/src/Steeltoe.Tooling/Controllers/Controller.cs similarity index 83% rename from src/Steeltoe.Tooling/Executors/Executor.cs rename to src/Steeltoe.Tooling/Controllers/Controller.cs index 57d3937..7eff515 100644 --- a/src/Steeltoe.Tooling/Executors/Executor.cs +++ b/src/Steeltoe.Tooling/Controllers/Controller.cs @@ -12,17 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Microsoft.Extensions.Logging; - -namespace Steeltoe.Tooling.Executors +namespace Steeltoe.Tooling.Controllers { /// /// Represents a Steeltoe Tooling workflow. /// - public abstract class Executor + public abstract class Controller { - private static readonly ILogger Logger = Logging.LoggerFactory.CreateLogger(); - /// /// The context in which the workflow executes. /// @@ -35,8 +31,6 @@ namespace Steeltoe.Tooling.Executors /// If an error occurs running the workflow. public void Execute(Context context) { - var type = GetType(); - Logger.LogDebug($"executor is {type}"); Context = context; Execute(); } diff --git a/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryCli.cs b/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryCli.cs deleted file mode 100644 index bfac18a..0000000 --- a/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryCli.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 the original author or authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace Steeltoe.Tooling.Drivers.CloudFoundry -{ - internal class CloudFoundryCli : Cli - { - internal CloudFoundryCli(Shell shell) : base("cf", shell) - { - } - } -} diff --git a/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryManifestFile.cs b/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryManifestFile.cs index 0b7166c..6c07451 100644 --- a/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryManifestFile.cs +++ b/src/Steeltoe.Tooling/Drivers/CloudFoundry/CloudFoundryManifestFile.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using Steeltoe.Tooling.Templaters; namespace Steeltoe.Tooling.Drivers.CloudFoundry { diff --git a/src/Steeltoe.Tooling/Drivers/Dummy/DummyServiceDatabase.cs b/src/Steeltoe.Tooling/Drivers/Dummy/DummyServiceDatabase.cs deleted file mode 100644 index 3584d0d..0000000 --- a/src/Steeltoe.Tooling/Drivers/Dummy/DummyServiceDatabase.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018 the original author or authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System.Collections.Generic; -using System.IO; -using System.Threading; -using YamlDotNet.Serialization; - -namespace Steeltoe.Tooling.Drivers.Dummy -{ - internal class DummyServiceDatabase - { - public List Apps { get; set; } = new List(); - - public SortedDictionary Services { get; set; } = - new SortedDictionary(); - - internal static void Store(string path, DummyServiceDatabase database) - { - var serializer = new SerializerBuilder().Build(); - var yaml = serializer.Serialize(database); - using (var fOut = GetFileStream(path, FileMode.Create, FileAccess.Write)) - { - using (var writer = new StreamWriter(fOut)) - { - writer.Write(yaml); - } - } - } - - internal static DummyServiceDatabase Load(string path) - { - var deserializer = new DeserializerBuilder().Build(); - using (var fIn = GetFileStream(path, FileMode.OpenOrCreate, FileAccess.Read)) - { - using (var reader = new StreamReader(fIn)) - { - return deserializer.Deserialize(reader) ?? - new DummyServiceDatabase(); - } - } - } - - private static FileStream GetFileStream(string path, FileMode mode, FileAccess access) - { - while (true) - { - try - { - return new FileStream(path, mode, access, FileShare.None); - } - catch (IOException) - { - Thread.Sleep(100); - } - } - } - } -} diff --git a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDeploymentConfigFile.cs b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDeploymentConfigFile.cs index c76c1d8..c3de960 100644 --- a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDeploymentConfigFile.cs +++ b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDeploymentConfigFile.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using Steeltoe.Tooling.Templaters; namespace Steeltoe.Tooling.Drivers.Kubernetes { diff --git a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDotnetAppDockerfileFile.cs b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDotnetAppDockerfileFile.cs index 665161b..08b1059 100644 --- a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDotnetAppDockerfileFile.cs +++ b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesDotnetAppDockerfileFile.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using Steeltoe.Tooling.Templaters; namespace Steeltoe.Tooling.Drivers.Kubernetes { diff --git a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesServiceConfigFile.cs b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesServiceConfigFile.cs index 0282301..6f91d5b 100644 --- a/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesServiceConfigFile.cs +++ b/src/Steeltoe.Tooling/Drivers/Kubernetes/KubernetesServiceConfigFile.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using Steeltoe.Tooling.Templaters; namespace Steeltoe.Tooling.Drivers.Kubernetes { diff --git a/src/Steeltoe.Tooling/AppInfo.cs b/src/Steeltoe.Tooling/Models/AppInfo.cs similarity index 91% rename from src/Steeltoe.Tooling/AppInfo.cs rename to src/Steeltoe.Tooling/Models/AppInfo.cs index be67be8..e23c6e7 100644 --- a/src/Steeltoe.Tooling/AppInfo.cs +++ b/src/Steeltoe.Tooling/Models/AppInfo.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// An application that can be deployed. @@ -25,7 +25,7 @@ namespace Steeltoe.Tooling public string App { get; } /// - /// Creates a new AppInfo for the specified applicaition. + /// Creates a new AppInfo for the specified application. /// /// Application name. public AppInfo(string app) diff --git a/src/Steeltoe.Tooling/Configuration.cs b/src/Steeltoe.Tooling/Models/Configuration.cs similarity index 99% rename from src/Steeltoe.Tooling/Configuration.cs rename to src/Steeltoe.Tooling/Models/Configuration.cs index 5ca4bf9..423a1b9 100644 --- a/src/Steeltoe.Tooling/Configuration.cs +++ b/src/Steeltoe.Tooling/Models/Configuration.cs @@ -17,7 +17,7 @@ using System.Linq; using Microsoft.Extensions.Logging; using YamlDotNet.Serialization; -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// Represents a configuration for a Steeltoe Tooling project. diff --git a/src/Steeltoe.Tooling/IConfigurationListener.cs b/src/Steeltoe.Tooling/Models/IConfigurationListener.cs similarity index 96% rename from src/Steeltoe.Tooling/IConfigurationListener.cs rename to src/Steeltoe.Tooling/Models/IConfigurationListener.cs index fdbe040..78b9174 100644 --- a/src/Steeltoe.Tooling/IConfigurationListener.cs +++ b/src/Steeltoe.Tooling/Models/IConfigurationListener.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// Defines the interface to receive alerts that the Steeltoe Tooling project configuration has changed. diff --git a/src/Steeltoe.Tooling/Registry.cs b/src/Steeltoe.Tooling/Models/Registry.cs similarity index 99% rename from src/Steeltoe.Tooling/Registry.cs rename to src/Steeltoe.Tooling/Models/Registry.cs index 1758fc4..ba2847c 100644 --- a/src/Steeltoe.Tooling/Registry.cs +++ b/src/Steeltoe.Tooling/Models/Registry.cs @@ -21,7 +21,7 @@ using YamlDotNet.Serialization; // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// Represents a Steeltoe Tooling projects available application service types and deployment targets. diff --git a/src/Steeltoe.Tooling/ServiceInfo.cs b/src/Steeltoe.Tooling/Models/ServiceInfo.cs similarity index 97% rename from src/Steeltoe.Tooling/ServiceInfo.cs rename to src/Steeltoe.Tooling/Models/ServiceInfo.cs index e1c76d2..9a84b50 100644 --- a/src/Steeltoe.Tooling/ServiceInfo.cs +++ b/src/Steeltoe.Tooling/Models/ServiceInfo.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// An application service, such as a database, that can be deployed. diff --git a/src/Steeltoe.Tooling/ServiceTypeInfo.cs b/src/Steeltoe.Tooling/Models/ServiceTypeInfo.cs similarity index 97% rename from src/Steeltoe.Tooling/ServiceTypeInfo.cs rename to src/Steeltoe.Tooling/Models/ServiceTypeInfo.cs index f9e4a68..c66b752 100644 --- a/src/Steeltoe.Tooling/ServiceTypeInfo.cs +++ b/src/Steeltoe.Tooling/Models/ServiceTypeInfo.cs @@ -14,7 +14,7 @@ using YamlDotNet.Serialization; -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// /// Specifies a service. diff --git a/src/Steeltoe.Tooling/TargetConfiguration.cs b/src/Steeltoe.Tooling/Models/TargetConfiguration.cs similarity index 94% rename from src/Steeltoe.Tooling/TargetConfiguration.cs rename to src/Steeltoe.Tooling/Models/TargetConfiguration.cs index f2b2773..6f80811 100644 --- a/src/Steeltoe.Tooling/TargetConfiguration.cs +++ b/src/Steeltoe.Tooling/Models/TargetConfiguration.cs @@ -15,10 +15,10 @@ using System.Collections.Generic; using YamlDotNet.Serialization; -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Models { /// - /// Rerpresents the configuration of a deployment target. + /// Represents the configuration of a deployment target. /// public class TargetConfiguration { diff --git a/src/Steeltoe.Tooling/Scanners/AppScanner.cs b/src/Steeltoe.Tooling/Scanners/AppScanner.cs index a93170f..ae0b0d2 100644 --- a/src/Steeltoe.Tooling/Scanners/AppScanner.cs +++ b/src/Steeltoe.Tooling/Scanners/AppScanner.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using Steeltoe.Tooling.Models; namespace Steeltoe.Tooling.Scanners { diff --git a/src/Steeltoe.Tooling/Steeltoe.Tooling.csproj b/src/Steeltoe.Tooling/Steeltoe.Tooling.csproj index 0090132..b3061e9 100644 --- a/src/Steeltoe.Tooling/Steeltoe.Tooling.csproj +++ b/src/Steeltoe.Tooling/Steeltoe.Tooling.csproj @@ -26,6 +26,6 @@ - + diff --git a/src/Steeltoe.Tooling/TemplateManager.cs b/src/Steeltoe.Tooling/Templaters/TemplateManager.cs similarity index 97% rename from src/Steeltoe.Tooling/TemplateManager.cs rename to src/Steeltoe.Tooling/Templaters/TemplateManager.cs index d57d637..ea098de 100644 --- a/src/Steeltoe.Tooling/TemplateManager.cs +++ b/src/Steeltoe.Tooling/Templaters/TemplateManager.cs @@ -3,7 +3,7 @@ using System.IO; using System.Reflection; using Antlr4.StringTemplate; -namespace Steeltoe.Tooling +namespace Steeltoe.Tooling.Templaters { /// /// Acts as a facade for template implementations. diff --git a/test/Steeltoe.Cli.Test/ListTemplatesFeature.cs b/test/Steeltoe.Cli.Test/ListTemplatesFeature.cs index 740160f..c7ef6e8 100644 --- a/test/Steeltoe.Cli.Test/ListTemplatesFeature.cs +++ b/test/Steeltoe.Cli.Test/ListTemplatesFeature.cs @@ -23,12 +23,12 @@ namespace Steeltoe.Cli.Test public void ListTemplatesHelp() { Runner.RunScenario( - given => a_dotnet_project("list_dependencies_help"), - when => the_developer_runs_cli_command("list-deps --help"), + given => a_dotnet_project("list_templates_help"), + when => the_developer_runs_cli_command("list-templates --help"), then => the_cli_should_output(new[] { - "Displays a list of available dependencies", - $"Usage: {Program.Name} list-deps [options]", + "Displays a list of available templates", + $"Usage: {Program.Name} list-templates [options]", "Options:", "-?|-h|--help Show help information", "Overview:", @@ -41,8 +41,8 @@ namespace Steeltoe.Cli.Test public void ListTemplatesTooManyArgs() { Runner.RunScenario( - given => a_dotnet_project("list_dependencies_too_many_args"), - when => the_developer_runs_cli_command("list-deps arg1"), + given => a_dotnet_project("list_templates_too_many_args"), + when => the_developer_runs_cli_command("list-templates arg1"), then => the_cli_should_fail_parse("Unrecognized command or argument 'arg1'") ); } diff --git a/test/Steeltoe.Tooling.Test/ContextTest.cs b/test/Steeltoe.Tooling.Test/ContextTest.cs index 6d30b89..8b0b02e 100644 --- a/test/Steeltoe.Tooling.Test/ContextTest.cs +++ b/test/Steeltoe.Tooling.Test/ContextTest.cs @@ -13,6 +13,7 @@ // limitations under the License. using Shouldly; +using Steeltoe.Tooling.Models; using Xunit; namespace Steeltoe.Tooling.Test diff --git a/test/Steeltoe.Tooling.Test/ConfigurationTest.cs b/test/Steeltoe.Tooling.Test/Models/ConfigurationTest.cs similarity index 99% rename from test/Steeltoe.Tooling.Test/ConfigurationTest.cs rename to test/Steeltoe.Tooling.Test/Models/ConfigurationTest.cs index b2d2b23..46924bf 100644 --- a/test/Steeltoe.Tooling.Test/ConfigurationTest.cs +++ b/test/Steeltoe.Tooling.Test/Models/ConfigurationTest.cs @@ -13,9 +13,10 @@ // limitations under the License. using Shouldly; +using Steeltoe.Tooling.Models; using Xunit; -namespace Steeltoe.Tooling.Test +namespace Steeltoe.Tooling.Test.Models { public class ConfigurationTest : ToolingTest { diff --git a/test/Steeltoe.Tooling.Test/RegistryConfigurationTest.cs b/test/Steeltoe.Tooling.Test/Models/RegistryConfigurationTest.cs similarity index 99% rename from test/Steeltoe.Tooling.Test/RegistryConfigurationTest.cs rename to test/Steeltoe.Tooling.Test/Models/RegistryConfigurationTest.cs index f20d68a..36bc104 100644 --- a/test/Steeltoe.Tooling.Test/RegistryConfigurationTest.cs +++ b/test/Steeltoe.Tooling.Test/Models/RegistryConfigurationTest.cs @@ -13,6 +13,7 @@ // limitations under the License. using Shouldly; +using Steeltoe.Tooling.Models; using Xunit; namespace Steeltoe.Tooling.Test diff --git a/test/Steeltoe.Tooling.Test/RegistryTest.cs b/test/Steeltoe.Tooling.Test/Models/RegistryTest.cs similarity index 96% rename from test/Steeltoe.Tooling.Test/RegistryTest.cs rename to test/Steeltoe.Tooling.Test/Models/RegistryTest.cs index af7037e..23c5ab8 100644 --- a/test/Steeltoe.Tooling.Test/RegistryTest.cs +++ b/test/Steeltoe.Tooling.Test/Models/RegistryTest.cs @@ -14,9 +14,10 @@ using System.Collections.Generic; using Shouldly; +using Steeltoe.Tooling.Models; using Xunit; -namespace Steeltoe.Tooling.Test +namespace Steeltoe.Tooling.Test.Models { public class RegistryTest : ToolingTest { diff --git a/test/Steeltoe.Tooling.Test/ToolingTest.cs b/test/Steeltoe.Tooling.Test/ToolingTest.cs index 56d8ccf..cc8c631 100644 --- a/test/Steeltoe.Tooling.Test/ToolingTest.cs +++ b/test/Steeltoe.Tooling.Test/ToolingTest.cs @@ -15,6 +15,7 @@ using System; using System.IO; using System.Linq; +using Steeltoe.Tooling.Models; namespace Steeltoe.Tooling.Test {