<commit_before>require 'rubygems'
require 'ruby-jmeter'

require 'ext/regular_expression_extractor.rb'
require 'ext/save_responses_to_a_file.rb'
require 'ext/dsl.rb'

BASE_DIR = "#{File.expand_path(File.dirname(__FILE__))}"
LOGS_DIR = "#{BASE_DIR}/logs"

#
# Kill Bill configuration
#

KB_URL = ENV['KB_URL'] || 'http://1172.16.31.10:8080'

KB_THREADS_URL = "#{KB_URL}/1.0/threads?pretty=true"
KB_METRICS_URL = "#{KB_URL}/1.0/metrics?pretty=true"

KB_ROOT = File.join(KB_URL, '/1.0/kb')
KB_ACCOUNTS_URL = "#{KB_ROOT}/accounts"

COMMON_HEADERS = [
  { name: 'Authorization', value: 'Basic YWRtaW46cGFzc3dvcmQ=' },
  { name: 'X-Killbill-ApiKey',    value: ENV['API_KEY'] || 'bob' },
  { name: 'X-Killbill-ApiSecret', value: ENV['API_SECRET'] || 'lazar' },
  { name: 'X-Killbill-CreatedBy', value: ENV['CREATED_BY'] || 'JMeter' },
  { name: 'Accept', value: 'application/json' },
  { name: 'Content-Type', value: 'application/json' }
]

#
# JMeter configuration
#

NB_THREADS = ENV['NB_THREADS'] || 20
DURATION = ENV['DURATION'] || (5 * 60)

LOCATION_ID_REGEX = "Location: http://.*/(.+)/?"

DEFAULT_SETUP = Proc.new do
  save_responses_to_a_file filename: "#{LOGS_PREFIX}_setup_", timestamp: false

  get name: :'Threads', url: KB_THREADS_URL
  get name: :'Metrics', url: KB_METRICS_URL
end<commit_msg>jmeter: make username/password configurable<commit_after>require 'rubygems'
require 'ruby-jmeter'
require 'base64'

require 'ext/regular_expression_extractor.rb'
require 'ext/save_responses_to_a_file.rb'
require 'ext/dsl.rb'

BASE_DIR = "#{File.expand_path(File.dirname(__FILE__))}"
LOGS_DIR = "#{BASE_DIR}/logs"

#
# Kill Bill configuration
#

KB_URL = ENV['KB_URL'] || 'http://127.0.0.1:8080'

KB_THREADS_URL = "#{KB_URL}/1.0/threads?pretty=true"
KB_METRICS_URL = "#{KB_URL}/1.0/metrics?pretty=true"

KB_ROOT = File.join(KB_URL, '/1.0/kb')
KB_ACCOUNTS_URL = "#{KB_ROOT}/accounts"

COMMON_HEADERS = [
  { name: 'Authorization', value: 'Basic ' + Base64.encode64("#{ENV['USERNAME'] || 'admin'}:#{ENV['PASSWORD'] || 'password'}").chomp },
  { name: 'X-Killbill-ApiKey',    value: ENV['API_KEY'] || 'bob' },
  { name: 'X-Killbill-ApiSecret', value: ENV['API_SECRET'] || 'lazar' },
  { name: 'X-Killbill-CreatedBy', value: ENV['CREATED_BY'] || 'JMeter' },
  { name: 'Accept', value: 'application/json' },
  { name: 'Content-Type', value: 'application/json' }
]

#
# JMeter configuration
#

NB_THREADS = ENV['NB_THREADS'] || 20
DURATION = ENV['DURATION'] || (5 * 60)

LOCATION_ID_REGEX = "Location: http://.*/(.+)/?"

DEFAULT_SETUP = Proc.new do
  save_responses_to_a_file filename: "#{LOGS_PREFIX}_setup_", timestamp: false

  get name: :'Threads', url: KB_THREADS_URL
  get name: :'Metrics', url: KB_METRICS_URL
end
{'fraction_non_alphanumeric': 0.19277552524880207, 'fraction_numerical': 0.020272760781422778, 'mean_word_length': 5.477326968973747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2359063', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1096, 'n_words': 184}