#=============================================================================================
# @TITLE			Configuration - Volumes
#
# @NUMBER			WDBM_FKT_02052
#
# @DESCRIPTION		'Configuration - Volumes' will be checked completly.
#
# @EXP_RESULT		
#
# @REQUIREMENTS		Test: WDBM_FKT_01000; WDBM_FKT_00100; WDBM_FKT_01010;
#=============================================================================================

public function trim (in str) {
	if (substr(str, 1, 1) == " ") {

		str = trim(substr(str, 2));
	}
	if (substr(str, length(str)) == " ") {
		str = trim(substr(str, 1, length(str)-1));
	}
	return (str);
} 

static header_data_ok = 1;
static header_data [] = {"Name","Size","Device Type","Location"};
 
static header_log_ok = 1;
static header_log [] = {"Name","Size","Device Type","Location","Mirrored Location",
						"Mirrored Device Type"};

static header_system_ok = 1;
static header_system [] = {"Name","Size","Device Type","Location"};
#=============================================================================================
# @STEP 1			Checking the shown text and radiobuttons.
#=============================================================================================
set_window(menu_window, 1);

if (version == "7.3.00") {
	web_link_click("Volumes_1");
}
if (version == "7.4.03" ||
	version == "7.5.00" ||
	version == "7.5.01" ||
	version == "7.6.00") {
	web_link_click("Volumes_2");
}

wait(5);
set_window (work_window, 1);
web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_1, "", "", 1);

