public TerminalCommandHandlers(
            IAuthoredEventStore eventStore,
            IInMemoryAuthoredEventStore inMemoryEventStore,
            ITerminalAdapter terminalAdapter,
            ei8.Data.ExternalReference.Port.Adapter.In.InProcess.IItemAdapter externalReferenceAdapter,
            IValidationClient validationClient,
            INeuronGraphQueryClient neuronGraphQueryClient,
            ISettingsService settingsService
            )
        {
            AssertionConcern.AssertArgumentNotNull(eventStore, nameof(eventStore));
            AssertionConcern.AssertArgumentNotNull(inMemoryEventStore, nameof(inMemoryEventStore));
            AssertionConcern.AssertArgumentNotNull(terminalAdapter, nameof(terminalAdapter));
            AssertionConcern.AssertArgumentNotNull(externalReferenceAdapter, nameof(externalReferenceAdapter));
            AssertionConcern.AssertArgumentNotNull(validationClient, nameof(validationClient));
            AssertionConcern.AssertArgumentNotNull(neuronGraphQueryClient, nameof(neuronGraphQueryClient));
            AssertionConcern.AssertArgumentNotNull(settingsService, nameof(settingsService));

            this.eventStore               = (IAuthoredEventStore)eventStore;
            this.inMemoryEventStore       = (IInMemoryAuthoredEventStore)inMemoryEventStore;
            this.terminalAdapter          = terminalAdapter;
            this.externalReferenceAdapter = externalReferenceAdapter;
            this.validationClient         = validationClient;
            this.neuronGraphQueryClient   = neuronGraphQueryClient;
            this.settingsService          = settingsService;
        }
        public NeuronCommandHandlers(
            IAuthoredEventStore eventStore,
            IInMemoryAuthoredEventStore inMemoryEventStore,
            INeuronAdapter neuronAdapter,
            ei8.Data.Tag.Port.Adapter.In.InProcess.IItemAdapter tagItemAdapter,
            ei8.Data.Aggregate.Port.Adapter.In.InProcess.IItemAdapter aggregateItemAdapter,
            ei8.Data.ExternalReference.Port.Adapter.In.InProcess.IItemAdapter externalReferenceAdapter,
            IValidationClient validationClient,
            ISettingsService settingsService
            )
        {
            AssertionConcern.AssertArgumentNotNull(neuronAdapter, nameof(neuronAdapter));
            AssertionConcern.AssertArgumentNotNull(eventStore, nameof(eventStore));
            AssertionConcern.AssertArgumentNotNull(inMemoryEventStore, nameof(inMemoryEventStore));
            AssertionConcern.AssertArgumentNotNull(tagItemAdapter, nameof(tagItemAdapter));
            AssertionConcern.AssertArgumentNotNull(aggregateItemAdapter, nameof(aggregateItemAdapter));
            AssertionConcern.AssertArgumentNotNull(externalReferenceAdapter, nameof(externalReferenceAdapter));
            AssertionConcern.AssertArgumentNotNull(validationClient, nameof(validationClient));
            AssertionConcern.AssertArgumentNotNull(settingsService, nameof(settingsService));

            this.neuronAdapter            = neuronAdapter;
            this.eventStore               = (IAuthoredEventStore)eventStore;
            this.inMemoryEventStore       = (IInMemoryAuthoredEventStore)inMemoryEventStore;
            this.tagItemAdapter           = tagItemAdapter;
            this.aggregateItemAdapter     = aggregateItemAdapter;
            this.externalReferenceAdapter = externalReferenceAdapter;
            this.validationClient         = validationClient;
            this.settingsService          = settingsService;
        }
Exemple #3
0
 public void Setup()
 {
     _mockGitHubClient     = Substitute.For <IGitHubClient>();
     _mockValidationClient = Substitute.For <IValidationClient>();
     _mockGitHubReporter   = Substitute.For <IGitHubReporter>();
     _repositoryValidator  = new RepositoryValidatorEndpoint(_mockGitHubClient, _mockValidationClient, _mockGitHubReporter);
     _mockDurableClient    = Substitute.For <IDurableOrchestrationClient>();
 }
        public NeuronQueryService(INeuronGraphQueryClient graphQueryClient, IValidationClient validationClient, ISettingsService settingsService)
        {
            AssertionConcern.AssertArgumentNotNull(graphQueryClient, nameof(graphQueryClient));
            AssertionConcern.AssertArgumentNotNull(validationClient, nameof(validationClient));
            AssertionConcern.AssertArgumentNotNull(settingsService, nameof(settingsService));

            this.graphQueryClient = graphQueryClient;
            this.validationClient = validationClient;
            this.settingsService  = settingsService;
        }
        private static async Task <QueryResult <Terminal> > ConvertProcessValidate(
            Graph.Common.QueryResult commonResult,
            string userId,
            IValidationClient validationClient,
            ISettingsService settingsService,
            CancellationToken token
            )
        {
            var result = commonResult.ToInternalType(n => n.Terminal.ToInternalType());

            result.Items = await result.Items.ProcessValidate(
                userId,
                validationClient,
                settingsService,
                token
                );

            return(result);
        }
 public ValidationEngine(DocumentType dtd, IValidationClient client)
 {
     this.documentType=dtd;
     this.client=client;
 }
