public static AuditManagerS3A createAndStartAuditManager(
      Configuration conf,
      IOStatisticsStore iostatistics) {
    AuditManagerS3A auditManager;
    if (conf.getBoolean(AUDIT_ENABLED, AUDIT_ENABLED_DEFAULT)) {
      auditManager = new ActiveAuditManagerS3A(
          requireNonNull(iostatistics));
    } else {
      LOG.debug("auditing is disabled");
      auditManager = stubAuditManager();
    }
    auditManager.init(conf);
    auditManager.start();
    LOG.debug("Started Audit Manager {}", auditManager);
    return auditManager;
  }
@Test
  public void testSingleExecutionInterceptor() throws Throwable {
    AuditManagerS3A manager = AuditIntegration.createAndStartAuditManager(
        noopAuditConfig(),
        ioStatistics);
    List<ExecutionInterceptor> interceptors
        = manager.createExecutionInterceptors();
    assertThat(interceptors)
        .hasSize(1);
    ExecutionInterceptor interceptor = interceptors.get(0);

    RequestFactory requestFactory = RequestFactoryImpl.builder()
        .withBucket("bucket")
        .build();
    HeadObjectRequest.Builder requestBuilder =
        requestFactory.newHeadObjectRequestBuilder("/");

    assertThat(interceptor instanceof AWSAuditEventCallbacks).isTrue();
    ((AWSAuditEventCallbacks)interceptor).requestCreated(requestBuilder);

    HeadObjectRequest request = requestBuilder.build();
    SdkHttpRequest httpRequest = SdkHttpRequest.builder()
        .protocol("https")
        .host("test")
        .method(SdkHttpMethod.HEAD)
        .build();

    ExecutionAttributes attributes = ExecutionAttributes.builder().build();
    InterceptorContext context = InterceptorContext.builder()
        .request(request)
        .httpRequest(httpRequest)
        .build();

    // test the basic pre-request sequence while avoiding
    // the complexity of recreating the full sequence
    // (and probably getting it wrong)
    interceptor.beforeExecution(context, attributes);
    interceptor.modifyRequest(context, attributes);
    interceptor.beforeMarshalling(context, attributes);
    interceptor.afterMarshalling(context, attributes);
    interceptor.modifyHttpRequest(context, attributes);
    interceptor.beforeTransmission(context, attributes);
    AuditSpanS3A span = attributes.getAttribute(AUDIT_SPAN_EXECUTION_ATTRIBUTE);
    assertThat(span).isNotNull();
    assertThat(span.isValidSpan()).isFalse();
  }