Commit cd805103 authored by vlad_burin's avatar vlad_burin
Browse files

Loading Components and links from xml for UMockUnet added

--HG--
branch : MockCompsTest
parent ff55befea49f
......@@ -43,6 +43,12 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
for(int i =0, params = serstorage->GetNumNodes(); i <params; i++)
{
serstorage->SelectNode(i);
//
if(serstorage->GetNodeName() == "Components" || serstorage->GetNodeName() == "Links")
{
serstorage->SelectUp();
break;
}
for(int j = 0, props = serstorage->GetNumNodes(); j < props; j++)
{
serstorage->SelectNode(j);
......@@ -78,10 +84,63 @@ UMockUNet::UMockUNet(RDK::USerStorageXML *serstorage, UStorage* storage)
// XML
ClassDesriptionXML.Destroy();
// TODO ( )
std::string temp;
serstorage->Save(temp);
ClassDesriptionXML.Load(temp,"");
//
DelAllComponents();
if(!serstorage->SelectNode("Components"))
{
LogMessageEx(RDK_EX_DEBUG, __FUNCTION__, std::string("Components section not found"));
return;
}
storage = GetStorage();
for(int i=0;i<serstorage->GetNumNodes();i++)
{
serstorage->SelectNode(i);
std::string nodename=serstorage->GetNodeName();
std::string name=serstorage->GetNodeAttribute("Class");
try
{
int id=Storage->FindClassId(name);
UEPtr<UNet> newcont=dynamic_pointer_cast<UNet>(storage->TakeObject(id));
if(!newcont)
continue;
if(FindStaticComponent(name,nodename) == 0) //
{
if(AddComponent(static_pointer_cast<UContainer>(newcont)) == ForbiddenId)
{
storage->ReturnObject(newcont);
continue;
}
}
if(!newcont->LoadComponent(serstorage,false))
{
std::string tempname;
LogMessageEx(RDK_EX_DEBUG, __FUNCTION__, std::string("LoadComponent failed: ")+newcont->GetFullName(tempname));
}
}
catch(UException &exception)
{
if(Logger)
Logger->ProcessException(exception);
}
serstorage->SelectUp();
}
serstorage->SelectUp();
//
serstorage->SelectNode("Links");
if(!SetComponentInternalLinks(serstorage,0))
{
LogMessageEx(RDK_EX_DEBUG, __FUNCTION__, std::string("Links creating failed in class ") + class_name);
return;
}
serstorage->SelectUp();
}
UMockUNet* UMockUNet::New(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment