Skip to content
Snippets Groups Projects
Commit cf117723 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Fix for schedule test cases

parent 40084764
No related branches found
No related tags found
No related merge requests found
...@@ -572,7 +572,7 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -572,7 +572,7 @@ module OneM2M_Testcases_CSE_Release_4 {
function f_CSE_SCH_001() runs on AeSimu system CseSystem { function f_CSE_SCH_001() runs on AeSimu system CseSystem {
// Local variables // Local variables
var integer v_aeIndex, v_resourceIndex := -1; var integer v_aeIndex, v_resourceIndex := -1;
var template RequestPrimitive v_createRequestSchedule := m_createScheduleBase; var template RequestPrimitive v_createRequestSchedule := m_createScheduleBase_subscription;
var RequestPrimitive v_request; var RequestPrimitive v_request;
// Test component configuration // Test component configuration
...@@ -645,11 +645,11 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -645,11 +645,11 @@ module OneM2M_Testcases_CSE_Release_4 {
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
v_resourceIndex := f_cse_createResource(int23, m_createSubscriptionBase, v_aeIndex);//Subscription v_resourceIndex := f_cse_createResource(int23, m_createSubscriptionBase, v_aeIndex);//Subscription
   
v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_updateScheduleBase, v_resourceIndex); v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_createScheduleBase_subscription, v_resourceIndex);
   
v_contentUpdateSchedule.primitiveContent.schedule.networkCoordinated := true; v_contentUpdateSchedule.primitiveContent.schedule.networkCoordinated := true;
// Test Body // Test Body
v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_resourceIndex, v_contentUpdateSchedule); v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_childscheduleResourceIndex, v_contentUpdateSchedule);
f_send(e_mcaPort, m_request(valueof(v_request))); f_send(e_mcaPort, m_request(valueof(v_request)));
tc_ac.start; tc_ac.start;
alt { alt {
...@@ -696,18 +696,21 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -696,18 +696,21 @@ module OneM2M_Testcases_CSE_Release_4 {
timer t_batchNotificationTimer := PX_TAC * 2.0; //just gives enough time to execute timer t_batchNotificationTimer := PX_TAC * 2.0; //just gives enough time to execute
const ResourceType c_containerResourceType := int3; const ResourceType c_containerResourceType := int3;
var float v_elapsedTime; var float v_elapsedTime;
var integer v_ae1Index, v_ae2Index, v_containerResourceIndex, v_childScheduleIndex := -1; var integer v_ae1Index, v_ae2LocalIndex, v_ae2Index, v_containerResourceIndex, v_subscriptionResourceIndex, v_childScheduleIndex := -1;
var template RequestPrimitive v_updateRequestPrimitive := m_updateContainerBase; var template RequestPrimitive v_updateRequest := m_updateContainerBase;
var template RequestPrimitive v_updateRequest; var template RequestPrimitive v_createRequest := m_createScheduleBase_subscription;
var template RequestPrimitive v_createRequestSubscription; var ResponsePrimitive v_responsePrimitive;
var template RequestPrimitive v_createRequest := m_createScheduleBase; var integer v_actualYear;
var XSD.ID v_containerResourceAddress;
var template PrimitiveContent v_contentResponse := {container := mw_contentContainerBase};// all attributes expected
v_contentResponse.container.labels := ?;
// Test control // Test control
if(PX_TAC < 10.0) { if(PX_TAC < 10.0) {
setverdict(inconc, __SCOPE__ & ": PX_TAC is required to be bigger than 10 seconds to run this test case"); setverdict(inconc, __SCOPE__ & ": PX_TAC is required to be bigger than 10 seconds to run this test case");
stop; stop;
} }
// Test component configuration // Test component configuration
f_cf01Up(true); f_cf01Up(true);
   
...@@ -716,39 +719,123 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -716,39 +719,123 @@ module OneM2M_Testcases_CSE_Release_4 {
// Preamble // Preamble
f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63); f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63);
v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(vc_aeSimuDesc.appId, -, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}), -1); v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(vc_aeSimuDesc.appId, -, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}), -1); // now AE1 is registered
// AE1 is registered
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registered
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE2.mcaPortIn, "")}), -1));
// AE2 is registered f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2LocalIndex := f_getResourceFromAeSimu(vc_ae2);
v_ae2Index := f_getLatestResourceIndex(vc_ae2);
vc_ae2.start(f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae2Index));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
v_containerResourceIndex := f_getLatestResourceIndex(vc_ae2);
v_containerResourceAddress := f_getLatestResourceAddress(vc_ae2);
v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index); vc_ae2.start(f_cse_createResource(int23, m_createSubscription(v_containerResourceAddress, -, {f_getResourceAddress(v_ae1Index)}), v_containerResourceIndex));
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotificationVerification))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mcaPortIn, m_response(v_responsePrimitive));
}
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
setverdict(inconc, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");
v_responsePrimitive := valueof(m_responseNotification(int4000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mcaPortIn, m_response(v_responsePrimitive));
}
[] tc_ac.timeout {
if (not(vc_ae2.running)){
setverdict(pass, __SCOPE__ & ":INFO: No subscription verification received but subscription resource was created");
}
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_subscriptionResourceIndex := f_getLatestResourceIndex(vc_ae2);
v_actualYear := f_getYear(fx_generateTimestamp());
v_createRequest.primitiveContent.schedule.scheduleElement := {{"* * * * * * " & int2str(v_actualYear)}};//scheduled for this year
vc_ae2.start(f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
// Test Body
v_updateRequest.primitiveContent.container.labels := {"LABEL_1"};
vc_ae2.start(f_cse_updateResource(int3, v_containerResourceIndex, v_updateRequest)); // Update request 1
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentResponse)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
}
else{
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
//Send response in any case
v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mcaPortIn, m_response(v_responsePrimitive));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No notification received");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
/*
// Test component configuration
f_cf01Up();
// Test adapter configuration
   
v_createRequestSubscription := m_createSubscription(f_getResourceAddress(v_ae2Index), omit, {f_getResourceAddress(v_ae1Index)}); // Preamble
v_aeIndex := f_cse_preamble_registerAe(-, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")});
// AE1 is registered
   
vc_ae2.start(f_cse_createResource(int23, v_createRequestSubscription, v_containerResourceIndex));//Subscription v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index);
   
v_createRequest.primitiveContent.schedule.scheduleElement := {{"*/5 0 0 * * * *"}};//scheduled every 5 seconds v_subscriptionResourceIndex := f_cse_createResource(int23, m_createSubscriptionBase(), v_containerResourceIndex);//Subscription
v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_containerResourceIndex); //schedule resource child
   
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequestPrimitive); v_createRequest.primitiveContent.schedule.scheduleElement := {{"*//*5 0 0 * * * *"}};//scheduled every 5 seconds
v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex); //schedule resource child
   
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest);
v_updateRequest.primitiveContent.container.labels := {"LABEL_1"};
// Test Body // Test Body
t_batchNotificationTimer.start;
f_send(e_mcaPort, m_request(valueof(v_updateRequest))); f_send(e_mcaPort, m_request(valueof(v_updateRequest)));
tc_ac.start; tc_ac.start;
alt { alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop; tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly"); setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly");
v_elapsedTime := t_batchNotificationTimer.read; if (v_firstNotification) {
t_batchNotificationTimer.stop;
if(float2int(v_elapsedTime) mod 5 != 0) { }
setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached");
}
} }
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop; tc_ac.stop;
...@@ -758,6 +845,38 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -758,6 +845,38 @@ module OneM2M_Testcases_CSE_Release_4 {
tc_ac.stop; tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating scheduling resource "); setverdict(fail, __SCOPE__ & ": Error while updating scheduling resource ");
} }
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentNotification)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
}
else{
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
//Send response in any case
v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mcaPortIn, m_response(v_responsePrimitive));
if (v_firstNotification){
t_batchNotificationTimer.start;
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest);
v_updateRequest.primitiveContent.container.labels := {"LABEL_2"};
f_send(e_mcaPort, m_request(valueof(v_updateRequest)));
repeat;
} else {
v_elapsedTime := t_batchNotificationTimer.read;
t_batchNotificationTimer.stop;
if(v_elapsedTime < 5.0) {
setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached");
} else {
setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time");
}
}
}
[] mcaPortIn.receive(mw_request(mw_notifyNotification(?))) -> value vc_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
[] tc_ac.timeout { [] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while updating scheduling resource "); setverdict(fail, __SCOPE__ & ": No answer while updating scheduling resource ");
} }
...@@ -769,7 +888,7 @@ module OneM2M_Testcases_CSE_Release_4 { ...@@ -769,7 +888,7 @@ module OneM2M_Testcases_CSE_Release_4 {
f_cse_postamble_deleteResources(); f_cse_postamble_deleteResources();
   
// Tear down // Tear down
f_cf01Down(); f_cf01Down();*/
} // f_CSE_SCH_003 } // f_CSE_SCH_003
   
}//end group Schedule_functionality }//end group Schedule_functionality
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment