#!/bin/sh

# ----
# Scaling factors of the DB population run
# ----
populate_num_items=1000
populate_num_ebs=100

# ----
# Test run configuration
#
# The number of browsers has to match the number of browsers used
# in the population step of the database. It's here separate only
# to make it easier to "find" the right sizing for your server.
#
# The transaction mix is:
#   1 = Browsing Mix (WIPSb)
#   2 = Shopping Mix (WIPS  default)
#   3 = Ordering Mix (WIPSo)
# ----
num_browsers=$populate_num_ebs
trans_mix=2

# ----
# The duration of the specific phases in seconds
# ----
sec_rampup=300
sec_runtime=1200
sec_rampdown=60

#web_server=www.myserver.mydomain
web_server=localhost

# ----
# Enabled WEB interactions
# The list below shows the type of interaction. To disable a certain
# interaction, replace the letter at the corresponding position with
# and underscore '_' character. Note that disabling certain transaction
# types is for testing and debugging purposes only, as it completely
# voids any test results.
#
#  1 I init:   Initial state.  Do *not* disable this state.
#  2 A admc:   Administration confirmation
#  3 A admr:   Administration request
#  4 B bess:   Best sellers page
#  5 B buyc:   Buy confirm page
#  6 B buyr:   Buy request page
#  7 C creg:   Customer registrations page
#  8 H home:   Home page.  Probably shouldn't disable this one.
#  9 N newp:   New products page
# 10 O ordd:   Order display page
# 11 O ordi:   Order inquiry page
# 12 P prod:   Product detail page
# 13 S sreq:   Search request page
# 14 S sres:   Search result page
# 15 S shop:   Shopping cart page
# ----
interactions=IAABBBCHNOOPSSS


# ----------------------------------------------------------------------
# Nothing to configure below
# ----------------------------------------------------------------------

num_customers=`expr $populate_num_ebs \* 2880`
factory="EBTPCW${trans_mix}Factory"
output_name="mix${trans_mix}_${num_browsers}of${populate_num_ebs}EBS_${populate_num_items}ITEMS"

java -cp rbe.jar rbe.RBE								\
		-EB rbe.${factory}								\
		${num_browsers} ${interactions}					\
		-HOSTS ${web_server}	\
		-OUT ${output_name}.out							\
		-DEBUG 0										\
		-ITEM ${populate_num_items}						\
		-CUST ${num_customers}							\
		-RU ${sec_rampup}								\
		-MI ${sec_runtime}								\
		-RD ${sec_rampdown}								\
		2>&1 | tee ${output_name}.log

#		-WWW    http://${web_server}:80/tpcw/			\
#		-WWWSSL https://${web_server}:443/tpcw/			\
