From 2a9470c3f1e65b7d43df586a1485dc84d90de046 Mon Sep 17 00:00:00 2001
From: reinaortega <miguelangel.reinaortega@etsi.org>
Date: Wed, 6 May 2020 12:14:09 +0200
Subject: [PATCH] Implemented new test cases TC_CSE_SUB_NTF_010 and
 TC_CSE_SUB_NTF_011 according to TDE-2020-0047

Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org>
---
 OneM2M_Testcases_CSE_Release_3.ttcn | 160 ++++++++++++++++++++++++++++
 1 file changed, 160 insertions(+)

diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn
index dd22f78..6da1745 100644
--- a/OneM2M_Testcases_CSE_Release_3.ttcn
+++ b/OneM2M_Testcases_CSE_Release_3.ttcn
@@ -7610,7 +7610,167 @@ module OneM2M_Testcases_CSE_Release_3 {
 			
 			group Notify{
 				
+				/**
+				 * @desc Check that the IUT doesn’t send a Notify request to the subscriber resource when “childResourceType” condition tag of eventNotificationCriteria attribute is set to LIST_OF_RESOURCE_TYPE and this list doesn’t contain the RESOURCE_TYPE created in the request. 
+				 * 
+				 */
+				testcase TC_CSE_SUB_NTF_010() runs on Tester system CseSystem {
+					
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+								
+					v_ae1.start(f_CSE_SUB_NTF_010());
+					  	  	
+					v_ae1.done;
+					  	  		
+				}
+							
+				function f_CSE_SUB_NTF_010() runs on AeSimu system CseSystem {
+					
+					// Local variables
+					var MsgIn v_response;
+					var integer v_aeIndex := -1;
+					var integer v_resourceIndex := -1;
+					var template RequestPrimitive v_createRequest := omit; 
+					var RequestPrimitive v_request;
+					var integer v_ae2Index := -1;
+			
+					// Test control
+
+					// Test component configuration
+					f_cf01Up(true);
+
+					// Test adapter configuration
+
+					// Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
+					
+					v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria({int3}), -, omit, omit, omit, -, omit); 
+					
+					v_createRequest.primitiveContent.subscription.eventNotificationCriteria.childResourceType := {int15};
+					
+					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription 				
+					
+					if(vc_ae2.running) {
+						vc_ae2.stop;
+					};
+	
+					// Test Body
+					v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
+					
+					vc_ae2.start(f_cse_notifyProcedure_noNotificationHandler()); // check if no notification is received
+					
+					f_send(e_mcaPort, m_request(v_request));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Resource type int3 (Container) created successfully");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating resource type int3 (Container)");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating resource type int3 (Container)");
+						}
+					}
+    				
+					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+										
+					//Postamble
+					f_cse_postamble_deleteResources();
 
+					//Tear down
+					f_cf01Down();
+				} // end TC_CSE_SUB_NTF_010
+
+				/**
+				 * @desc Check that the IUT sends a Notify request to the subscriber resource when “childResourceType” condition tag of eventNotificationCriteria attribute is set to LIST_OF_RESOURCE_TYPE and this list contains the RESOURCE_TYPE created in the request. 
+				 * 
+				 */
+				testcase TC_CSE_SUB_NTF_011() runs on Tester system CseSystem {
+					
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+								
+					v_ae1.start(f_CSE_SUB_NTF_011());
+					  	  	
+					v_ae1.done;
+					  	  		
+				}
+							
+				function f_CSE_SUB_NTF_011() runs on AeSimu system CseSystem {
+					
+					// Local variables
+					var MsgIn v_response;
+					var integer v_aeIndex := -1;
+					var integer v_resourceIndex := -1;
+					var template RequestPrimitive v_createRequest := omit; 
+					var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_rc1};// all attributes expected   
+					var RequestPrimitive v_request;
+					var integer v_ae2Index := -1;
+			
+					// Test control
+
+					// Test component configuration
+					f_cf01Up(true);
+
+					// Test adapter configuration
+
+					// Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
+					
+					v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria({int3}), -, omit, omit, omit, -, omit); 
+					
+					v_createRequest.primitiveContent.subscription.eventNotificationCriteria.childResourceType := {int3};
+					
+					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription 				
+					
+					if(vc_ae2.running) {
+						vc_ae2.stop;
+					};
+	
+					// Test Body
+					v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
+					
+					vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
+					
+					f_send(e_mcaPort, m_request(v_request));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Resource type int3 (Container) created successfully");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating resource type int3 (Container)");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating resource type int3 (Container)");
+						}
+					}
+    				
+					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+										
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // end TC_CSE_SUB_NTF_011
+				
 			}//end group Notify
 			
 			group Update {
-- 
GitLab