Commit c787507d authored by Pramod Kulkarni's avatar Pramod Kulkarni
Browse files

Implementing testcase TC_CSE_REG_CRE_029


Signed-off-by: Pramod Kulkarni's avatarpkulkarni <pkulkarni75@gmail.com>
parents 4af555cd 9cf47327
......@@ -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;
......
This diff is collapsed.
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