test_class.declarator: lastException
test_class.modifier: private static
test_class.original_string: private static TDPException lastException;
test_class.type: TDPException
test_class.var_name: lastException
test_class.declarator: context
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WebApplicationContext context;
test_class.type: WebApplicationContext
test_class.var_name: context
test_class.declarator: httpClient
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private HttpClient httpClient;
test_class.type: HttpClient
test_class.var_name: httpClient
test_class.declarator: security
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private Security security;
test_class.type: Security
test_class.var_name: security
test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/command/GenericCommandTest.java
test_class.identifier: GenericCommandTest
test_class.superclass: extends ServiceBaseTest
test_case.body: @Test
      public void testPassThrough() throws Exception {
          // Given
          GenericCommand<String> command =
                  getCommand("http://localhost:" + port + "/command/test/fail_with_500", Defaults.passthrough());
          try {
              // When
              command.run();
          } catch (TDPException e) {
              // Then
              // error() wasn't called, lastException must be null
              assertThat(lastException, nullValue());
              // underlying is returned as is (passthrough method).
              assertThat(e.getCode().getCode(), is(CommonErrorCodes.UNABLE_TO_SERIALIZE_TO_JSON.getCode()));
          }
      }
test_case.class_method_signature: GenericCommandTest.testPassThrough()
test_case.full_signature: @Test public void testPassThrough()
test_case.identifier: testPassThrough
test_case.invocations: getCommand passthrough run assertThat nullValue assertThat getCode getCode is getCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPassThrough()
focal_class.declarator: DATASET_GROUP = HystrixCommandGroupKey.Factory.asKey("dataset")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey DATASET_GROUP = HystrixCommandGroupKey.Factory.asKey("dataset");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: DATASET_GROUP
focal_class.declarator: PREPARATION_GROUP = HystrixCommandGroupKey.Factory.asKey("preparation")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey PREPARATION_GROUP = HystrixCommandGroupKey.Factory.asKey("preparation");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: PREPARATION_GROUP
focal_class.declarator: TRANSFORM_GROUP = HystrixCommandGroupKey.Factory.asKey("transform")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey TRANSFORM_GROUP = HystrixCommandGroupKey.Factory.asKey("transform");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: TRANSFORM_GROUP
focal_class.declarator: FULLRUN_GROUP = HystrixCommandGroupKey.Factory.asKey("fullrun")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey FULLRUN_GROUP = HystrixCommandGroupKey.Factory.asKey("fullrun");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: FULLRUN_GROUP
focal_class.declarator: ASYNC_GROUP = HystrixCommandGroupKey.Factory.asKey("async")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey ASYNC_GROUP = HystrixCommandGroupKey.Factory.asKey("async");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: ASYNC_GROUP
focal_class.declarator: USER_GROUP = HystrixCommandGroupKey.Factory.asKey("user")
focal_class.modifier: public static final
focal_class.original_string: public static final HystrixCommandGroupKey USER_GROUP = HystrixCommandGroupKey.Factory.asKey("user");
focal_class.type: HystrixCommandGroupKey
focal_class.var_name: USER_GROUP
focal_class.declarator: LOGGER = LoggerFactory.getLogger(GenericCommand.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(GenericCommand.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: INFO_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is1xxInformational) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0])
focal_class.modifier: private static final
focal_class.original_string: private static final HttpStatus[] INFO_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is1xxInformational) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0]);
focal_class.type: HttpStatus[]
focal_class.var_name: INFO_STATUS
focal_class.declarator: SUCCESS_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is2xxSuccessful) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0])
focal_class.modifier: private static final
focal_class.original_string: private static final HttpStatus[] SUCCESS_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is2xxSuccessful) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0]);
focal_class.type: HttpStatus[]
focal_class.var_name: SUCCESS_STATUS
focal_class.declarator: REDIRECT_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is3xxRedirection) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0])
focal_class.modifier: private static final
focal_class.original_string: private static final HttpStatus[] REDIRECT_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is3xxRedirection) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0]);
focal_class.type: HttpStatus[]
focal_class.var_name: REDIRECT_STATUS
focal_class.declarator: USER_ERROR_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is4xxClientError) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0])
focal_class.modifier: private static final
focal_class.original_string: private static final HttpStatus[] USER_ERROR_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is4xxClientError) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0]);
focal_class.type: HttpStatus[]
focal_class.var_name: USER_ERROR_STATUS
focal_class.declarator: SERVER_ERROR_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is5xxServerError) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0])
focal_class.modifier: private static final
focal_class.original_string: private static final HttpStatus[] SERVER_ERROR_STATUS = Stream
              .of(HttpStatus.values()) //
              .filter(HttpStatus::is5xxServerError) //
              .collect(Collectors.toList()) //
              .toArray(new HttpStatus[0]);
