Search in sources :

Example 6 with AggregateActionInput

use of com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionInput in project data-prepper by opensearch-project.

the class RemoveDuplicatesAggregateActionTest method handleEvent_with_empty_groupState_returns_expected_AggregateResponse_and_modifies_groupState.

@Test
void handleEvent_with_empty_groupState_returns_expected_AggregateResponse_and_modifies_groupState() {
    removeDuplicatesAggregateAction = createObjectUnderTest();
    final AggregateActionInput aggregateActionInput = new AggregateActionTestUtils.TestAggregateActionInput();
    final GroupState groupState = aggregateActionInput.getGroupState();
    final AggregateActionResponse aggregateActionResponse = removeDuplicatesAggregateAction.handleEvent(testEvent, aggregateActionInput);
    assertThat(aggregateActionResponse.getEvent(), equalTo(testEvent));
    assertThat(groupState, equalTo(expectedGroupState));
}
Also used : AggregateActionInput(com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionInput) AggregateActionResponse(com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionResponse) GroupState(com.amazon.dataprepper.plugins.processor.aggregate.GroupState) Test(org.junit.jupiter.api.Test)

Example 7 with AggregateActionInput

use of com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionInput in project data-prepper by opensearch-project.

the class RemoveDuplicatesAggregateActionTest method handleEvent_with_non_empty_groupState_returns_expected_AggregateResponse_and_does_not_modify_groupState.

@Test
void handleEvent_with_non_empty_groupState_returns_expected_AggregateResponse_and_does_not_modify_groupState() {
    removeDuplicatesAggregateAction = createObjectUnderTest();
    final AggregateActionInput aggregateActionInput = new AggregateActionTestUtils.TestAggregateActionInput();
    final GroupState groupState = aggregateActionInput.getGroupState();
    groupState.put(RemoveDuplicatesAggregateAction.GROUP_STATE_HAS_EVENT, true);
    final AggregateActionResponse aggregateActionResponse = removeDuplicatesAggregateAction.handleEvent(testEvent, aggregateActionInput);
    assertThat(aggregateActionResponse.getEvent(), equalTo(null));
    assertThat(groupState, equalTo(expectedGroupState));
}
Also used : AggregateActionInput(com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionInput) AggregateActionResponse(com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionResponse) GroupState(com.amazon.dataprepper.plugins.processor.aggregate.GroupState) Test(org.junit.jupiter.api.Test)

Aggregations

AggregateActionInput (com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionInput)7 Test (org.junit.jupiter.api.Test)7 GroupState (com.amazon.dataprepper.plugins.processor.aggregate.GroupState)5 AggregateActionResponse (com.amazon.dataprepper.plugins.processor.aggregate.AggregateActionResponse)4 Event (com.amazon.dataprepper.model.event.Event)3 JacksonEvent (com.amazon.dataprepper.model.event.JacksonEvent)3