diff --git a/Makefile b/Makefile index 47e678dd..a6c0e7f8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ include versioning.mk SUBDIRS=Yavsc Yavsc.Server Yavsc.Abstract cli test -all: deploy-pkgs +all: $(SUBDIRS) Yavsc.Abstract: $(MAKE) -C Yavsc.Abstract VERSION=$(VERSION) diff --git a/Yavsc.Abstract/IT/IProject.cs b/Yavsc.Abstract/IT/IProject.cs new file mode 100644 index 00000000..e15fb067 --- /dev/null +++ b/Yavsc.Abstract/IT/IProject.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace Yavsc.Abstract.IT +{ + public interface IProject + { + long Id { get; set ; } + string OwnerId { get; set; } + string Name { get; set; } + string Version { get; set; } + + IEnumerable GetConfigurations(); + } +} \ No newline at end of file diff --git a/Yavsc.Abstract/Interfaces/IBillingService.cs b/Yavsc.Abstract/Interfaces/IBillingService.cs index 83c592c4..5e123b36 100644 --- a/Yavsc.Abstract/Interfaces/IBillingService.cs +++ b/Yavsc.Abstract/Interfaces/IBillingService.cs @@ -26,7 +26,7 @@ namespace Yavsc.Services /// Identifiant du type de facturation /// Identifiant de la demande du client /// La facture - Task GetBillAsync(string billingCode, long queryId); + Task GetBillAsync(string billingCode, long queryId); /// /// All performer setting in this activity diff --git a/Yavsc.Abstract/Workflow/INominativeQuery.cs b/Yavsc.Abstract/Workflow/INominativeQuery.cs index f2eb2e58..e50770e2 100644 --- a/Yavsc.Abstract/Workflow/INominativeQuery.cs +++ b/Yavsc.Abstract/Workflow/INominativeQuery.cs @@ -2,7 +2,7 @@ using System; namespace Yavsc.Abstract.Workflow { - public interface INominativeQuery: IQuery + public interface IDecidableQuery: IQuery { bool Rejected { get; set; } DateTime RejectedAt { get; set; } diff --git a/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs b/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs index c60cdcd1..06ac44f5 100644 --- a/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs @@ -13,7 +13,7 @@ namespace Yavsc.Models.Billing using Yavsc.Abstract.Workflow; using Yavsc.Services; - public abstract class NominativeServiceCommand : IBaseTrackedEntity, INominativeQuery, IIdentified + public abstract class NominativeServiceCommand : IBaseTrackedEntity, IDecidableQuery, IIdentified { public string GetInvoiceId() { return GetType().Name + "/" + Id; } diff --git a/Yavsc.Server/Models/IT/Project.cs b/Yavsc.Server/Models/IT/Project.cs index b1b8a1f9..f371b066 100644 --- a/Yavsc.Server/Models/IT/Project.cs +++ b/Yavsc.Server/Models/IT/Project.cs @@ -1,37 +1,20 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using Yavsc.Abstract.IT; using Yavsc.Billing; using Yavsc.Models.Billing; using Yavsc.Server.Models.IT.SourceCode; namespace Yavsc.Server.Models.IT { - - public class ProjectBuildConfiguration - { - [Key] - public long Id { get; set; } - - [Required] - public string Name { get; set; } - - public long ProjectId { get; set; } - - [ForeignKey("ProjectId")] - public virtual Project TargetProject { get; set; } - - } - - - - - public class Project : NominativeServiceCommand + public class Project : NominativeServiceCommand, IProject { [Key] - public override long Id { get; set ; } + public override long Id { get; set; } public string OwnerId { get; set; } - + /// /// This field is something like a key, /// since it is required non null, @@ -51,22 +34,28 @@ namespace Yavsc.Server.Models.IT [ForeignKey("Name")] public virtual GitRepositoryReference Repository { get; set; } - List bill = new List (); + List bill = new List(); public void AddBillItem(IBillItem item) { bill.Add(item); - + } public override List GetBillItems() { return bill; } + + public IEnumerable GetConfigurations() + { + return Configurations.Select(c => c.Name); + } + string description; public override string Description => description; public Project() { - + } } } diff --git a/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs b/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs new file mode 100644 index 00000000..22dd4eac --- /dev/null +++ b/Yavsc.Server/Models/IT/ProjectBuildConfiguration.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Yavsc.Server.Models.IT +{ + public class ProjectBuildConfiguration + { + /// + /// A Numerical Id + /// + /// + [Key] + public long Id { get; set; } + + [Required] + public string Name { get; set; } + + public long ProjectId { get; set; } + + [ForeignKey("ProjectId")] + public virtual Project TargetProject { get; set; } + + } +} diff --git a/Yavsc/Services/BillingService.cs b/Yavsc/Services/BillingService.cs index 1af23c07..71837149 100644 --- a/Yavsc/Services/BillingService.cs +++ b/Yavsc/Services/BillingService.cs @@ -14,8 +14,8 @@ namespace Yavsc.Services { public ApplicationDbContext DbContext { get; private set; } private ILogger logger; - public static Dictionary> Billing = - new Dictionary> (); + public static Dictionary> Billing = + new Dictionary> (); public static List UserSettings = new List(); public static Dictionary GlobalBillingMap = @@ -31,12 +31,12 @@ namespace Yavsc.Services DbContext = dbContext; } - public Task GetBillAsync(string billingCode, long queryId) + public Task GetBillAsync(string billingCode, long queryId) { return Task.FromResult(GetBillable(DbContext,billingCode,queryId)); } - public static INominativeQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId ) => Billing[billingCode](context, queryId); + public static IDecidableQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId ) => Billing[billingCode](context, queryId); public async Task GetPerformerSettingsAsync(string activityCode, string userId) { return await (await GetPerformersSettingsAsync(activityCode)).SingleOrDefaultAsync(s=> s.UserId == userId); diff --git a/Yavsc/Startup/Startup.Workflow.cs b/Yavsc/Startup/Startup.Workflow.cs index 79ff33ae..98ede09f 100644 --- a/Yavsc/Startup/Startup.Workflow.cs +++ b/Yavsc/Startup/Startup.Workflow.cs @@ -81,7 +81,7 @@ mais n'implemente pas l'interface IQueryable } } - RegisterBilling(BillingCodes.Brush, new Func + RegisterBilling(BillingCodes.Brush, new Func ( ( db, id) => { var query = db.HairCutQueries.Include(q=>q.Prestation).Include(q=>q.Regularisation).Single(q=>q.Id == id) ; @@ -89,9 +89,9 @@ mais n'implemente pas l'interface IQueryable return query; })) ; - RegisterBilling(BillingCodes.MBrush,new Func + RegisterBilling(BillingCodes.MBrush,new Func ( (db, id) => db.HairMultiCutQueries.Include(q=>q.Regularisation).Single(q=>q.Id == id))); - RegisterBilling(BillingCodes.Rdv, new Func + RegisterBilling(BillingCodes.Rdv, new Func ( (db, id) => db.RdvQueries.Include(q=>q.Regularisation).Single(q=>q.Id == id))); } public static System.Reflection.Assembly OnYavscResourceResolve(object sender, ResolveEventArgs ev) @@ -99,7 +99,7 @@ mais n'implemente pas l'interface IQueryable return AppDomain.CurrentDomain.GetAssemblies()[0]; } - public static void RegisterBilling(string code, Func getter) where T : IBillable + public static void RegisterBilling(string code, Func getter) where T : IBillable { BillingService.Billing.Add(code,getter) ; BillingService.GlobalBillingMap.Add(typeof(T).Name,code); diff --git a/test/BaseTestContext.cs b/test/BaseTestContext.cs new file mode 100644 index 00000000..2254ac22 --- /dev/null +++ b/test/BaseTestContext.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.Dnx.Compilation.CSharp; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.PlatformAbstractions; +using Xunit.Abstractions; + +namespace test +{ + public class BaseTestContext { + + protected IApplicationEnvironment applicationEnvironment = null; + protected IServiceProvider serviceProvider = null; + protected IConfigurationRoot configurationRoot; + protected BeforeCompileContext beforeCompileContext; + protected IServiceProvider provider; + protected IConfigurationRoot configuration; + protected readonly ITestOutputHelper _output; + protected ServerSideFixture _serverFixture; + + public BaseTestContext(ITestOutputHelper output, ServerSideFixture serverFixture) + { + this._output = output; + this._serverFixture = serverFixture; + } + } +} \ No newline at end of file diff --git a/test/src/EMailling.cs b/test/Mandatory/EMailling.cs similarity index 90% rename from test/src/EMailling.cs rename to test/Mandatory/EMailling.cs index 6c58b483..9f0e14fd 100644 --- a/test/src/EMailling.cs +++ b/test/Mandatory/EMailling.cs @@ -1,18 +1,13 @@ -using System; -using Microsoft.AspNet.Hosting; -using Microsoft.AspNet.Hosting.Internal; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.OptionsModel; using Xunit; using Xunit.Abstractions; using Yavsc.Abstract.Manage; -using Yavsc.Lib; -using Yavsc.Services; namespace test { [Collection("EMaillingTeststCollection")] + [Trait("regres", "no")] public class EMaillingTests : IClassFixture { diff --git a/test/src/YavscDnxUnitTests.cs b/test/Mandatory/NodeTests.cs similarity index 94% rename from test/src/YavscDnxUnitTests.cs rename to test/Mandatory/NodeTests.cs index 071560db..e6e5c96c 100755 --- a/test/src/YavscDnxUnitTests.cs +++ b/test/Mandatory/NodeTests.cs @@ -1,15 +1,13 @@ using System; using Xunit; using System.IO; -using System.Threading.Tasks; using System.Diagnostics; -using Yavsc.Helpers; namespace test { - - [Trait("noregres", "yes")] - public class YavscDnxUnitTests + + [Trait("regres", "no")] + public class NodeTests { [Fact] void TestNodeJsForAnsitohtml () diff --git a/test/src/ServerSideFixture.cs b/test/Mandatory/ServerSideFixture.cs similarity index 93% rename from test/src/ServerSideFixture.cs rename to test/Mandatory/ServerSideFixture.cs index bf6d7d39..ef56ef62 100644 --- a/test/src/ServerSideFixture.cs +++ b/test/Mandatory/ServerSideFixture.cs @@ -6,9 +6,11 @@ using Microsoft.Extensions.OptionsModel; using Yavsc.Lib; using Yavsc.Services; using Yavsc; +using Xunit; namespace test { + [Trait("regres", "no")] public class ServerSideFixture : IDisposable { public SiteSettings _siteSetup; public ILogger _logger; @@ -19,13 +21,13 @@ namespace test public ServerSideFixture() { - InitServices(); + InitTestHost(); _logger = _loggerFactory.CreateLogger (); _logger.LogInformation("ServerSideFixture"); } - - void InitServices() + [Fact] + void InitTestHost() { var host = new WebHostBuilder(); diff --git a/test/src/YavscMandatory.cs b/test/Mandatory/YavscMandatory.cs similarity index 91% rename from test/src/YavscMandatory.cs rename to test/Mandatory/YavscMandatory.cs index d6f24f0c..73297826 100755 --- a/test/src/YavscMandatory.cs +++ b/test/Mandatory/YavscMandatory.cs @@ -25,29 +25,17 @@ using System.Linq; namespace test { - public class BaseTestContext { - protected IApplicationEnvironment applicationEnvironment = null; - protected IServiceProvider serviceProvider = null; - protected IConfigurationRoot configurationRoot; - protected BeforeCompileContext beforeCompileContext; - protected string testprojectAssetPath = "/home/paul/workspace/yavsc/Yavsc"; - - protected IServiceProvider provider; - protected IConfigurationRoot configuration; - } + [Collection("Yavsc mandatory success story")] - [Trait("noregres", "yes")] + [Trait("regres", "no")] public class YavscMandatory: BaseTestContext, IClassFixture { - private readonly ITestOutputHelper _output; - ServerSideFixture _serverFixture; - public YavscMandatory(ITestOutputHelper output, ServerSideFixture serverFixture) + + public YavscMandatory(ITestOutputHelper output, ServerSideFixture fixture) : base (output, fixture) { - this._output = output; - this._serverFixture = serverFixture; - } + } [Fact] public void GitClone() { diff --git a/test/src/Startup.cs b/test/Startup.cs similarity index 98% rename from test/src/Startup.cs rename to test/Startup.cs index 080e00ba..d9acab2d 100644 --- a/test/src/Startup.cs +++ b/test/Startup.cs @@ -11,7 +11,6 @@ using Yavsc; using Yavsc.Models; using Yavsc.Services; using Microsoft.Data.Entity; -using Microsoft.AspNet.Authentication; using Microsoft.Extensions.WebEncoders; using Yavsc.Lib; diff --git a/test/src/TestHelpers.cs b/test/TestHelpers.cs similarity index 100% rename from test/src/TestHelpers.cs rename to test/TestHelpers.cs diff --git a/test/WIP/NotWorking.cs b/test/WIP/NotWorking.cs new file mode 100644 index 00000000..01f9e08c --- /dev/null +++ b/test/WIP/NotWorking.cs @@ -0,0 +1,47 @@ +// // NotWorking.cs +// /* +// paul 21/06/2018 10:16 20182018 6 21 +// */ +using System; +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.OptionsModel; +using Xunit; +using Yavsc; +using Microsoft.AspNet.Hosting; +using Microsoft.Dnx.TestHost.TestAdapter; +using Xunit.Abstractions; + +namespace test +{ + [Collection("Yavsc dropped intents")] + [Trait("regres", "yes")] + public class NotWorking : BaseTestContext + { + SourceInformationProvider _sourceInfoProvider; + IOptions _localizationOptions; + public NotWorking( IHostingEnvironment env , IOptions siteSettings, + SourceInformationProvider sourceInfoProvider, + IOptions localizationOptions, + ServerSideFixture serverFixture, ITestOutputHelper output + ) : base (output, serverFixture) { + _sourceInfoProvider = sourceInfoProvider; + _localizationOptions = localizationOptions; + } + + public void StringLocalizer() + { + // TODO build applicationEnvironment + ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory + (applicationEnvironment, _localizationOptions); + IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking)); + } + + public void NoDnxEnv() + { + + IOptions localOptions = Activator.CreateInstance>(); + ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions); + IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking)); + } + } +} diff --git a/test/src/YavscWorkInProgress.cs b/test/WIP/YavscWorkInProgress.cs similarity index 92% rename from test/src/YavscWorkInProgress.cs rename to test/WIP/YavscWorkInProgress.cs index 2d8dfe07..52a4dd43 100644 --- a/test/src/YavscWorkInProgress.cs +++ b/test/WIP/YavscWorkInProgress.cs @@ -14,19 +14,13 @@ using static OAuth.AspNet.AuthServer.Constants; namespace test { [Collection("Yavsc Work In Progress")] - [Trait("noregres", "no")] + [Trait("regres", "yes")] public class YavscWorkInProgress : BaseTestContext, IClassFixture { - - ServerSideFixture _serverFixture; - ITestOutputHelper output; public YavscWorkInProgress(ServerSideFixture serverFixture, ITestOutputHelper output) + : base (output, serverFixture) { - this.output = output; - _serverFixture = serverFixture; } - - [Theory] [InlineData("d9be5e97-c19d-42e4-b444-0e65863b19e1","blouh","profile", diff --git a/test/src/YavscServerFactory.cs b/test/YavscServerFactory.cs similarity index 97% rename from test/src/YavscServerFactory.cs rename to test/YavscServerFactory.cs index 36b0c9da..8ee6e044 100644 --- a/test/src/YavscServerFactory.cs +++ b/test/YavscServerFactory.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using Microsoft.AspNet.Hosting.Server; using Microsoft.AspNet.Http.Features; using Microsoft.Extensions.Configuration; -using Yavsc.Models; namespace Yavsc.Server { diff --git a/test/src/NotWorking.cs b/test/src/NotWorking.cs deleted file mode 100644 index f08bab58..00000000 --- a/test/src/NotWorking.cs +++ /dev/null @@ -1,54 +0,0 @@ -// // NotWorking.cs -// /* -// paul 21/06/2018 10:16 20182018 6 21 -// */ -using System; -using Microsoft.AspNet.Builder; -using Microsoft.Extensions.Localization; -using Microsoft.Extensions.OptionsModel; -using Microsoft.Extensions.PlatformAbstractions; -using Xunit; -using Microsoft.Dnx.Compilation.CSharp; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Configuration; -using Microsoft.AspNet.Builder.Internal; -using Yavsc; -using Microsoft.Extensions.Logging; - -namespace test -{ - [Collection("Yavsc dropped intents")] - public class NotWorking : BaseTestContext - { - - public void StringLocalizer() - { - var services = new ServiceCollection(); - // IHostingEnvironment env = null; - // IOptions siteSettings; - - services.AddTransient( - svs => PlatformServices.Default.Runtime - ); - beforeCompileContext = YavscMandatory.CreateYavscCompilationContext(); - var prjDir = beforeCompileContext.ProjectContext.ProjectDirectory; - YavscMandatory.ConfigureServices(services, prjDir, out configuration, out provider); - - IApplicationBuilder app = new ApplicationBuilder(provider); - var rtd = app.Build(); - IOptions localOptions = Activator.CreateInstance>(); ; - // TODO build applicationEnvironment - ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory - (applicationEnvironment, localOptions); - IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking)); - } - - public void NoDnxEnv() - { - - IOptions localOptions = Activator.CreateInstance>(); - ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions); - IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking)); - } - } -}