focal_class.type: HttpStatus[]
focal_class.var_name: SERVER_ERROR_STATUS
focal_class.declarator: behavior =
              new EnumMap<>(HttpStatus.class)
focal_class.modifier: private final
focal_class.original_string: private final Map<HttpStatus, BiFunction<HttpRequestBase, HttpResponse, T>> behavior =
              new EnumMap<>(HttpStatus.class);
focal_class.type: Map<HttpStatus, BiFunction<HttpRequestBase, HttpResponse, T>>
focal_class.var_name: behavior
focal_class.declarator: headers = new HashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<String, String> headers = new HashMap<>();
focal_class.type: Map<String, String>
focal_class.var_name: headers
focal_class.declarator: client
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected HttpClient client;
focal_class.type: HttpClient
focal_class.var_name: client
focal_class.declarator: objectMapper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ObjectMapper objectMapper;
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: context
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ApplicationContext context;
focal_class.type: ApplicationContext
focal_class.var_name: context
focal_class.declarator: transformationServiceUrl
focal_class.modifier: @Value("${transformation.service.url:}")
      protected
focal_class.original_string: @Value("${transformation.service.url:}")
      protected String transformationServiceUrl;
focal_class.type: String
focal_class.var_name: transformationServiceUrl
focal_class.declarator: fullRunServiceUrl
focal_class.modifier: @Value("${fullrun.service.url:}")
      protected
focal_class.original_string: @Value("${fullrun.service.url:}")
      protected String fullRunServiceUrl;
focal_class.type: String
focal_class.var_name: fullRunServiceUrl
focal_class.declarator: datasetServiceUrl
focal_class.modifier: @Value("${dataset.service.url:}")
      protected
focal_class.original_string: @Value("${dataset.service.url:}")
      protected String datasetServiceUrl;
focal_class.type: String
focal_class.var_name: datasetServiceUrl
focal_class.declarator: preparationServiceUrl
focal_class.modifier: @Value("${preparation.service.url:}")
      protected
focal_class.original_string: @Value("${preparation.service.url:}")
      protected String preparationServiceUrl;
