Search in sources :

Example 11 with PipelineEvent

use of com.epam.pipeline.elasticsearchagent.model.PipelineEvent in project cloud-pipeline by epam.

the class EntitySynchronizerTest method testDeletedObjectMergeEvents.

@Test
void testDeletedObjectMergeEvents() {
    List<PipelineEvent> pipelineEvents = new ArrayList<>();
    PipelineEvent event1 = createEvent(EventType.INSERT, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event1);
    PipelineEvent event2 = createEvent(EventType.INSERT, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 2L);
    pipelineEvents.add(event2);
    PipelineEvent event3 = createEvent(EventType.UPDATE, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event3);
    PipelineEvent event4 = createEvent(EventType.DELETE, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event4);
    List<PipelineEvent> mergeEvents = EventProcessorUtils.mergeEvents(pipelineEvents);
    assertEquals(2, mergeEvents.size());
}
Also used : PipelineEvent(com.epam.pipeline.elasticsearchagent.model.PipelineEvent) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 12 with PipelineEvent

use of com.epam.pipeline.elasticsearchagent.model.PipelineEvent in project cloud-pipeline by epam.

the class EntitySynchronizerTest method testUpdatedObjectMergeEvents.

@Test
void testUpdatedObjectMergeEvents() {
    List<PipelineEvent> pipelineEvents = new ArrayList<>();
    PipelineEvent event1 = createEvent(EventType.INSERT, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event1);
    PipelineEvent event2 = createEvent(EventType.INSERT, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 2L);
    pipelineEvents.add(event2);
    PipelineEvent event3 = createEvent(EventType.UPDATE, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event3);
    PipelineEvent event4 = createEvent(EventType.UPDATE, LocalDateTime.now(), PipelineEvent.ObjectType.RUN, 1L);
    pipelineEvents.add(event4);
    List<PipelineEvent> mergeEvents = EventProcessorUtils.mergeEvents(pipelineEvents);
    assertEquals(2, mergeEvents.size());
}
Also used : PipelineEvent(com.epam.pipeline.elasticsearchagent.model.PipelineEvent) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Aggregations

PipelineEvent (com.epam.pipeline.elasticsearchagent.model.PipelineEvent)12 Test (org.junit.jupiter.api.Test)5 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)4 AbstractSpringApplicationTest (com.epam.pipeline.elasticsearchagent.AbstractSpringApplicationTest)3 GitEventData (com.epam.pipeline.elasticsearchagent.model.git.GitEventData)3 LocalDateTime (java.time.LocalDateTime)3 PipelineDoc (com.epam.pipeline.elasticsearchagent.model.PipelineDoc)2 Revision (com.epam.pipeline.entity.pipeline.Revision)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 PipelineEventDao (com.epam.pipeline.elasticsearchagent.dao.PipelineEventDao)1 EntityNotFoundException (com.epam.pipeline.elasticsearchagent.exception.EntityNotFoundException)1 EntityContainer (com.epam.pipeline.elasticsearchagent.model.EntityContainer)1 EventType (com.epam.pipeline.elasticsearchagent.model.EventType)1 BulkResponsePostProcessor (com.epam.pipeline.elasticsearchagent.service.BulkResponsePostProcessor)1 ElasticsearchServiceClient (com.epam.pipeline.elasticsearchagent.service.ElasticsearchServiceClient)1 ElasticsearchSynchronizer (com.epam.pipeline.elasticsearchagent.service.ElasticsearchSynchronizer)1