public async Task Handle_WhenEFReturnsSuccessful_ReturnCorrectEvents() { long[] expectedEventIds = { 1, 2 }; long[] expectedEventTypeIds = { 1, 111 }; var filters = new EventFilters() { IncidentId = 1 }; var serviceUnderTest = new GetUncorrelatedEventsHandler(await MockFactory .IncidentContext(nameof(Handle_WhenEFReturnsSuccessful_ReturnCorrectEvents)) .ConfigureAwait(continueOnCapturedContext: false)); var request = new GetUncorrelatedEventsRequest(new PaginationMetadata(), filters, new DummyAuthenticatedUserContext()); var result = (await serviceUnderTest .Handle(request, new CancellationToken()) .ConfigureAwait(continueOnCapturedContext: false)).ToList(); for (int i = 0; i < expectedEventTypeIds.Length; i++) { Assert.AreEqual(expectedEventIds[i], result[i].Id); Assert.AreEqual(expectedEventTypeIds[i], result[i].EventTypeId); } }
public void Filter_WhenFilterIsEmpty_ReturnsInputQueryable() { var serviceUnderTest = new EventFilters(); var testInput = new List <Event>() { new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = "firstExpectedEvent" }, new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = "secondExpectedEvent" } }.AsQueryable(); var result = serviceUnderTest.Filter(testInput); Assert.AreEqual(2, result.Count()); }
public async Task <IActionResult> GetUncorrelatedEvents([FromQuery] PaginationMetadata pagination, [FromQuery] EventFilters filter) { var result = await _mediator.Send(new GetUncorrelatedEventsRequest(pagination, filter, _authContext)); return(Ok(result)); }
public IEnumerable <EventDto> GetByArgs(EventFilters args) { using (var repo = new EventRepository()) { return(repo.GetByArgs(args)); } }
public GetUncorrelatedEventsRequest(PaginationMetadata pagination, EventFilters filter, AuthenticatedUserContext userContext) : base(userContext) { Pagination = pagination; Filter = filter; }
/// <summary> /// Event Filters /// </summary> /// <returns></returns> public virtual EventFilters EventFilters() { var eventFilters = new EventFilters(); //eventFilters.Add(BoEventTypes.et_MENU_CLICK); eventFilters.Add(BoEventTypes.et_ALL_EVENTS); return(eventFilters); }
public void UpdateFilter(EventFilters filters) { _logger.LogInformation( "UpdateFilter called from connection with Id {0}.", new object[] { Context.ConnectionId }); _filterLookup.Upsert(Context.ConnectionId, filters); //No need to propagate to other Gateways as connectionIds are not shared. }
/// <summary> /// Конструктор /// </summary> public EventFilter(EventFilters filters) { Filters = filters; ObjNum = 0; KPNum = 0; ParamID = 0; CnlNums = null; }
public GetEventsRequest(long incidentId, PaginationMetadata pagination, EventFilters filter, AuthenticatedUserContext userContext) : base(userContext) { IncidentId = incidentId; Pagination = pagination; Filter = filter; }
public async Task <IActionResult> GetEvents([FromRoute] long incidentId, [FromQuery] PaginationMetadata pagination, [FromQuery] EventFilters filter) { var result = await _mediator.Send(new GetEventsRequest(incidentId, pagination, filter, _authContext)); Response.Headers.AddLinksHeader(CreateLinks(null, incidentId.ToString(), filter, pagination, GetMultipleRouteName)); return(Ok(result)); }
public void WithFilter_WhenPassedEmptyQueryable_ReturnsEmptyQueryable() { var serviceUnderTest = new EventFilters(); var testInput = new List <Event>().AsQueryable(); var result = testInput.WithFilter(serviceUnderTest); Assert.IsFalse(result.Any()); }
/// <summary> /// Конструктор /// </summary> public EventFilter(EventFilters filters) { Filters = filters; ObjNum = 0; KPNum = 0; ParamID = 0; ParamIDs = null; CnlNums = null; Statuses = null; Checked = false; }
public async Task <IActionResult> GetEvents([FromRoute] long incidentId, [FromQuery] PaginationMetadata pagination, [FromQuery] EventFilters filter) { var result = await _mediator .Send(new GetEventsRequest(incidentId, pagination, filter, AuthContext)) .ConfigureAwait(continueOnCapturedContext: false); var links = Links.CreatePaginatedLinks(EventRoutesByIncident.GetMultiple, pagination, filter, incidentId); return(OkIfFound(result, links)); }
public void ConfigureServices(IServiceCollection services) { Measurements.ConfigureMetrics(Environment.EnvironmentName); // services.AddSingleton<CountersKeep>(); var replicatorOptions = Configuration.GetAs <Replicator>(); var reader = ConfigureReader( Ensure.NotEmpty(replicatorOptions.Reader.ConnectionString, "Reader connection string"), replicatorOptions.Reader.Protocol, replicatorOptions.Reader.PageSize, services ); var sink = ConfigureSink( Ensure.NotEmpty(replicatorOptions.Sink.ConnectionString, "Sink connection string"), replicatorOptions.Sink.Protocol, replicatorOptions.Sink.Router, services ); var filter = EventFilters.GetFilter(replicatorOptions, reader); var prepareOptions = new PreparePipelineOptions( filter, Transformers.GetTransformer(replicatorOptions), 1, replicatorOptions.Transform?.BufferSize ?? 1 ); services.AddSingleton(prepareOptions); services.AddSingleton(reader); services.AddSingleton( new SinkPipeOptions( sink, replicatorOptions.Sink.PartitionCount, replicatorOptions.Sink.BufferSize ) ); services.AddSingleton <ICheckpointStore>( new FileCheckpointStore(replicatorOptions.Checkpoint.Path, 1000) ); services.AddHostedService <ReplicatorService>(); services.Configure <HostOptions>(opts => opts.ShutdownTimeout = TimeSpan.FromMinutes(5)); services.AddSingleton <CountersKeep>(); services.AddSpaStaticFiles(configuration => configuration.RootPath = "ClientApp/dist"); services.AddControllers(); services.AddCors(); }
public void EventFilter_WhenProvidedOnlyIncidentId_IsMatchFor_EventWithSameIncidentId() { var serviceUnderTest = new EventFilters() { IncidentId = 1 }; var testInput = new Event() { IncidentId = 1 }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsTrue(result); }
public void Filter_WhenProvidedOnlyEventTypes_IsMatchFor_EventWithIncludedEventType() { var serviceUnderTest = new EventFilters() { EventTypes = new long[] { 1, 3 } }; var testInput = new Event() { EventTypeId = 1 }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsTrue(result); }
public void Filter_WhenProvidedOnlyEventTypes_IsNotMatchForEventWithNotIncludedEventType() { var serviceUnderTest = new EventFilters(); serviceUnderTest.EventTypes.Add(1); serviceUnderTest.EventTypes.Add(3); var testInput = new Event() { EventTypeId = 2 }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsFalse(result); }
public void EventFilter_WhenProvidedOnlyIncidentId_IsNotMatchForEventWithDifferentIncidentId() { var serviceUnderTest = new EventFilters() { IncidentId = 1 }; var testInput = new Event() { IncidentId = 2 }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsFalse(result); }
public void EventFilter_WhenProvidedOnlyEndTime_IsNotMatchForEventWithOccurredTimeAfterEndTime() { var serviceUnderTest = new EventFilters() { EndTime = new DateTime(1970, 1, 1) }; var testInput = new Event() { Occurred = new DateTime(1971, 1, 1), }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsFalse(result); }
public static void SetDefaultEvents() { events = new EventFilters(); // Sempre adicionar MENU CLICK, se não os menus não abrem EventFilter filter = events.Add(BoEventTypes.et_MENU_CLICK); // Adiciona Click e ChooseFromList por default filter = events.Add(BoEventTypes.et_CLICK); filter = events.Add(BoEventTypes.et_CHOOSE_FROM_LIST); // Adiciona FormLoad para poder setar o filtro nos system forms filter = events.Add(BoEventTypes.et_FORM_LOAD); SBOApp.Application.SetFilter(events); }
public static void SetDefaultEvents() { events = new EventFilters(); // Sempre adicionar MENU CLICK, se não os menus não abrem EventFilter filter = events.Add(BoEventTypes.et_MENU_CLICK); // Adiciona Click e ChooseFromList por default filter = events.Add(BoEventTypes.et_CLICK); filter = events.Add(BoEventTypes.et_CHOOSE_FROM_LIST); // Adiciona FormLoad para poder setar o filtro nos system forms filter = events.Add(BoEventTypes.et_FORM_LOAD); SBOApp.Application.SetFilter(events); }
public void EventFilterIsMatchFor_WhenFilterIsEmpty_MatchesAnyEvent() { var serviceUnderTest = new EventFilters(); var testInput = new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = "firstExpectedEvent" }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsTrue(result); }
/// <summary> /// Конструктор /// </summary> public EventTableLight() { tableName = ""; fileModTime = DateTime.MinValue; lastFillTime = DateTime.MinValue; allEvents = new List <Event>(); filteredEvents = null; eventsCache = null; lastEventsCache = null; startEvNum = 0; lastEvCnt = 0; filters = EventFilters.None; objNumFilter = 0; kpNumFilter = 0; paramNumFilter = 0; cnlsFilter = null; }
public void EventFilter_WhenProvidedOnlyDataKey_IsNotMatchForEventWithoutMatchingKeyInData() { var serviceUnderTest = new EventFilters() { DataKey = "ExpectedKey" }; var testInput = new Event() { Data = JsonConvert.SerializeObject(new { IrrelevantProperty = "HelloWorld", UnexpectedKey = "IrrelevantValue", AnotherIrrelevantProperty = "IrrelevantValue" }) }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsFalse(result); }
public void WithFilter_WhenPassedQueryable_MatchesByDataKeyAndValueWhenEventsHaveEquivalentKeyAndValueInData() { var serviceUnderTest = new EventFilters() { DataKey = "HelloWorld", DataValue = "HelloWorld" }; var expectedEventTypeId = 2; var unexpectedEventTypeId = 1; var testInput = new List <Event>() { new Event() { IncidentId = 1, EventTypeId = unexpectedEventTypeId, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = "NotMatched" }, new Event() { IncidentId = 1, EventTypeId = expectedEventTypeId, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = JsonConvert.SerializeObject(new { IrrelevantProperty = "HelloWorld", HelloWorld = "HelloWorld", AnotherIrrelevantProperty = "IrrelevantValue" }) } }.AsQueryable(); var result = testInput.WithFilter(serviceUnderTest); Assert.AreEqual(1, result.Count()); Assert.AreEqual(expectedEventTypeId, result.First().EventTypeId); }
public void EventFilter_WhenProvidedDataKeyAndDataValue_IsMatchForEventWithMatchingKeyAndValueInData() { var serviceUnderTest = new EventFilters() { DataKey = "ExpectedKey", DataValue = "ExpectedValue" }; var testInput = new Event() { Data = JsonConvert.SerializeObject(new { IrrelevantProperty = "HelloWorld", ExpectedKey = "ExpectedValue", AnotherIrrelevantProperty = "IrrelevantValue" }) }; var result = serviceUnderTest.IsMatchFor(testInput); Assert.IsTrue(result); }
public void Filter_WhenPassedQueryable_ReturnsEmptyQueryableWhenNoEventsHaveEquivalentKeyInData() { var serviceUnderTest = new EventFilters() { DataKey = "HelloWorld" }; var expectedEventTypeId = 2; var unexpectedEventTypeId = 1; var testInput = new List <Event>() { new Event() { IncidentId = 1, EventTypeId = unexpectedEventTypeId, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = "NotMatched" }, new Event() { IncidentId = 1, EventTypeId = expectedEventTypeId, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1), Data = JsonConvert.SerializeObject(new { IrrelevantProperty = "IrrelevantValue", HelloBob = "IrrelevantValue", AnotherIrrelevantProperty = "IrrelevantValue" }) } }.AsQueryable(); var result = serviceUnderTest.Filter(testInput); Assert.AreEqual(0, result.Count()); }
public LinksHeader CreateLinks(string id, string incidentId, EventFilters filter, PaginationMetadata pagination, string routeName) { var _operationLinks = new OperationLinks() { Single = new SingleOperationLinks() { Get = _urlHelper.Link(GetSingleRouteName, new { id }), Post = _urlHelper.Link(PostSingleRouteName, new { }) }, Multiple = new MultipleOperationLinks() { Get = _urlHelper.Link(GetMultipleRouteName, new { }) } }; var _relationLinks = new RelationLinks() { Parent = new RelatedParentLinks() { Incident = _urlHelper.Link(IncidentsController.GetSingleRouteName, new { id = incidentId }) } }; return(new LinksHeader(filter, pagination, _urlHelper, routeName, _operationLinks, _relationLinks)); }
public void WithFilter_WhenPassedQueryable_ReturnsOnlyMatchingResultsAsQueryable() { var serviceUnderTest = new EventFilters() { IncidentId = 1, EventTypes = new long[] { 1 }, StartTime = new DateTime(1970, 1, 1), EndTime = new DateTime(1980, 3, 2) }; var testInput = new List <Event>() { new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1970, 1, 1), EventFired = new DateTime(1970, 1, 1) }, new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1975, 1, 1), EventFired = new DateTime(1975, 1, 1), Data = "firstExpectedEvent" }, new Event() { IncidentId = 2, EventTypeId = 1, Occurred = new DateTime(1981, 1, 1), EventFired = new DateTime(1981, 1, 1) }, new Event() { IncidentId = 1, EventTypeId = 2, Occurred = new DateTime(1976, 1, 1), EventFired = new DateTime(1976, 1, 1) }, new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1986, 2, 2), EventFired = new DateTime(1970, 1, 1) }, new Event() { IncidentId = 1, EventTypeId = 1, Occurred = new DateTime(1986, 1, 1), EventFired = new DateTime(1986, 2, 2) }, }.AsQueryable(); var result = testInput.WithFilter(serviceUnderTest); Assert.AreEqual(1, result.Count()); Assert.IsTrue(result.Select(ev => ev.Data).Contains("firstExpectedEvent")); }
public IStreamIngestorFactoryDescriptor WithEventFilterFactory(EventFilters.IEventFilterFactory eventFilterFactory) { _eventFilterFactory = eventFilterFactory; return this; }
/// <summary> /// Конструктор /// </summary> public EventTableLight() { tableName = ""; fileModTime = DateTime.MinValue; lastFillTime = DateTime.MinValue; allEvents = new List<Event>(); filteredEvents = null; eventsCache = null; lastEventsCache = null; startEvNum = 0; lastEvCnt = 0; filters = EventFilters.None; objNumFilter = 0; kpNumFilter = 0; paramNumFilter = 0; cnlsFilter = null; }
private static void DeclararEventos() { var eventFilters = new EventFilters(); eventFilters.Add(BoEventTypes.et_MENU_CLICK); try { #region :: Forms Cadastro Básico var formGrupoDeItens = new FormGrupoDeItens(); var formConfiguracaoPeneira = new FormConfiguracaoPeneira(); var formCertificado = new FormCertificado(); var formMetodoFinanceiro = new FormMetodoFinanceiro(); var formModalidade = new FormModalidade(); var formSafra = new FormSafra(); var formTipoOperacao = new FormTipoOperacao(); var formUnidadeComercial = new FormUnidadeComercial(); var formParticipante = new FormParticipante(); var formsCadastroBasico = new List <SAPHelper.Form>() { formGrupoDeItens, formConfiguracaoPeneira, formCertificado, formMetodoFinanceiro, formModalidade, formSafra, formTipoOperacao, formUnidadeComercial, formParticipante }; #endregion #region :: Forms Detalhe de Contrato var formPreContrato = new FormPreContrato(); var formContratoFinal = new FormContratoFinal(); var formPreContratoAberturaPorPeneira = new FormPreContratoAberturaPorPeneira(); var formContratoFinalAberturaPorPeneira = new FormContratoFinalAberturaPorPeneira(); var formPreContratoDetalheCertificado = new FormPreContratoDetalheCertificado(); var formContratoFinalDetalheCertificado = new FormContratoFinalDetalheCertificado(); var formPreContratoComissoes = new FormPreContratoComissoes(); var formContratoFinalComissoes = new FormContratoFinalComissoes(); var formsDetalheContrato = new List <SAPHelper.Form>() { formPreContratoAberturaPorPeneira, formContratoFinalAberturaPorPeneira, formPreContratoDetalheCertificado, formContratoFinalDetalheCertificado, formPreContratoComissoes, formContratoFinalComissoes }; #endregion #region :: Form SAP var formUsuarios = new FormUsuarios(); var formPedidoCompra = new FormPedidoCompra(); var formsPadraoSAP = new List <SAPHelper.Form>() { formUsuarios, formPedidoCompra }; #endregion #region :: Grupos de Forms var formsVisible = new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }; formsVisible.AddRange(formsCadastroBasico); formsVisible.AddRange(formsDetalheContrato); #endregion FormEvents.DeclararEventos(eventFilters, new List <MapEventsToForms>() { new MapEventsToForms(BoEventTypes.et_FORM_VISIBLE, formsVisible), new MapEventsToForms(BoEventTypes.et_FORM_LOAD, formsPadraoSAP), new MapEventsToForms(BoEventTypes.et_COMBO_SELECT, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal, formPreContratoComissoes, formContratoFinalComissoes }), new MapEventsToForms(BoEventTypes.et_VALIDATE, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }), new MapEventsToForms(BoEventTypes.et_CHOOSE_FROM_LIST, new List <SAPHelper.Form>() { formPreContrato, formPreContratoAberturaPorPeneira, formContratoFinal, formContratoFinalAberturaPorPeneira }), new MapEventsToForms(BoEventTypes.et_FORM_DATA_ADD, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal, formCertificado, formMetodoFinanceiro, formModalidade, formSafra, formTipoOperacao, formUnidadeComercial, formParticipante }), new MapEventsToForms(BoEventTypes.et_FORM_DATA_UPDATE, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal, formCertificado, formMetodoFinanceiro, formModalidade, formSafra, formTipoOperacao, formUnidadeComercial, formParticipante }), new MapEventsToForms(BoEventTypes.et_FORM_DATA_LOAD, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }), new MapEventsToForms(BoEventTypes.et_FORM_CLOSE, new List <SAPHelper.Form>() { formPreContratoDetalheCertificado, formPreContratoComissoes, formContratoFinalDetalheCertificado, formContratoFinalComissoes, formContratoFinal }), new MapEventsToForms(BoEventTypes.et_ITEM_PRESSED, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal, formPreContratoAberturaPorPeneira, formPreContratoDetalheCertificado, formPreContratoComissoes, formContratoFinalAberturaPorPeneira, formContratoFinalDetalheCertificado, formContratoFinalComissoes, formGrupoDeItens, formConfiguracaoPeneira, formPedidoCompra }), new MapEventsToForms(BoEventTypes.et_MATRIX_LINK_PRESSED, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }), new MapEventsToForms(BoEventTypes.et_DOUBLE_CLICK, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }), }); var formsAdicionarNovo = new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }; formsAdicionarNovo.AddRange(formsCadastroBasico); FormEvents.DeclararEventosInternos(EventosInternos.AdicionarNovo, formsAdicionarNovo); FormEvents.DeclararEventosInternos(EventosInternos.Pesquisar, new List <SAPHelper.Form>() { formPreContrato, formContratoFinal }); FormEvents.DeclararEventosInternos(EventosInternos.Duplicar, formPedidoCompra); } catch (Exception e) { Dialogs.PopupError("Erro ao declarar eventos de formulário.\nErro: " + e.Message); } try { Global.SBOApplication.SetFilter(eventFilters); } catch (Exception e) { Dialogs.PopupError("Erro ao setar eventos declarados da aplicação.\nErro: " + e.Message); } Global.SBOApplication.AppEvent += AppEvent; Global.SBOApplication.ItemEvent += FormEvents.ItemEvent; Global.SBOApplication.FormDataEvent += FormEvents.FormDataEvent; Global.SBOApplication.MenuEvent += Menu.MenuEvent; }
public IEnumerable <EventDto> GetByArgs([FromUri] EventFilters args) { return(eventsService.GetByArgs(args)); }