private CompletionStage<RestResponse> putInCache(NettyRestResponse.Builder responseBuilder,
                                                    AdvancedCache<Object, Object> cache, Object key, byte[] data, Long ttl,
                                                    Long idleTime) {
      Configuration config = SecurityActions.getCacheConfiguration(cache);
      final Metadata metadata = CacheOperationsHelper.createMetadata(config, ttl, idleTime);
      responseBuilder.header("etag", calcETAG(data));
      CompletionStage<Object> stage;
      // Indexing is still blocking - can be removed when https://issues.redhat.com/browse/ISPN-11731 is complete
      if (config.indexing().enabled()) {
         stage = CompletableFuture.supplyAsync(() -> cache.putAsync(key, data, metadata), invocationHelper.getExecutor())
               .thenCompose(Function.identity());
      } else {
         stage = cache.putAsync(key, data, metadata);
      }
      return stage.thenApply(o -> responseBuilder.build());
   }
@Test
   public void testIntegerKeysXmlToTextValues() {
      Integer key = 123;
      String keyContentType = "application/x-java-object;type=java.lang.Integer";
      String valueContentType = "application/xml; charset=UTF-8";
      String value = "<root>test</root>";

      putInCache("default", key, keyContentType, value, valueContentType);
      RestResponse response = get("default", key, keyContentType, "text/plain");

      ResponseAssertion.assertThat(response).hasReturnedText(value);
   }