Commit aea7e49f authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Update of vc_resourcesList moved to f_setResource


Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent df8d334a
......@@ -7,7 +7,7 @@
*
* @author oneM2M
* @version $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 325 2017-07-24 16:17:05Z reinaortega $
* $Id: OneM2M_Functions.ttcn 327 2017-07-26 06:25:46Z reinaortega $
* @desc Module containing functions for oneM2M
*
*/
......@@ -212,8 +212,7 @@ module OneM2M_Functions {
f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent);
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_aeAuxIndex};
v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
if(ispresent(vc_aeAux.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID)));
......@@ -281,8 +280,7 @@ module OneM2M_Functions {
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
vc_aeAux := v_response.primitive.responsePrimitive.primitiveContent.aE;
v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent);
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_aeAuxIndex};
v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
if(ispresent(vc_aeAux.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID)));
......@@ -436,10 +434,7 @@ module OneM2M_Functions {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly");
f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_parentIndex);
if(match(int2, p_resourceType) or match(-1, p_parentIndex)) {//If created resource is an AE or created under CSEBase, it needs to be added to the resourceToBeDeleted list
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_resourceIndex};
}
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, p_parentIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -483,9 +478,8 @@ module OneM2M_Functions {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(1) & " created successfuly");
f_checkAttributesToBeSaved(int1, v_request, v_response.primitive.responsePrimitive);
v_acpAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent);
v_acpAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1);
vc_acpAuxIndex := v_acpAuxIndex;
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_acpAuxIndex};
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -1094,8 +1088,7 @@ module OneM2M_Functions {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, -1);
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_resourceIndex};
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -1248,7 +1241,7 @@ module OneM2M_Functions {
p_resource.aE := v_ae;
p_modifiedResource.aE := v_aeModified;
return f_setResource(p_resource, p_parentIndex);
return f_setResource(p_resource, p_resourceType, p_parentIndex);
}
......@@ -1725,14 +1718,20 @@ module OneM2M_Functions {
* @return Internal resource index of the saved resource
* @verdict
*/
function f_setResource(PrimitiveContent p_resource, integer p_parentIndex := -1) runs on Tester return integer {
function f_setResource(PrimitiveContent p_resource, ResourceType p_resourceType, integer p_parentIndex := -1) runs on Tester return integer {
var integer v_newIndex := -1;
if(isbound(vc_resourcesList)) {
vc_resourcesList[lengthof(vc_resourcesList)] := {p_parentIndex, p_resource};
vc_resourcesList[lengthof(vc_resourcesList)] := {p_parentIndex, p_resourceType, p_resource};
} else {
vc_resourcesList[0] := {p_parentIndex, p_resource};
vc_resourcesList[0] := {p_parentIndex, p_resourceType, p_resource};
}
return lengthof(vc_resourcesList)-1;
v_newIndex := lengthof(vc_resourcesList)-1;
if(match(int2, p_resourceType) or match(-1, p_parentIndex)) {//If created resource is an AE or created under CSEBase, it needs to be added to the resourceToBeDeleted list
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_newIndex};
}
return v_newIndex;
}
......
......@@ -7,7 +7,7 @@
*
* @author oneM2M
* @version $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Types.ttcn $
* $Id: OneM2M_Types.ttcn 318 2017-07-13 12:35:45Z berge $
* $Id: OneM2M_Types.ttcn 327 2017-07-26 06:25:46Z reinaortega $
* @desc OneM2M data types module
*
*/
......@@ -7794,6 +7794,7 @@ group InvalidTypes {
type record MyResource {
integer parentIndex,
ResourceType resourceType,
PrimitiveContent resource
};
......
......@@ -7,7 +7,7 @@
*
* @author oneM2M
* @version $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases.ttcn $
* $Id: OneM2M_Testcases.ttcn 324 2017-07-24 16:16:08Z reinaortega $
* $Id: OneM2M_Testcases.ttcn 327 2017-07-26 06:25:46Z reinaortega $
* @desc Module containing test cases for oneM2M
*
*/
......@@ -2207,9 +2207,8 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, v_parentIndex);
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_resourceIndex};
}
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType)));
......
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