From 0e269726a1639d1c545f33b6ac67fd21637a43fb Mon Sep 17 00:00:00 2001 From: acverdugo <acverdugo@at4wireless.com> Date: Tue, 6 Feb 2018 14:53:00 +0100 Subject: [PATCH] Fix #13 and #14 --- OneM2M_Testcases_CSE_Release_1.ttcn | 104 ++++++++++++++++------------ 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index 8c84d22..550dcba 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -3356,12 +3356,14 @@ module OneM2M_Testcases_CSE_Release_1 { */ testcase TC_CSE_DMR_CRE_007() runs on AeSimu system CseSystem { // Local variables - var template RequestPrimitive v_createRequest := m_createContainerBase; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase; var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_containerIndex := -1; - const integer c_maxNumberOfInstances := 0; + var integer v_contentInstanceIndex := -1; + const integer c_maxNumberOfInstances := 1; // Test control // Test component configuration @@ -3372,41 +3374,45 @@ module OneM2M_Testcases_CSE_Release_1 { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest.primitiveContent.container.maxNrOfInstances := c_maxNumberOfInstances; + v_createRequestContainer.primitiveContent.container.maxNrOfInstances := c_maxNumberOfInstances; - v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex); + v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex); //Container + + v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); //ContentInstance // Test Body - v_request := f_getCreateRequestPrimitive(int4, m_createContentInstance(f_getResourceAddress(v_containerIndex), "MyValue"), v_containerIndex); + + v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2"; //ContentInstance 2 + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Maximun number of instances exceeded"); + setverdict(pass, __SCOPE__ & ": ContentInstance created"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response"); + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance exceding maximum number of instances"); + setverdict(fail, __SCOPE__ & ": Error while creating resource type contentInstance"); } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4"); + setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance"); } } f_checkAeSimuStatus(); //Check to see if the resource is NOT present - if(f_isResourceNotPresent(v_containerIndex, f_getResourceName(v_request.primitiveContent))){ - setverdict(pass, __SCOPE__ & ":INFO: Resource not created"); + if(f_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){ + setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance"); } else { - setverdict(fail, __SCOPE__ & ":ERROR: Resource created"); + setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance"); } // Postamble @@ -3426,64 +3432,72 @@ module OneM2M_Testcases_CSE_Release_1 { * */ testcase TC_CSE_DMR_CRE_008() runs on AeSimu system CseSystem { - // Local variables - var template RequestPrimitive v_createRequest := m_createContainerBase; + //Local variables + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase; var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_containerIndex := -1; - const integer c_maxByteSize := 0; + var integer v_contentInstanceIndex := -1; + const integer c_maxByteSize := 10; + const XSD.String c_primitiveContent1 := "Content1"; + const XSD.String c_primitiveContent2 := "Content2"; // Test control - + // Test component configuration f_cf01Up(); - + // Test adapter configuration - + // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - - v_createRequest.primitiveContent.container.maxByteSize := c_maxByteSize; - - v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex); - + + v_createRequestContainer.primitiveContent.container.maxByteSize := c_maxByteSize; + + v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex); //Container + + v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstance(f_getResourceAddress(v_containerIndex), c_primitiveContent1), v_containerIndex);//ContentInstance + // Test Body - v_request := f_getCreateRequestPrimitive(int4, m_createContentInstanceBase, v_containerIndex); - + + v_createRequestContentInstance.primitiveContent.contentInstance.content := c_primitiveContent2; //ContentInstance 2 + v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2"; + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Maximun byte size exceeded"); + setverdict(pass, __SCOPE__ & ": ContentInstance created"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response"); + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); } - - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance exceding maximum byte size"); - + setverdict(fail, __SCOPE__ & ": Error while creating resource type contentInstance"); + } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4"); + setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance"); } } - + f_checkAeSimuStatus(); - - //Check to see if the resource is present or not - if(f_isResourceNotPresent(v_containerIndex, f_getResourceName(v_request.primitiveContent))){ - setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + + //Check to see if the resource is NOT present + if(f_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){ + setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance"); } else { - setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance"); } - + // Postamble f_cse_postamble_deleteResources(); - + // Tear down f_cf01Down(); -- GitLab