use of com.sequenceiq.cloudbreak.audit.model.EventData in project cloudbreak by hortonworks.
the class AuditEventToGrpcAuditEventConverterTest method convertWithApiRequestData.
@Test
void convertWithApiRequestData() {
ActorBase actor = ActorCrn.builder().withActorCrn(USER_CRN).build();
EventData eventData = ApiRequestData.builder().withApiVersion(API_VERSION).withMutating(MUTATING).withRequestParameters(REQUEST_PARAMETERS).withUserAgent(USER_AGENT).build();
AuditEvent source = makeAuditEvent(actor, eventData);
underTest = new AuditEventToGrpcAuditEventConverter(createMockUtilizer(ApiRequestData.class), mockBuilderProvider);
underTest.convert(source);
assertGeneric();
verify(mockAuditEventBuilderUpdater, times(1)).update(any(), any());
}
use of com.sequenceiq.cloudbreak.audit.model.EventData in project cloudbreak by hortonworks.
the class AuditEventToGrpcAuditEventConverterTest method convertUnknownEventDataThrows.
@Test
void convertUnknownEventDataThrows() {
ActorBase actor = ActorCrn.builder().withActorCrn(USER_CRN).build();
class Unknown extends EventData {
}
AuditEvent source = makeAuditEvent(actor, new Unknown());
assertThatThrownBy(() -> underTest.convert(source)).isInstanceOf(IllegalArgumentException.class);
}
use of com.sequenceiq.cloudbreak.audit.model.EventData in project cloudbreak by hortonworks.
the class AuditEventToGrpcAuditEventConverterTest method testPreventPossibleNullValuesInSourceServiceEventData.
@Test
void testPreventPossibleNullValuesInSourceServiceEventData() {
ActorBase actor = ActorCrn.builder().withActorCrn(USER_CRN).build();
EventData eventData = ServiceEventData.builder().build();
AuditEvent source = makeMinimalAuditEvent(actor, eventData);
underTest = new AuditEventToGrpcAuditEventConverter(createMockUtilizer(ServiceEventData.class), mockBuilderProvider);
underTest.convert(source);
verify(mockAuditEventBuilderUpdater, times(1)).update(any(), any());
}
use of com.sequenceiq.cloudbreak.audit.model.EventData in project cloudbreak by hortonworks.
the class AuditEventToGrpcAuditEventConverterTest method testPreventPossibleNullValuesInSouceApiRequestData.
@Test
void testPreventPossibleNullValuesInSouceApiRequestData() {
ActorBase actor = ActorCrn.builder().withActorCrn(USER_CRN).build();
EventData eventData = ApiRequestData.builder().build();
AuditEvent source = makeMinimalAuditEvent(actor, eventData);
underTest = new AuditEventToGrpcAuditEventConverter(createMockUtilizer(ApiRequestData.class), mockBuilderProvider);
underTest.convert(source);
verify(mockAuditEventBuilderUpdater, times(1)).update(any(), any());
}
use of com.sequenceiq.cloudbreak.audit.model.EventData in project cloudbreak by hortonworks.
the class AuditEventToGrpcAuditEventConverterTest method convertWithServiceEventData.
@Test
void convertWithServiceEventData() {
ActorBase actor = ActorCrn.builder().withActorCrn(USER_CRN).build();
EventData eventData = ServiceEventData.builder().withVersion(SERVICE_EVENT_VERSION).withEventDetails(SERVICE_EVENT_DETAILS).build();
AuditEvent source = makeAuditEvent(actor, eventData);
underTest = new AuditEventToGrpcAuditEventConverter(createMockUtilizer(ServiceEventData.class), mockBuilderProvider);
underTest.convert(source);
assertGeneric();
verify(mockAuditEventBuilderUpdater, times(1)).update(any(), any());
}
Aggregations