#=============================================================================================
# @TITLE			Recovery - Devspaces - check table
#
# @NUMBER			WDBM_FKT_02022
#
# @DESCRIPTION		The database with two mirrored devspaces will be manipulated by deleting
# @					the 2nd devspace. The destroyed devspace will be reintegrate by using 
# @					'Recovery Devspaces'.
#
# @EXP_RESULT		The reintegration of the destroyed devspaces will work fine and the test
# @					passes through.
#
# @REQUIREMENTS		Test: WDBM_FKT_01000; WDBM_FKT_00100; WDBM_FKT_01010;
#=============================================================================================

static dev_table_items_ok = 1;
static dev_table_items [] = {
								{"Name","Status"},
								{"MLOG_001","BAD"}
							};
#=============================================================================================
# @STEP 1			Checking interface for Recovery bad indexes.
#=============================================================================================
set_window (menu_window, 7);
web_link_click("Volumes_1");

set_window (work_window, 2);
obj_get_info("Reintegrate","enabled",value_10);

if (obj_exists("Reintegrate",0) == 0 &&
	value_10 == 1) {
	tl_step("Reintegrate button","0","active and displayed");
} else {
	tl_step("Reintegrate button","1","inactive or not displayed");
}
#=============================================================================================
# @STEP 2			Delete 2nd devspace - Batch file.
#=============================================================================================
set_window (state_window, 3);
web_link_click("Offline");
wait(30);

if (database == "DB73") {
	dos_system("del d:\\SAPDevelop\\V7300\\develop\\usr\\wrk\\DB73\MLOG_001");
} else {
	dos_system("del d:\\SAPDevelop\\V74\\develop\\usr\\wrk\\DB74\MLOG_001");
}
wait(5);

set_window (state_window, 0);
web_link_click("Online");
wait(30);
set_window (menu_window, 5);

if (version == "7.3.00") {
	web_link_click("Devspaces");
} else { 
	web_link_click("Volumes_1");
}
#=============================================================================================
# @STEP 3			Checking the tablecontent.
#=============================================================================================
set_window (work_window, 2);
obj_get_info("Item_2","enabled",value_7);

if (obj_exists("Item_2",0) == 0 &&
	value_7 == 1) {

	tl_step("Checkbox","0","displayed and active");
	button_set("Item_2",ON);
	
	set_window (work_window, 2);
	for(n=1;n<4;n++) {
		for(i=2;i<4;i++) {
		
			tbl_get_cell_data("http://p38387:85/WARoot/Images/cornergb.gif http://p38387:85/WARoot/Im_1","#"&n,"#"&i,cell_value);
			
			if (cell_value != dev_table_items [n-1,i-2]) {
				dev_table_items_ok = 0;
				break;
			}
		}
	}
} else {
	tl_step("Checkbox","1","not displayed or not active");
}

if (dev_table_items_ok == 0) {
	tl_step("Headline or Tablecontent","1","are incorrect");
} else {
	tl_step("Headline and Tablecontent","0","are correct");
}
#=============================================================================================
# @STEP 4			Reintegrate bad devspace.
#=============================================================================================
web_link_click("Reintegrate");
wait(10);
#=============================================================================================
# @STEP 5			Checking whether successful.
#=============================================================================================
set_window (work_window, 1);
tbl_get_cell_data("1x1","#1","#2",cell_value_1);

if (obj_exists("Back",0) == 0 &&
	cell_value_1 == "Devspace action successfully finished.") {

	tl_step("Reintegration successfully - Back button","0","exists and is active");
	set_window (work_window, 1);
	web_link_click("Back");
} else {
	tl_step("Reintegration not successfully - Back button","1","do not exists or is not active");
}

set_window (work_window, 1);
tbl_get_cell_data("1x1","#1","#2",cell_value_2);

if (obj_exists("Item_2",0) != 0 &&
	cell_value_2 == "Mark the bad devspaces to be reintegrated.") {
	tl_step("Reintegration","0","was successfully");
} else {
	tl_step("Reintegration","1","was not successfully");
}