focal_class.type: String
focal_class.var_name: preparationServiceUrl
focal_class.declarator: conversionService
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BeanConversionService conversionService;
focal_class.type: BeanConversionService
focal_class.var_name: conversionService
focal_class.declarator: tracer
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private Tracer tracer;
focal_class.type: Tracer
focal_class.var_name: tracer
focal_class.declarator: httpCall
focal_class.modifier: private
focal_class.original_string: private Supplier<HttpRequestBase> httpCall;
focal_class.type: Supplier<HttpRequestBase>
focal_class.var_name: httpCall
focal_class.declarator: commandResponseHeaders = new Header[0]
focal_class.modifier: private
focal_class.original_string: private Header[] commandResponseHeaders = new Header[0];
focal_class.type: Header[]
focal_class.var_name: commandResponseHeaders
focal_class.declarator: onError = Defaults.passthrough()
focal_class.modifier: private
focal_class.original_string: private Function<Exception, RuntimeException> onError = Defaults.passthrough();
focal_class.type: Function<Exception, RuntimeException>
focal_class.var_name: onError
focal_class.declarator: status
focal_class.modifier: private
focal_class.original_string: private HttpStatus status;
focal_class.type: HttpStatus
focal_class.var_name: status
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/command/GenericCommand.java
focal_class.identifier: GenericCommand
focal_class.class_method_signature: GenericCommand.GenericCommand(final HystrixCommandGroupKey group)
focal_class.full_signature: protected  GenericCommand(final HystrixCommandGroupKey group)
focal_class.identifier: GenericCommand
focal_class.modifiers: protected
focal_class.parameters: (final HystrixCommandGroupKey group)
focal_class.signature:  GenericCommand(final HystrixCommandGroupKey group)
focal_class.class_method_signature: GenericCommand.GenericCommand(final HystrixCommandGroupKey group, final Map<String, String> headers)
focal_class.full_signature: protected  GenericCommand(final HystrixCommandGroupKey group, final Map<String, String> headers)
focal_class.identifier: GenericCommand
focal_class.modifiers: protected
focal_class.parameters: (final HystrixCommandGroupKey group, final Map<String, String> headers)
focal_class.signature:  GenericCommand(final HystrixCommandGroupKey group, final Map<String, String> headers)
focal_class.class_method_signature: GenericCommand.getAuthenticationToken()
focal_class.full_signature: public String getAuthenticationToken()
focal_class.identifier: getAuthenticationToken
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getAuthenticationToken()
focal_class.class_method_signature: GenericCommand.decomposeException(Exception e)
focal_class.full_signature: @Override protected RuntimeException decomposeException(Exception e)
focal_class.identifier: decomposeException
focal_class.modifiers: @Override protected
focal_class.parameters: (Exception e)
focal_class.return: RuntimeException
focal_class.signature: RuntimeException decomposeException(Exception e)
focal_class.class_method_signature: GenericCommand.run()
focal_class.full_signature: @Override protected T run()
focal_class.identifier: run
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T run()
focal_class.class_method_signature: GenericCommand.addTrackingHeaders(HttpRequestBase request)
focal_class.full_signature: private Span addTrackingHeaders(HttpRequestBase request)
focal_class.identifier: addTrackingHeaders
focal_class.modifiers: private
focal_class.parameters: (HttpRequestBase request)
focal_class.return: Span
focal_class.signature: Span addTrackingHeaders(HttpRequestBase request)
focal_class.class_method_signature: GenericCommand.addLocaleHeaders(HttpRequestBase request)
focal_class.full_signature: private void addLocaleHeaders(HttpRequestBase request)
focal_class.identifier: addLocaleHeaders
focal_class.modifiers: private
focal_class.parameters: (HttpRequestBase request)
focal_class.return: void
focal_class.signature: void addLocaleHeaders(HttpRequestBase request)
focal_class.class_method_signature: GenericCommand.addAuthorizationHeaders(HttpRequestBase request)
focal_class.full_signature: private void addAuthorizationHeaders(HttpRequestBase request)
focal_class.identifier: addAuthorizationHeaders
focal_class.modifiers: private
focal_class.parameters: (HttpRequestBase request)
focal_class.return: void
focal_class.signature: void addAuthorizationHeaders(HttpRequestBase request)
focal_class.class_method_signature: GenericCommand.addCommandHeaders(HttpRequestBase request)
focal_class.full_signature: private void addCommandHeaders(HttpRequestBase request)
focal_class.identifier: addCommandHeaders
focal_class.modifiers: private
focal_class.parameters: (HttpRequestBase request)
focal_class.return: void
focal_class.signature: void addCommandHeaders(HttpRequestBase request)
focal_class.class_method_signature: GenericCommand.getCommandResponseHeaders()
focal_class.full_signature: public Header[] getCommandResponseHeaders()
focal_class.identifier: getCommandResponseHeaders
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Header[]
focal_class.signature: Header[] getCommandResponseHeaders()
focal_class.class_method_signature: GenericCommand.getHeader(String name)
focal_class.full_signature: public Header getHeader(String name)
focal_class.identifier: getHeader
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: Header
focal_class.signature: Header getHeader(String name)
focal_class.class_method_signature: GenericCommand.getStatus()
focal_class.full_signature: public HttpStatus getStatus()
focal_class.identifier: getStatus
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: HttpStatus
focal_class.signature: HttpStatus getStatus()
focal_class.class_method_signature: GenericCommand.missingBehavior()
focal_class.full_signature: private BiFunction<HttpRequestBase, HttpResponse, T> missingBehavior()
focal_class.identifier: missingBehavior
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> missingBehavior()
focal_class.class_method_signature: GenericCommand.callOnError(Function<Exception, RuntimeException> onError)
focal_class.full_signature: private BiFunction<HttpRequestBase, HttpResponse, T> callOnError(Function<Exception, RuntimeException> onError)
focal_class.identifier: callOnError
focal_class.modifiers: private
focal_class.parameters: (Function<Exception, RuntimeException> onError)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> callOnError(Function<Exception, RuntimeException> onError)
focal_class.class_method_signature: GenericCommand.onError(Function<Exception, RuntimeException> onError)
focal_class.full_signature: protected void onError(Function<Exception, RuntimeException> onError)
focal_class.identifier: onError
focal_class.modifiers: protected
focal_class.parameters: (Function<Exception, RuntimeException> onError)
focal_class.return: void
focal_class.signature: void onError(Function<Exception, RuntimeException> onError)
focal_class.class_method_signature: GenericCommand.execute(Supplier<HttpRequestBase> call)
focal_class.full_signature: protected void execute(Supplier<HttpRequestBase> call)
focal_class.identifier: execute
focal_class.modifiers: protected
focal_class.parameters: (Supplier<HttpRequestBase> call)
focal_class.return: void
focal_class.signature: void execute(Supplier<HttpRequestBase> call)
focal_class.class_method_signature: GenericCommand.on(HttpStatus... status)
focal_class.full_signature: protected BehaviorBuilder on(HttpStatus... status)
focal_class.identifier: on
focal_class.modifiers: protected
focal_class.parameters: (HttpStatus... status)
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder on(HttpStatus... status)
focal_class.class_method_signature: GenericCommand.onInfo()
focal_class.full_signature: protected BehaviorBuilder onInfo()
focal_class.identifier: onInfo
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder onInfo()
focal_class.class_method_signature: GenericCommand.onSuccess()
focal_class.full_signature: protected BehaviorBuilder onSuccess()
focal_class.identifier: onSuccess
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder onSuccess()
focal_class.class_method_signature: GenericCommand.onRedirect()
focal_class.full_signature: protected BehaviorBuilder onRedirect()
focal_class.identifier: onRedirect
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder onRedirect()
focal_class.class_method_signature: GenericCommand.onUserErrors()
focal_class.full_signature: protected BehaviorBuilder onUserErrors()
focal_class.identifier: onUserErrors
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder onUserErrors()
focal_class.class_method_signature: GenericCommand.onServerErrors()
focal_class.full_signature: protected BehaviorBuilder onServerErrors()
focal_class.identifier: onServerErrors
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BehaviorBuilder
focal_class.signature: BehaviorBuilder onServerErrors()
focal_class.class_method_signature: GenericCommand.serializeActions(final Collection<Action> stepActions)
focal_class.full_signature: protected String serializeActions(final Collection<Action> stepActions)
focal_class.identifier: serializeActions
focal_class.modifiers: protected
focal_class.parameters: (final Collection<Action> stepActions)
focal_class.return: String
focal_class.signature: String serializeActions(final Collection<Action> stepActions)
focal_class.class_method_signature: GenericCommand.getServiceUrl(ServiceType type)
focal_class.full_signature: protected String getServiceUrl(ServiceType type)
focal_class.identifier: getServiceUrl
focal_class.modifiers: protected
focal_class.parameters: (ServiceType type)
focal_class.return: String
focal_class.signature: String getServiceUrl(ServiceType type)
focal_class.superclass: extends HystrixCommand<T>
focal_method.body: @Override
      protected T run() throws Exception {
          final HttpRequestBase request = httpCall.get();
          addCommandHeaders(request); // insert all the provided headers in the request
          addAuthorizationHeaders(request); // update request header with security token
          addLocaleHeaders(request); // Forward locale to target
          final Span requestSpan = addTrackingHeaders(request); // Inject tracing stuff
  
          try {
              final HttpResponse response;
              try {
                  LOGGER.trace("Requesting {} {}", request.getMethod(), request.getURI());
                  response = client.execute(request);
              } catch (Exception e) {
                  throw onError.apply(e);
              }
              commandResponseHeaders = response.getAllHeaders();
  
              status = HttpStatus.valueOf(response.getStatusLine().getStatusCode());
  
              Header cookies = response.getFirstHeader("Set-Cookie");
              if (cookies != null) {
                  LOGGER.warn(
                          "request {} {}: Cookie detected in responseHeaders (check security.oauth2.resource.uri settings)",
                          request.getMethod(), request.getURI());
              }
  
              // do we have a behavior for this status code (even an error) ?
              // if yes use it
              BiFunction<HttpRequestBase, HttpResponse, T> function = behavior.get(status);
              if (function != null) {
                  try {
                      return function.apply(request, response);
                  } catch (Exception e) {
                      throw onError.apply(e);
                  }
              }
  
              // handle response's HTTP status
              if (status.is4xxClientError() || status.is5xxServerError()) {
                  LOGGER.debug("request {} {} : response on error {}", request.getMethod(), request.getURI(),
                          response.getStatusLine());
                  // Http status >= 400 so apply onError behavior
                  return callOnError(onError).apply(request, response);
              } else {
                  // Http status is not error so apply onError behavior
                  return behavior.getOrDefault(status, missingBehavior()).apply(request, response);
              }
          } finally {
              tracer.close(requestSpan);
          }
      }
focal_method.class_method_signature: GenericCommand.run()
focal_method.full_signature: @Override protected T run()
focal_method.identifier: run
focal_method.invocations: get addCommandHeaders addAuthorizationHeaders addLocaleHeaders addTrackingHeaders trace getMethod getURI execute apply getAllHeaders valueOf getStatusCode getStatusLine getFirstHeader warn getMethod getURI get apply apply is4xxClientError is5xxServerError debug getMethod getURI getStatusLine apply callOnError apply getOrDefault missingBehavior close
focal_method.modifiers: @Override protected
focal_method.parameters: ()
focal_method.return: T
focal_method.signature: T run()