#!/bin/perl
############################################################################
# QA Script for version 2.0 publishing system.
# Authors: Guy Kane, Erez Ben simon
# Last update: 11/12/00
############################################################################
$USER = "reuven" ; #specifies the user,pass,host,and file as constans
$PASS = "reuven" ; #sending Interactive function
$HOST = "mgs"; #stdin=standard input
$FILE = "pub.sql";
Interactive ();
system ("$CLEAN");
print ("\n\n\n\n\t\t *** Publishing Test ***\n\t\t-------------------------");
print ("\n\n\n\nPress Enter to start the test...\n");
$ZEVEL = <STDIN>;
###########################################################################
#V2.0-SYS-01 Define Globecom Administrator. #erasing the contence of the file and opening it
system ("$CLEAN"); #and printing output into it
print ("\n!!! V2.0-SYS-01 Define Globecom Administrator\n\n"); #running sql from the file
system ("$REMOVE $FILE"); #01-Define Globecom Administrator from the admin gui
OpenFile();
print ("\n!!! select * from ACCOUNTS where NAME like 'GLOBECOM'\n");
print FILE (" select * from ACCOUNTS where NAME like 'GLOBECOM';\nexit;");
run_sql();
############################################################################
#V2.0-SYS-02 ADD Accounts
system ("$CLEAN");
print ("\n!!! V2.0-SYS-02 ADD Accounts\n");
print ("\n!!! ADD QA-ACOUNT1 Account in admin.account_details\n\n");
system ("$REMOVE $FILE");
OpenFile();
print ("\n!!! select * from ACCOUNTS where Name like 'QA-ACOUNT1';\n");
print FILE ("select * from ACCOUNTS where Name like 'QA-ACOUNT1';\nexit;");
run_sql();
############################################################################
#V2.0-SYS-03 ADD Accounts Users
system ("$CLEAN");
print ("\n!!! V2.0-SYS-03 ADD Accounts Users\n\n");
system ("$REMOVE $FILE");
OpenFile();
print ("\n!!! select NAME from Users where account like 'QA-ACOUNT1';");
print FILE ("select NAME from Users where user_id in (select user_id from USER_ACCOUNTS where account_id in (select account_id from accounts where name = QA-ACOUNT1 ;\nexit;");
print ("\n!!! c where account like 'QA-ACOUNT2';");
print FILE ("select * from Users where account like 'QA-ACOUNT2';\nexit;");
print ("\n!!! select * from Users where account like 'QA-ACOUNT3';");
print FILE ("select * from Users where account like 'QA-ACOUNT3';\nexit;");
print ("\n!!! select * from Users where account like 'QA-ACOUNT4';");
print FILE ("select * from Users where account like 'QA-ACOUNT4';\nexit;");
print ("\n!!! select * from Users where account like 'QA-ACOUNT4';");
print FILE ("select * from Users where account like 'QA-ACOUNT4';\nexit;");
run_sql();
############################################################################
#V2.0-SYS-04 Checking the creation of nods
print ("\n!!! V2.0-SYS-04 Checking the creation of nods\n");
system ("$REMOVE $FILE");
OpenFile();
print ("select * from NODES;");
print FILE ("select * from NODES;\nexit;");
run_sql();
$ZEVEL = <STDIN>;
############################################################################
#V2.0-SYS-05 Create a ROOT Base Account PK.
print ("\n!!! V2.0-SYS-05 Checking the creation of accounts\n\n");
system ("$REMOVE $FILE");
OpenFile();
print FILE ("select * from PK;\nexit;");
run_sql();
$ZEVEL = <STDIN>;
############################################################################
#V2.0-SYS-06 Checking the creation of a second inheritor Account PK
print ("\n!!! V2.0-SYS-06 Checking the creation of a second inheritor Account PK\n\n");
system ("$REMOVE $FILE");
OpenFile();
print FILE ("\nselect * from PK where NAME like PK1;\n");
print FILE ("select * from PK where NAME like PK1;\nexit;");
run_sql();
$ZEVEL = <STDIN>;
############################################################################
print ("\n!!! V2.0-SYS-07 Checking the creation of the Account Profiles\n\n");
system ("$CLEAN");
system ("$REMOVE $FILE");
OpenFile();
print ("\n!!! select name from profile where profile_id in (select profile_id from account profile where account_id in (select account_id from accounts where name= QA-ACOUNT1));\n\n;");
print FILE ("select name from profile where profile_id in (select profile_id from account profile where account_id in (select account_id from accounts where name= QA-ACOUNT1));\nexit;");
run_sql();
###########################################################################
sub OpenFile #12/3/00 7:17PM
###########################################################################
{
open (FILE, ">$FILE");
} ##OpenFile
############################################################################
sub run_sql #03/12/2000 18:02
############################################################################
{
system ("sqlplus $USER/$PASS\@$HOST \@$FILE");
print ("\n--------------------------------------------------------\nPress Enter to continue");
$ZEVEL = <STDIN>;
} ##run_sql
############################################################################
sub Interactive #12/11/00 11:20AM
############################################################################
{
print ("Inser OS: \n1 - Unix\n2 - NT\n\n");
$OS = <STDIN>;
chop $OS;
if ($OS == "1")
{ $REMOVE = "rm"; $CLEAN = "clear" }
else
{
$REMOVE = "del"; $CLEAN = "cls"
}
} ##Interactive