Commit b8047454 authored by Naum Spaseski's avatar Naum Spaseski
Browse files

Merge branch 'Test_architecture_improvement' of https://git.onem2m.org/TST/ATS...

Merge branch 'Test_architecture_improvement' of https://git.onem2m.org/TST/ATS into Test_architecture_improvement
parents 296e46ef fdd81e25
......@@ -418,6 +418,7 @@ module OneM2M_Functions {
if(p_resourceType == int23){
p_ae2 := AeSimu.create("AE2") alive;
p_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
p_ae2.done;
p_ae2Index := f_getResource(p_ae2);
if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced
p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)};
......@@ -578,7 +579,7 @@ module OneM2M_Functions {
p_cse.start(f_sendRemoteCseResource());
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex);
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
......@@ -600,7 +601,7 @@ module OneM2M_Functions {
p_ae.start(f_sendResource(p_resourceIndex));
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex);
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
......@@ -1163,7 +1164,7 @@ module OneM2M_Functions {
[] mcaPortIn.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
// if(f_isHierarchical(v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
// setverdict(fail, __SCOPE__ & ": Creator cannot contain a hierarchical address");
// v_responsePrimitive.responseStatusCode := int4000;
......@@ -1174,7 +1175,6 @@ module OneM2M_Functions {
// setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
// v_responsePrimitive.responseStatusCode := int4000;
// }
mcaPortIn.send(m_httpResponse(v_responsePrimitive));
}
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
tc_ac.stop;
......@@ -1186,9 +1186,18 @@ module OneM2M_Functions {
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
stop;
}
}
v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
if(getverdict() == pass) {
mcaPortIn.send(m_httpResponse(v_responsePrimitive));
} else {
v_responsePrimitive.responseStatusCode := int4000;
mcaPortIn.send(m_httpResponse(v_responsePrimitive));
}
//mcaPort.send(m_response(v_responsePrimitive)); // TODO have to be deleted
} //end f_subscriptionVerificationHandler
......@@ -1533,7 +1542,7 @@ module OneM2M_Functions {
}
p_myResource.remoteCSE.nodeLink := omit;
return f_setResource(p_myResource, p_resourceType, p_parentIndex);
return f_setResource(p_myResource, p_resourceType, p_parentIndex, false);
}
}
......@@ -1695,7 +1704,7 @@ module OneM2M_Functions {
p_resource.aE := v_ae;
p_modifiedResource.aE := v_aeModified;
return f_setResource(p_resource, p_resourceType, p_parentIndex);
return f_setResource(p_resource, p_resourceType, p_parentIndex, false);
}
......@@ -2185,7 +2194,7 @@ module OneM2M_Functions {
* @return Internal resource index of the saved resource
* @verdict
*/
function f_setResource(PrimitiveContent p_resource, ResourceType p_resourceType, integer p_parentIndex := -1) runs on Tester return integer {
function f_setResource(PrimitiveContent p_resource, ResourceType p_resourceType, integer p_parentIndex := -1, in boolean p_resourceToBeDeleted := true) runs on Tester return integer {
var integer v_newIndex := -1;
if(isbound(vc_resourcesList)) {
vc_resourcesList[lengthof(vc_resourcesList)] := {p_parentIndex, p_resourceType, p_resource};
......@@ -2194,8 +2203,10 @@ module OneM2M_Functions {
}
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};
if(p_resourceToBeDeleted) {
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;
......
......@@ -1221,9 +1221,9 @@ module OneM2M_Testcases {
// Tear down
f_cf02Down();
} //end TC_CSE_REG_CRE_010
}; //end TC_CSE_REG_CRE_010
group g_CSE_REG_CRE_016{
group g_CSE_REG_CRE_016 {
/**
* @desc Check that the IUT accepts a create request of <remoteCSE> resource with OPTIONAL_ATTRIBUTE.
......@@ -2528,16 +2528,17 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -2557,14 +2558,14 @@ module OneM2M_Testcases {
// Postamble
f_cse_postamble_deleteResources();
vc_resourcesIndexToBeDeleted := {};
v_ae2.start(f_cse_postamble_deleteResources());
// Tear down
//ae2.stop;
f_cf01Down();
unmap(v_ae2:mcaPort, system:mcaPort);
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_CRE_001
......@@ -2731,16 +2732,17 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -2763,7 +2765,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_CRE_002
......@@ -3209,16 +3211,17 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Accepted creation rejected for resource type " & int2str(enum2int(p_resourceType)));
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Creation rejected of resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -3242,7 +3245,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_CRE_006
......@@ -4449,6 +4452,7 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " containing attribute " & p_optionalAttribute.name);
f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
......@@ -8482,15 +8486,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -8510,7 +8514,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_UPD_001
......@@ -8762,15 +8766,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -8788,7 +8792,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_UPD_002
......@@ -9086,15 +9090,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request, p_nullFields));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -9111,7 +9115,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_UPD_003
......@@ -9497,15 +9501,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request, p_nullFields));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -9522,7 +9526,7 @@ module OneM2M_Testcases {
// Tear down
f_cf01Down();
return v_response.primitive.responsePrimitive;
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_UPD_004
......@@ -11418,11 +11422,11 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
}
......@@ -12673,15 +12677,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request)); //CSEBase
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Error while updating optional attribute");
}
......@@ -13292,15 +13296,15 @@ module OneM2M_Testcases {
mcaPort.send(m_request(v_request)); //CSEBase
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Error while updating mandatory attribute");
}
......@@ -14310,6 +14314,7 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource locationPolicy is created successfully with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!");
f_checkAttributesToBeSaved(int10, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int10, v_aeAuxIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......@@ -14633,6 +14638,7 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource locationPolicy is created successfully with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!");
f_checkAttributesToBeSaved(int10, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int10, v_aeAuxIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......@@ -14697,6 +14703,7 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource locationPolicy is created successfully with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!");
f_checkAttributesToBeSaved(int10, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int10, v_aeAuxIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......@@ -19016,6 +19023,7 @@ module OneM2M_Testcases {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully");
f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, v_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......
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