if ((trim(cell_value_1) == "Volumes - " & database && version == "7.3.00") ||
	(trim(cell_value_1) == "Configuration - Volumes" && (version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
	
	tl_step("Title of window - " & cell_value,"0","is correct");
} else {
	tl_step("Title of window - " & cell_value,"1","is incorrect");
}
#=============================================================================================
# @STEP 2			Checking the shown text and radiobuttons.
#=============================================================================================
set_window(work_window, 1);
for (i=1;i<5;i++) {
	
	if (new_interface == 1) {
		web_obj_get_text ("1x1_3", "#2", "#"&i, cell_value_2, "", "", 1);
	} else {
		tbl_get_cell_data ("1x1_5", "#2", "#"&i, cell_value_2);	
	}
	
	if (trim(cell_value_2) != header_data [i-1]) {
		header_data_ok = 0;
		break;
	}
}
if(header_data_ok == 0) {
	tl_step("Header","1","Data - Volumes");
} else {
	tl_step("Header","0","Data - Volumes");
}

if (obj_exists("MAXDATADEVSSPACES",0) == 0) {

	web_link_click("MAXDATADEVSSPACES");
	
	wait(5);
	
	set_window (work_window, 1);
	web_frame_get_text (work_window, text, "", "", 1);

	if (match (text, "The page cannot be displayed") != 0) {
		
		tl_step ("The link 'MAXDATADEVSSPACES'", "1", "is not working");
		
		set_window(menu_window, 1);

		if (version == "7.3.00") {
			web_link_click("Volumes_1");
		}
		if (version == "7.4.03" ||
			version == "7.5.00" ||
			version == "7.5.01" ||
			version == "7.6.00") {
			web_link_click("Volumes_2");
		}
	} else {
	
		if (win_exists ("Alert", 0) == E_OK) {
				
			set_window ("Alert", 1);
			button_press("OK");
			
			tl_step ("Configuration - Volumes", "1", "The link 'MAXDATADEVSSPACES' is not working");
		} else {

		
			set_window(work_window, 1);
			tbl_get_cell_data("1x1_2","#3","#3",cell_value_2);
		
			set_window(work_window, 1);
			web_link_click("Cancel");
			wait(3);
			set_window(work_window, 1);
			tbl_get_cell_data("Owner","#2","#3",cell_value_3);
			
			if (cell_value_2 == cell_value_3) {
				tl_step("Max. Data Volumes","0","Value read out correctly");
			} else {
				tl_step("Max. Data Volumes","1","Value read out incorrectly");
			}
		}
	}
}
#=============================================================================================
# @STEP 3			Checking DATA0001.
#=============================================================================================
set_window(work_window, 1);
if (new_interface == 1) {
	web_obj_get_text ("1x1_3", "#3", "#1", cell_value_4, "", "", 1);
} else {
	web_obj_get_text ("DATA0001", "#0", "#0", cell_value_4, "", "", 1);
}
if (trim(cell_value_4) == "DATA0001") {

	set_window(work_window, 1);
	web_link_click("DATA0001");
	wait(3);
	
	set_window(work_window, 1);
	web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_5, "", "", 1);
	
	if (((trim(cell_value_5) == "Volume - DATA0001" &&
		obj_exists("Location",0) == 0 &&
		obj_exists("Type",0) == 0 &&
		obj_exists("Type_1",0) == 0 &&
		obj_exists("Type_2",0) == 0) &&
		version == "7.3.00") ||
	
		((trim(cell_value_5) == "Configuration - Volumes - DATA0001" &&
		obj_exists("Location",0) == 0 &&
		obj_exists("Type",0) == 0 &&
		obj_exists("Type_1",0) == 0 &&
		obj_exists("Type_2",0) == 0) &&
		(version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
		
		tl_step("DATA0001 - all items are displayed","0","");
	} else {
		tl_step("DATA0001 - not all items are displayed","1","");
	}
	web_link_click("Cancel");
	wait(3);
}
#=============================================================================================
# @STEP 4			Checking Volumes - Log.
#=============================================================================================
set_window(work_window, 1);

if (version == "7.3.00") {		
	web_link_click("Log");
}
if (version == "7.4.03" ||
	version == "7.5.00" ||
	version == "7.5.01" ||
	version == "7.6.00") {
	
	web_link_click("Log");
}
wait(3);

set_window(work_window, 1);
for (i=1;i<5;i++) {
	
	if (new_interface == 1) {
		web_obj_get_text ("1x1_3", "#2", "#"&i, cell_value_6, "", "", 1);
	} else {
		tbl_get_cell_data ("1x1_6", "#2", "#"&i, cell_value_6);	
	}
	
	if (trim(cell_value_6) != header_log [i-1]) {
	
		header_log_ok = 0;
		break;
	}
}
if(header_log_ok == 0) {
	tl_step("Header","1","Log - Volumes");
} else {
	tl_step("Header","0","Log - Volumes");
}

if(obj_exists("MAXARCHIVELOGS",0) == 0) {

	web_link_click("MAXARCHIVELOGS");	
	wait(5);
	
	set_window (work_window, 1);
	web_frame_get_text (work_window, text, "", "", 1);

	if (match (text, "The page cannot be displayed") != 0) {
		
		tl_step ("Configuration - Volumes", "1", "The link 'MAXARCHIVELOGS' is not working");
		
		set_window(menu_window, 1);

		if (version == "7.3.00") {
		
			web_link_click("Volumes_1");
			set_window(work_window, 1);
			web_link_click("Log");
		}
		if (version == "7.4.03" ||
			version == "7.5.00" ||
			version == "7.5.01" ||
			version == "7.6.00") {
			
			web_link_click("Volumes_2");
			set_window(work_window, 1);
			web_link_click("Log");
		}
	} else {
	
		if (win_exists ("Alert", 0) == E_OK) {
				
			set_window ("Alert", 1);
			button_press("OK");
			
			tl_step ("Configuration - Volumes", "1", "The link 'MAXARCHIVELOGS' is not working");
		} else {

			set_window(work_window, 1);
			tbl_get_cell_data("1x1_2","#3","#3",cell_value_2);
		
			set_window(work_window, 1);
			web_link_click("Cancel");
			wait(3);
			set_window(work_window, 1);
			tbl_get_cell_data("Install database instance","#3","#3",cell_value_3);
			
			if (cell_value_2 == cell_value_3) {
				tl_step("Max. Log Volumes","0","Value read out correctly");
			} else {
				tl_step("Max. Log Volumes","1","Value read out incorrectly");
			}
		}
	}
}
#=============================================================================================
# @STEP 5			Checking LOG001.
#=============================================================================================
set_window(work_window, 1);

if (new_interface == 1) {
	web_obj_get_text ("1x1_3", "#3", "#1", cell_value_7, "", "", 1);
} else {
	tbl_get_cell_data("LOG001","#0","#0",cell_value_7);
}

if (trim(cell_value_7) == "LOG001") {

	set_window(work_window, 1);
	web_link_click("LOG001");
	wait(3);
	
	set_window(work_window, 1);
	web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_8, "", "", 1);
	
	if (database == "DB73") {
    	
    	if (trim(cell_value_8) == "Volume - LOG001" && 
    		obj_exists("Location",0) == 0 &&
			obj_exists("Type",0) == 0 &&
			obj_exists("Type_1",0) == 0 &&
			obj_exists("Type_2",0) == 0) {
			
    		tl_step("DATA0001 - all items are displayed","0","");
    	} else {
    		tl_step("DATA0001 - not all items are displayed","1","");
    	}
	} else {

    	if (((trim(cell_value_8) == "Volume - LOG001" && 
    		obj_exists("Location",0) == 0 &&
			obj_exists("Type",0) == 0 &&
			obj_exists("Type_1",0) == 0 &&
			obj_exists("Type_2",0) == 0) &&
			version == "7.3.00") ||
			
			(trim(cell_value_8) == "Configuration - Volumes - LOG001" && 
    		obj_exists("Location",0) == 0 &&
			obj_exists("Type",0) == 0 &&
			obj_exists("Type_1",0) == 0 &&
			obj_exists("Type_2",0) == 0 &&
			(version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
			
    		tl_step("DATA0001 - all items are displayed","0","");
    	} else {
    		tl_step("DATA0001 - not all items are displayed","1","");
    	}
	}
	set_window(work_window, 1);
	web_link_click("Cancel");
	wait(3);
}
#=============================================================================================
# @STEP 6			Checking Volumes - System.
#=============================================================================================
if (match ("74", database) != 0) {

    set_window(work_window, 1);
    web_link_click("System");
    wait(3);
    set_window(work_window, 1);
	
    for (i=1;i<5;i++) {
	
		if (new_interface == 1) {
			web_obj_get_text ("1x1_3", "#2", "#"&i, cell_value_9, "", "", 1);
		} else {
			tbl_get_cell_data ("1x1_6", "#2", "#"&i, cell_value_9);	
		}
	
    	if (trim(cell_value_9) != header_system [i-1]) {
    		header_system_ok = 0;
    		break;
    	}
    }
    if(header_system_ok == 0) {
    	tl_step("Header","1","System - Volumes");
    } else {
    	tl_step("Header","0","System - Volumes");
    }
#=============================================================================================
# @STEP 7			Checking SYS001.
#=============================================================================================
	if (new_interface == 1) {
		web_obj_get_text ("1x1_3", "#3", "#1", cell_value_10, "", "", 1);
	} else {
		tbl_get_cell_data ("1x1_6", "#3", "#1", cell_value_10);	
	}
    
    if (trim(cell_value_10) == "SYS001") {
	
    	set_window(work_window, 1);
    	web_link_click("SYS001");
    	wait(3);
    	
    	set_window(work_window, 1);
		if (new_interface == "1") {
			web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_11, "", "", 1);
		} else {
			tbl_get_cell_data ("Database/Servername", "#1", "#1", cell_value_11);
		}
    	
    	if (trim(cell_value_11) == "Volume - " & database & " - SYS001" && 
    		obj_exists("Location",0) == 0 &&
			obj_exists("Type",0) == 0 &&
			obj_exists("Type_1",0) == 0 &&
			obj_exists("Type_2",0) == 0) {
			
    		tl_step("DATA0001 - all items are displayed","0","");
    	} else {
    		tl_step("DATA0001 - not all items are displayed","1","");
    	}
    	web_link_click("Cancel");
    	wait(3);
    }
}
