test_class.declarator: mapper = new ObjectMapper()
test_class.modifier: private final
test_class.original_string: private final ObjectMapper mapper = new ObjectMapper();
test_class.type: ObjectMapper
test_class.var_name: mapper
test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/command/CommandHelperTest.java
test_class.identifier: CommandHelperTest
test_case.body: @Test
      public void testCommandToStreamingWithHeader() throws Exception {
          GenericCommand<InputStream> command = new CommandHelperTestCommand();
  
          final ResponseEntity<StreamingResponseBody> responseEntity = CommandHelper.toStreaming(command);
          final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
          responseEntity.getBody().writeTo(outputStream);
          assertEquals("test", new String(outputStream.toByteArray()));
          assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());
          assertEquals("custom value", responseEntity.getHeaders().get("custom").get(0));
      }
test_case.class_method_signature: CommandHelperTest.testCommandToStreamingWithHeader()
test_case.full_signature: @Test public void testCommandToStreamingWithHeader()
test_case.identifier: testCommandToStreamingWithHeader
test_case.invocations: toStreaming writeTo getBody assertEquals toByteArray assertEquals getStatusCode assertEquals get get getHeaders
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCommandToStreamingWithHeader()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(CommandHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(CommandHelper.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/command/CommandHelper.java
focal_class.identifier: CommandHelper
focal_class.class_method_signature: CommandHelper.CommandHelper()
focal_class.full_signature: private  CommandHelper()
focal_class.identifier: CommandHelper
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  CommandHelper()
focal_class.class_method_signature: CommandHelper.toStreaming(final HystrixCommand<InputStream> command)
focal_class.full_signature: public static StreamingResponseBody toStreaming(final HystrixCommand<InputStream> command)
focal_class.identifier: toStreaming
focal_class.modifiers: public static
focal_class.parameters: (final HystrixCommand<InputStream> command)
focal_class.return: StreamingResponseBody
focal_class.signature: StreamingResponseBody toStreaming(final HystrixCommand<InputStream> command)
focal_class.class_method_signature: CommandHelper.async(final GenericCommand<?> command)
focal_class.full_signature: public static ResponseEntity<Void> async(final GenericCommand<?> command)
focal_class.identifier: async
focal_class.modifiers: public static
focal_class.parameters: (final GenericCommand<?> command)
focal_class.return: ResponseEntity<Void>
focal_class.signature: ResponseEntity<Void> async(final GenericCommand<?> command)
focal_class.class_method_signature: CommandHelper.toStreaming(final GenericCommand<InputStream> command)
focal_class.full_signature: public static ResponseEntity<StreamingResponseBody> toStreaming(final GenericCommand<InputStream> command)
focal_class.identifier: toStreaming
focal_class.modifiers: public static
focal_class.parameters: (final GenericCommand<InputStream> command)
focal_class.return: ResponseEntity<StreamingResponseBody>
focal_class.signature: ResponseEntity<StreamingResponseBody> toStreaming(final GenericCommand<InputStream> command)
focal_class.class_method_signature: CommandHelper.toPublisher(final Class<T> clazz, final ObjectMapper mapper,
              final HystrixCommand<InputStream> command)
focal_class.full_signature: public static Publisher<T> toPublisher(final Class<T> clazz, final ObjectMapper mapper,
              final HystrixCommand<InputStream> command)
focal_class.identifier: toPublisher
focal_class.modifiers: public static
focal_class.parameters: (final Class<T> clazz, final ObjectMapper mapper,
              final HystrixCommand<InputStream> command)
focal_class.return: Publisher<T>
focal_class.signature: Publisher<T> toPublisher(final Class<T> clazz, final ObjectMapper mapper,
              final HystrixCommand<InputStream> command)
focal_class.class_method_signature: CommandHelper.toStream(Class<T> clazz, ObjectMapper mapper, HystrixCommand<InputStream> command)
focal_class.full_signature: public static Stream<T> toStream(Class<T> clazz, ObjectMapper mapper, HystrixCommand<InputStream> command)
focal_class.identifier: toStream
focal_class.modifiers: public static
focal_class.parameters: (Class<T> clazz, ObjectMapper mapper, HystrixCommand<InputStream> command)
focal_class.return: Stream<T>
focal_class.signature: Stream<T> toStream(Class<T> clazz, ObjectMapper mapper, HystrixCommand<InputStream> command)
focal_method.body: public static StreamingResponseBody toStreaming(final HystrixCommand<InputStream> command) {
          return outputStream -> {
              final Observable<InputStream> stream = command.toObservable();
              stream.toBlocking().subscribe(inputStream -> {
                  try {
                      IOUtils.copyLarge(inputStream, outputStream);
                      outputStream.flush();
                  } catch (IOException e) {
                      try {
                          inputStream.close();
                      } catch (IOException closingException) {
                          LOGGER.warn("could not close command result, a http connection may be leaked !",
                                  closingException);
                      }
                      LOGGER.error("Unable to fully copy command result '{}'.", command.getClass(), e);
                  }
              }, TDPException::rethrowOrWrap);
          };
      }
focal_method.class_method_signature: CommandHelper.toStreaming(final HystrixCommand<InputStream> command)
focal_method.full_signature: public static StreamingResponseBody toStreaming(final HystrixCommand<InputStream> command)
focal_method.identifier: toStreaming
focal_method.invocations: toObservable subscribe toBlocking copyLarge flush close warn error getClass
focal_method.modifiers: public static
focal_method.parameters: (final HystrixCommand<InputStream> command)
focal_method.return: StreamingResponseBody
focal_method.signature: StreamingResponseBody toStreaming(final HystrixCommand<InputStream> command)