<commit_before>/*
 * Copyright 2015 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.spinnaker.orca.igor.config

import com.fasterxml.jackson.databind.ObjectMapper
import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.config.DefaultServiceEndpoint
import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider
import com.netflix.spinnaker.orca.igor.IgorService
import com.netflix.spinnaker.orca.retrofit.RetrofitConfiguration
import com.netflix.spinnaker.orca.retrofit.logging.RetrofitSlf4jLog
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import retrofit.Endpoint
import retrofit.RequestInterceptor
import retrofit.RestAdapter
import retrofit.client.Client
import retrofit.converter.JacksonConverter
import static retrofit.Endpoints.newFixedEndpoint

@Configuration
@Import(RetrofitConfiguration)
@ConditionalOnExpression('${igor.enabled:true}')
@CompileStatic
@ComponentScan("com.netflix.spinnaker.orca.igor")
class IgorConfiguration {

  @Autowired OkHttpClientProvider clientProvider
  @Autowired RestAdapter.LogLevel retrofitLogLevel
  @Autowired ObjectMapper objectMapper

  @Bean
  Endpoint igorEndpoint(
    @Value('${igor.base-url}') String igorBaseUrl) {
    newFixedEndpoint(igorBaseUrl)
  }

  @Bean
  IgorService igorService(Endpoint igorEndpoint, ObjectMapper mapper, RequestInterceptor spinnakerRequestInterceptor) {
    new RestAdapter.Builder()
      .setEndpoint(igorEndpoint)
      .setClient(new Ok3Client(clientProvider.getClient(new DefaultServiceEndpoint("keel", igorEndpoint.url))))
      .setLogLevel(retrofitLogLevel)
      .setRequestInterceptor(spinnakerRequestInterceptor)
      .setLog(new RetrofitSlf4jLog(IgorService))
      .setConverter(new JacksonConverter(mapper))
      .build()
      .create(IgorService)
  }<commit_msg>fix(misc): Fix wrong service name (#3726)<commit_after>/*
 * Copyright 2015 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.spinnaker.orca.igor.config

import com.fasterxml.jackson.databind.ObjectMapper
import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.config.DefaultServiceEndpoint
import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider
import com.netflix.spinnaker.orca.igor.IgorService
import com.netflix.spinnaker.orca.retrofit.RetrofitConfiguration
import com.netflix.spinnaker.orca.retrofit.logging.RetrofitSlf4jLog
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import retrofit.Endpoint
import retrofit.RequestInterceptor
import retrofit.RestAdapter
import retrofit.client.Client
import retrofit.converter.JacksonConverter
import static retrofit.Endpoints.newFixedEndpoint

@Configuration
@Import(RetrofitConfiguration)
@ConditionalOnExpression('${igor.enabled:true}')
@CompileStatic
@ComponentScan("com.netflix.spinnaker.orca.igor")
class IgorConfiguration {

  @Autowired OkHttpClientProvider clientProvider
  @Autowired RestAdapter.LogLevel retrofitLogLevel
  @Autowired ObjectMapper objectMapper

  @Bean
  Endpoint igorEndpoint(
    @Value('${igor.base-url}') String igorBaseUrl) {
    newFixedEndpoint(igorBaseUrl)
  }

  @Bean
  IgorService igorService(Endpoint igorEndpoint, ObjectMapper mapper, RequestInterceptor spinnakerRequestInterceptor) {
    new RestAdapter.Builder()
      .setEndpoint(igorEndpoint)
      .setClient(new Ok3Client(clientProvider.getClient(new DefaultServiceEndpoint("igor", igorEndpoint.url))))
      .setLogLevel(retrofitLogLevel)
      .setRequestInterceptor(spinnakerRequestInterceptor)
      .setLog(new RetrofitSlf4jLog(IgorService))
      .setConverter(new JacksonConverter(mapper))
      .build()
      .create(IgorService)
  }
{'fraction_non_alphanumeric': 0.0809437386569873, 'fraction_numerical': 0.0054446460980036296, 'mean_word_length': 5.737163814180929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6724972', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1527, 'n_words': 353}