diff --git a/Data/uat/InstallData.cmd b/Data/uat/InstallData.cmd new file mode 100644 index 0000000..3f3b8b0 --- /dev/null +++ b/Data/uat/InstallData.cmd @@ -0,0 +1,22 @@ +@echo off + +if "%1"=="" goto :usage +if "%1"=="sys" goto :usage +if "%1"=="system" goto :usage + +sqlplus %1 @delete_demo_data +sqlldr %1 control=prty + +sqlldr %1 control=parl + +sqlldr %1 control=apau + +sqlplus %1 @create_passwords + +goto :done + +:usage + +echo usage InstallData user/password@database + +:done diff --git a/Data/uat/apau.ctl b/Data/uat/apau.ctl new file mode 100644 index 0000000..0dd363f --- /dev/null +++ b/Data/uat/apau.ctl @@ -0,0 +1,50 @@ +LOAD DATA +INFILE * +INTO TABLE apex_authorization +REPLACE +FIELDS TERMINATED BY '|' +( +rt_code +,component_name +,component_type +,privilege +) +BEGINDATA +SUPPADMIN|adminmenu|C|A +SUPPADMIN|61|P|A +SUPPADMIN|62|P|A +SUPPADMIN|63|P|A +SUPPADMIN|64|P|A +SUPPADMIN|68|P|A +MIPADMIN|adminmenu|C|A +MIPADMIN|icadmin|C|A +MIPADMIN|sysadmin|C|A +MIPADMIN|5|P|A +MIPADMIN|7|P|A +MIPADMIN|8|P|A +MIPADMIN|9|P|A +MIPADMIN|10|P|A +MIPADMIN|11|P|A +MIPADMIN|12|P|A +MIPADMIN|13|P|A +MIPADMIN|14|P|A +MIPADMIN|15|P|A +MIPADMIN|18|P|A +MIPADMIN|19|P|A +MIPADMIN|30|P|A +MIPADMIN|31|P|A +MIPADMIN|32|P|A +MIPADMIN|42|P|A +MIPADMIN|61|P|A +MIPADMIN|62|P|A +MIPADMIN|63|P|A +MIPADMIN|64|P|A +MIPADMIN|68|P|A +AGENT|11|P|A +AGENT|32|P|A +ICU|icadmin|C|A +ICU|32|P|A +ICU|42|P|A +CS|11|P|A +CS|32|P|R +CS|32|P|A \ No newline at end of file diff --git a/Data/uat/apex_auto_install.rb b/Data/uat/apex_auto_install.rb new file mode 100644 index 0000000..3c40f78 --- /dev/null +++ b/Data/uat/apex_auto_install.rb @@ -0,0 +1,150 @@ +#requires +require 'watir' +#email stuff +require 'net/smtp' + +#used to handle javascript popups +require 'watir/contrib/enabled_popup' +require 'watir/WindowHelper' +# +# Method to handle javascript popups. +# +require 'thread' +# +require 'win32ole' +# +def startClicker( button , waitTime = 3) + w = WinClicker.new + longName = @@ie.dir.gsub("/" , "\\" ) + shortName = w.getShortFileName(longName) + c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime} " + puts "Starting #{c}" + w.winsystem(c) + w=nil +end + + + + +#includes +include Watir +@@ie = IE.new +@@ie.visible= true +#set the speed of watir +@@ie.speed = :fast +#backup 2 directories +Dir.chdir('..') +Dir.chdir('..') +#we're in windows, so replace the forwards with the backs +workingdir = Dir.getwd.to_s.gsub!('/','\\') +#Set constants for import +ORIGINAL_APP_ID = '155' +NEW_APP_ID = '400' +SCHEMA = 'MIP_UAT' +APEX_EXPORT_SCRIPTS_DIR = workingdir +'\\Screens\\' +APPLICATION_SCRIPT = 'f155.sql' +CSS_SCRIPT = 'css.sql' +IMAGES_SCRIPT = 'f155_img.sql' +THEME_SCRIPT = 'f155_theme_101.sql' +ADID = '4550' #APEX admin identifier +WORKSPACE = 'MIP_UAT' +USER = 'ADMIN' +PASSWORD = 'password' +DELETE_PREVIOUS_IMPORTS = false + +def importpageone (p_file, p_file_type, p_charset) + @@ie.link(:title, 'Application Builder').click + @@ie.wait + @@ie.button(:value, 'Import >').click + @@ie.wait + @@ie.file_field(:id, "P460_FILE").set(p_file) + @@ie.select_list(:id, "P460_FILE_TYPE").select p_file_type + @@ie.select_list(:id, "P460_FILE_CHARSET").select p_charset + @@ie.button(:value, 'Next >').click + @@ie.wait + @@ie.button(:value, 'Next >').click + @@ie.wait +end + +begin + #Login + @@ie.goto("http://loordv01/pls/apex/f?p=#{ADID}:1") + @@ie.text_field(:id, "F#{ADID}_P1_COMPANY").set(WORKSPACE) + @@ie.text_field(:id, "F#{ADID}_P1_USERNAME").set(USER) + @@ie.text_field(:id, "F#{ADID}_P1_PASSWORD").set(PASSWORD) + @@ie.button(:value, 'Login').click + @@ie.wait + #Import Application export file + importpageone(APEX_EXPORT_SCRIPTS_DIR+APPLICATION_SCRIPT, + 'Application, Page or Component Export', + 'Western European Windows 1252') + #parse page + @@ie.select_list(:id, "P49_PARSE_AS" ).select(SCHEMA) + @@ie.select_list(:id, "P49_BUILD_STATUS" ).select 'Run and Build Application' + @@ie.radio(:id, "P49_NEW_FLOW_OPT_2" ).set + @@ie.wait + @@ie.text_field(:id, "P49_NEW_FLOW_ID").set(NEW_APP_ID) + @@ie.button(:value, 'Install').click + @@ie.wait + #This button won't appear the first time the import occurs + if @@ie.button(:value, 'Replace Existing Application '+NEW_APP_ID).exists? + @@ie.button(:value, 'Replace Existing Application '+NEW_APP_ID).click + @@ie.wait + end + #Install Supporting objects + @@ie.radio(:id, "P2100_ACTION_0" ).set + @@ie.button(:value, 'Next >').click + @@ie.wait + @@ie.button(:value, 'Install').click + @@ie.wait + #Install CSS + + #Need to delete the existing CSS file before installing a new one + #have decided to just install the application for the moment. + #back to install page start + + importpageone(APEX_EXPORT_SCRIPTS_DIR+CSS_SCRIPT, + 'CSS Export', + 'Western European Windows 1252') + + if DELETE_PREVIOUS_IMPORTS + #er this code does not work from the Loordv001 box + #it will run on JP's machine if this code is run from a + #dos prompt - it's an issue with ruby trying to spawn a + #new thead to look for the open dialogue box + @@ie.link(:title, 'Manage Export Repository').click + @@ie.wait + @@ie.checkboxes.each { |c| c.set } + #Click the annoying are you sure button that pops up + startClicker("OK", 1) + @@ie.button(:value, 'Delete Checked').click + @@ie.wait + end + @@ie.close + +rescue StandardError => anyerror +#Hopefully we never get here but, we'll try and send an email if the +#script errors so we can fix it +#don't leave memory hungry instances of ie running if we get an error +@@ie.close + +#build the email +from_addr = 'jamie.priest@advantica.com' +to_addr = 'jamie.priest@advanticagroup.com' +project = 'webMIP UAT build process' +emailtext = < +To: Jamie Priest <#{to_addr}> +Subject: #{project} automated test failure + +An automated assertion failed for the project +#{project} + +#{anyerror} + +END_EMAIL + Net::SMTP.start('relay01.sleek.net') do |smtp| + smtp.sendmail emailtext, from_addr, to_addr + end + +end \ No newline at end of file diff --git a/Data/uat/create_passwords.sql b/Data/uat/create_passwords.sql new file mode 100644 index 0000000..4bafe9b --- /dev/null +++ b/Data/uat/create_passwords.sql @@ -0,0 +1,21 @@ +DECLARE + l_hash varchar2(240); +BEGIN + FOR l_pwd IN (SELECT id, username + FROM parties + WHERE username IS NOT NULL) LOOP + + l_hash := mip_security.get_hash(p_username=>l_pwd.username, p_password=>'password'); + + INSERT INTO passwords + (prty_id + ,password_hash + ,created_on) + VALUES + (l_pwd.id + ,l_hash + ,SYSDATE); + END LOOP; +END; +/ +exit diff --git a/Data/uat/delete_demo_data.sql b/Data/uat/delete_demo_data.sql new file mode 100644 index 0000000..7d58f9c --- /dev/null +++ b/Data/uat/delete_demo_data.sql @@ -0,0 +1,5 @@ +delete from party_relationships; +delete from party_roles; +delete from passwords; +delete from parties; +exit diff --git a/Data/uat/parl.ctl b/Data/uat/parl.ctl new file mode 100644 index 0000000..aac1e7e --- /dev/null +++ b/Data/uat/parl.ctl @@ -0,0 +1,15 @@ +LOAD DATA +INFILE * +INTO TABLE party_roles +REPLACE +FIELDS TERMINATED BY '|' +( +prty_id +,rt_code +,id +,start_date +,end_date +,description +) +BEGINDATA +1|MIPADMIN|4091|08-NOV-07||| diff --git a/Data/uat/prel.ctl b/Data/uat/prel.ctl new file mode 100644 index 0000000..f49d40f --- /dev/null +++ b/Data/uat/prel.ctl @@ -0,0 +1,35 @@ +LOAD DATA +INFILE * +INTO TABLE party_relationships +REPLACE +FIELDS TERMINATED BY '|' +( +from_parl_id +,to_parl_id +,from_parl_prty_id +,to_parl_prty_id +,from_parl_rt_code +,to_parl_rt_code +,start_date +,from_prtp_rt_code +,to_prtp_rt_code +) +BEGINDATA +4041|2001|404|200|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4041|2011|404|201|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4041|2021|404|202|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4051|2001|405|200|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4051|2011|405|201|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4051|2021|405|202|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4061|2031|406|203|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4061|2041|406|204|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4061|2051|406|205|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4071|2031|407|203|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4071|2041|407|204|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4071|2051|407|205|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4081|2061|408|206|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4081|2071|408|207|AGENT|SUPP|08-NOV-07|AGENT|SUPP +4081|2081|408|208|AGENT|SUPP|08-NOV-07|AGENT|SUPP +5000|2001|419|200|SUPPADMIN|SUPP|03-FEB-08|SUPPADMIN|SUPP +5001|2011|420|201|SUPPADMIN|SUPP|03-FEB-08|SUPPADMIN|SUPP +5002|2021|421|202|SUPPADMIN|SUPP|03-FEB-08|SUPPADMIN|SUPP \ No newline at end of file diff --git a/Data/uat/prty.ctl b/Data/uat/prty.ctl new file mode 100644 index 0000000..90c41f7 --- /dev/null +++ b/Data/uat/prty.ctl @@ -0,0 +1,29 @@ +LOAD DATA +INFILE * +INTO TABLE parties +REPLACE +FIELDS TERMINATED BY '|' +( +manu_ref +,created_by +,shortcode +,name +,description +,created_on +,updated_on +,updated_by +,mktp_ref +,lt_7b_contract_ref +,gt_7b_contract_ref +,adversarial_contract_ref +,username +,status +,first_name +,last_name +,personal_title +,comments +,id +,prty_type +) +BEGINDATA +|advantica||||08-NOV-07|||||||advantica|OPEN|Advantica|User|Mr|User|1|PERS \ No newline at end of file