Exemple #7
0
 public ValidationEngine(DocumentType dtd, IValidationClient client)
 {
     this.documentType = dtd;
     this.client       = client;
 }
 public RepositoryValidatorEndpoint(IGitHubClient gitHubClient, IValidationClient validationClient, IGitHubReporter gitHubReporter)
 {
     _gitHubClient     = gitHubClient ?? throw new ArgumentNullException(nameof(gitHubClient));
     _validationClient = validationClient ?? throw new ArgumentNullException(nameof(validationClient));
     _gitHubReporter   = gitHubReporter ?? throw new ArgumentNullException(nameof(gitHubReporter));
 }
Exemple #9
0
        internal async static Task <IEnumerable <Terminal> > ProcessValidate(this IEnumerable <Terminal> terminals, string userId, IValidationClient validationClient, ISettingsService settingsService, CancellationToken token)
        {
            // validate read
            var validationResults = await validationClient.ReadNeurons(
                settingsService.IdentityAccessOutBaseUrl + "/",
                terminals.Select(t => Guid.Parse(t.PresynapticNeuronId)),
                userId,
                token
                );

            var resultTerminals = terminals.ToList();

            // mask neurons with errors from result set
            validationResults.NeuronValidationResults
            .Where(nv => nv.Errors.Count() > 0)
            .ToList()
            .ForEach(nv =>
                     resultTerminals.Where(te => te.PresynapticNeuronId == nv.NeuronId.ToString())
                     .ToList()
                     .ForEach(tef => tef.RestrictAccess(
                                  AccessType.Read,
                                  "Presynaptic Errors: " + string.Join("; ", nv.Errors.Select(e => e.Description))
                                  )
                              )
                     );

            resultTerminals.ToList().ForEach(
                rt => rt.UpdateTerminal(validationResults.UserNeuronId.ToString(), settingsService.TerminalsUrl)
                );

            return(resultTerminals.ToArray());
        }
Exemple #10
0
        internal async static Task <IEnumerable <Neuron> > ProcessValidate(this IEnumerable <Neuron> neurons, string userId, IValidationClient validationClient, ISettingsService settingsService, CancellationToken token)
        {
            // validate read
            var validationResults = await validationClient.ReadNeurons(
                settingsService.IdentityAccessOutBaseUrl + "/",
                neurons.Select(n => Guid.Parse(n.Id)),
                userId,
                token
                );

            var resultNeurons = neurons.ToList();

            // mask neurons with errors from result set
            validationResults.NeuronValidationResults
            .Where(nv => nv.Errors.Count() > 0)
            .ToList()
            .ForEach(nv =>
                     resultNeurons.Where(ne => ne.Id == nv.NeuronId.ToString())
                     .ToList()
                     .ForEach(nef => nef.RestrictAccess(
                                  AccessType.Read,
                                  string.Join("; ", nv.Errors.Select(e => e.Description))
                                  )
                              )
                     );

            resultNeurons.ToList().ForEach(
                rn => {
                rn.Validation.IsCurrentUserCreationAuthor = rn.Creation?.Author.Id == validationResults.UserNeuronId.ToString();
                rn.Url = Uri.TryCreate(new Uri(settingsService.NeuronsUrl), rn.Id, out Uri nresult) ?
                         nresult.AbsoluteUri :
                         throw new InvalidOperationException($"URL generation failed for Neuron with Id '{rn.Id}'");

                if (rn.Terminal != null)
                {
                    rn.Terminal.UpdateTerminal(validationResults.UserNeuronId.ToString(), settingsService.TerminalsUrl);
                }
            }
                );

            return(resultNeurons.ToArray());
        }