diff --git a/GBase.Client/Factories/IGBaseClientFactory.cs b/GBase.Client/Factories/IGBaseClientFactory.cs new file mode 100644 index 0000000..dd1a879 --- /dev/null +++ b/GBase.Client/Factories/IGBaseClientFactory.cs @@ -0,0 +1,22 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using GBase.Client.Interfaces; + +namespace GBase.Client.Factories +{ + /// + /// Factory for the + /// + public interface IGBaseClientFactory + { + /// + /// Creates an + /// + /// The for this client + /// A newly created instance of the implementation for + IGBaseClient Create(IGBaseClientSettings settings); + } +} \ No newline at end of file diff --git a/GBase.Client/Factories/IGBaseClientSettingsFactory.cs b/GBase.Client/Factories/IGBaseClientSettingsFactory.cs new file mode 100644 index 0000000..3c032e5 --- /dev/null +++ b/GBase.Client/Factories/IGBaseClientSettingsFactory.cs @@ -0,0 +1,29 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using System.Net; +using GBase.Api.Communication; +using GBase.Client.Interfaces; + +namespace GBase.Client.Factories +{ + /// + /// Factory for the + /// + public interface IGBaseClientSettingsFactory + { + /// + /// Creates an + /// + /// The + /// The + /// The port + /// The GBase endpoint + /// The GBaseTable endpoint + /// The GBaseEntry endpoint + /// A newly created instance of the implementation for + IGBaseClientSettings Create(ServerProtocol protocol, IPAddress ipAddress, int port, string gBaseEndpoint, string gBaseTableEndpoint, string gBaseEntryEndpoint); + } +} \ No newline at end of file diff --git a/GBase.Client/Factories/IGBaseEntryServiceFactory.cs b/GBase.Client/Factories/IGBaseEntryServiceFactory.cs new file mode 100644 index 0000000..c9f3feb --- /dev/null +++ b/GBase.Client/Factories/IGBaseEntryServiceFactory.cs @@ -0,0 +1,24 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using GBase.Api.Communication; +using GBase.Api.Services; + +namespace GBase.Client.Factories +{ + /// + /// Factory for the + /// + public interface IGBaseEntryServiceFactory + { + /// + /// Creates an + /// + /// The + /// The endpoint for the GBase + /// A newly created instance of the implementation for + IGBaseEntryService Create(ServerProtocol serverProtocol, string endpoint); + } +} \ No newline at end of file diff --git a/GBase.Client/Factories/IGBaseServiceFactory.cs b/GBase.Client/Factories/IGBaseServiceFactory.cs new file mode 100644 index 0000000..a08b9c6 --- /dev/null +++ b/GBase.Client/Factories/IGBaseServiceFactory.cs @@ -0,0 +1,24 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using GBase.Api.Communication; +using GBase.Api.Services; + +namespace GBase.Client.Factories +{ + /// + /// Factory for the + /// + public interface IGBaseServiceFactory + { + /// + /// Creates an + /// + /// The + /// The endpoint for the GBase + /// A newly created instance of the implementation for + IGBaseService Create(ServerProtocol serverProtocol, string endpoint); + } +} \ No newline at end of file diff --git a/GBase.Client/Factories/IGBaseTableServiceFactory.cs b/GBase.Client/Factories/IGBaseTableServiceFactory.cs new file mode 100644 index 0000000..45c1d0e --- /dev/null +++ b/GBase.Client/Factories/IGBaseTableServiceFactory.cs @@ -0,0 +1,24 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using GBase.Api.Communication; +using GBase.Api.Services; + +namespace GBase.Client.Factories +{ + /// + /// Factory for the + /// + public interface IGBaseTableServiceFactory + { + /// + /// Creates an + /// + /// The + /// The endpoint for the GBase + /// A newly created instance of the implementation for + IGBaseTableService Create(ServerProtocol serverProtocol, string endpoint); + } +} \ No newline at end of file diff --git a/GBase.Client/GBase.Client.csproj b/GBase.Client/GBase.Client.csproj index fe4029e..1d29d6e 100644 --- a/GBase.Client/GBase.Client.csproj +++ b/GBase.Client/GBase.Client.csproj @@ -27,6 +27,7 @@ + diff --git a/GBase.Client/GBase.Client.xml b/GBase.Client/GBase.Client.xml index 459fc68..b86ed1e 100644 --- a/GBase.Client/GBase.Client.xml +++ b/GBase.Client/GBase.Client.xml @@ -4,16 +4,87 @@ GBase.Client + + + Factory for the + + + + + Creates an + + The for this client + A newly created instance of the implementation for + + + + Factory for the + + + + + Creates an + + The + The + The port + The GBase endpoint + The GBaseTable endpoint + The GBaseEntry endpoint + A newly created instance of the implementation for + + + + Factory for the + + + + + Creates an + + The + The endpoint for the GBase + A newly created instance of the implementation for + + + + Factory for the + + + + + Creates an + + The + The endpoint for the GBase + A newly created instance of the implementation for + + + + Factory for the + + + + + Creates an + + The + The endpoint for the GBase + A newly created instance of the implementation for + A client for the GBase - + A client for the GBase The for this client + The + The + The @@ -97,6 +168,14 @@ Complete GBaseEntry endpoint address based on the + + + for the + + + + + A client for the GBase diff --git a/GBase.Client/GBaseClient.cs b/GBase.Client/GBaseClient.cs index 42648a1..9ad9bfe 100644 --- a/GBase.Client/GBaseClient.cs +++ b/GBase.Client/GBaseClient.cs @@ -4,8 +4,8 @@ using System.Threading.Tasks; using GBase.Api.Services; +using GBase.Client.Factories; using GBase.Client.Interfaces; -using GBase.Client.Services; namespace GBase.Client { @@ -18,11 +18,14 @@ namespace GBase.Client /// A client for the GBase /// /// The for this client - public GBaseClient(IGBaseClientSettings settings) + /// The + /// The + /// The + public GBaseClient(IGBaseClientSettings settings, IGBaseServiceFactory gBaseServiceFactory, IGBaseTableServiceFactory gBaseTableServiceFactory, IGBaseEntryServiceFactory gBaseEntryServiceFactory) { - GBase = new GBaseService(settings.Protocol, settings.ServerProtocolGBaseEndpointAddress); - GBaseTable = new GBaseTableService(settings.Protocol, settings.ServerProtocolGBaseTableEndpointAddress); - GBaseEntry = new GBaseEntryService(settings.Protocol, settings.ServerProtocolGBaseEntryEndpointAddress); + GBase = gBaseServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEndpointAddress); + GBaseTable = gBaseTableServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseTableEndpointAddress); + GBaseEntry = gBaseEntryServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEntryEndpointAddress); } /// diff --git a/GBase.Client/Installers/GBaseClientInstaller.cs b/GBase.Client/Installers/GBaseClientInstaller.cs new file mode 100644 index 0000000..59aba60 --- /dev/null +++ b/GBase.Client/Installers/GBaseClientInstaller.cs @@ -0,0 +1,41 @@ +// Author: Gockner, Simon +// Created: 2020-02-12 +// Copyright(c) 2020 SimonG. All Rights Reserved. + + +using GBase.Api.Services; +using GBase.Client.Factories; +using GBase.Client.Interfaces; +using GBase.Client.Services; +using LightweightIocContainer.Interfaces; +using LightweightIocContainer.Interfaces.Installers; + +namespace GBase.Client.Installers +{ + /// + /// for the + /// + public class GBaseClientInstaller : IIocInstaller + { + /// + public void Install(IIocContainer container) + { + container.Register(); + container.Register(); + + //services + container.Register(); + container.Register(); + container.Register(); + + //factories + container.RegisterFactory(); + container.RegisterFactory(); + + //service factories + container.RegisterFactory(); + container.RegisterFactory(); + container.RegisterFactory(); + } + } +} \ No newline at end of file diff --git a/Test.GBase.Client/IntegrationTest.cs b/Test.GBase.Client/IntegrationTest.cs index 6d34e73..645dd82 100644 --- a/Test.GBase.Client/IntegrationTest.cs +++ b/Test.GBase.Client/IntegrationTest.cs @@ -1,7 +1,9 @@ using System.Net; using GBase.Api.Communication; using GBase.Client; +using GBase.Client.Factories; using GBase.Client.Interfaces; +using Moq; using NUnit.Framework; namespace Test.GBase.Client @@ -21,7 +23,7 @@ namespace Test.GBase.Client IGBaseClientSettings settings = new GBaseClientSettings(ServerProtocol.Http, IPAddress.Parse("127.0.0.1"), 8080, "/GBase", "/GBaseTable", "/GBaseEntry"); - IGBaseClient client = new GBaseClient(settings); + IGBaseClient client = new GBaseClient(settings, new Mock().Object, new Mock().Object, new Mock().Object); bool ret = client.GBase.AddTable(); Assert.True(ret); diff --git a/Test.GBase.Client/Test.GBase.Client.csproj b/Test.GBase.Client/Test.GBase.Client.csproj index 80ee7d0..be2366c 100644 --- a/Test.GBase.Client/Test.GBase.Client.csproj +++ b/Test.GBase.Client/Test.GBase.Client.csproj @@ -7,6 +7,7 @@ + all