diff --git a/OneM2M_Testcases_GMG.ttcn b/OneM2M_Testcases_GMG.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..9191acaec387074c6e97da0eefdff73331390c80 --- /dev/null +++ b/OneM2M_Testcases_GMG.ttcn @@ -0,0 +1,955 @@ +/** + * Copyright Notification + * No part of this document may be reproduced, in an electronic retrieval system or otherwise, except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * © 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC). + * All rights reserved. + * + * @author ETSI + * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases_GMG.ttcn $ + * $Id: OneM2M_Testcases_GMG.ttcn 99 2016-07-07 10:29:00Z steffenluedtke $ + * @desc Module containing test cases for oneM2M Group Management (GMG) + * + */ + + +module OneM2M_Testcases_GMG { + + import from OneM2M_TestSystem all; + import from OneM2M_Templates {all;} + import from OneM2M_Types language "TTCN-3:2015" { + type + Group_optional, + MemberType, + RequestPrimitive, + ResourceType, + ResponsePrimitive, + ResponseStatusCode; + }//{type XSD.ID}; + import from OneM2M_TypesAndValues all; + import from OneM2M_Pixits all; + import from OneM2M_Functions all; + import from LibCommon_Time {modulepar all;} + import from XSD language "TTCN-3:2015" {type AnyURI, ID, String;} + + + + group CSE { + + + group Group_Managment_GMG { + + + // Test objective: + // Check that the IUT rejects the creation of the group resource when member ID exceed max number + // of members. + group g_CSE_GMG_BV_001 { + + testcase TC_CSE_GMG_BV_001_1() runs on M2M system M2MSystem { + + // Local variables + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var ResponsePrimitive v_responsePrimitive; + + v_createRequest.primitiveContent.any_1[0].Group_optional.currentNrOfMembers := 6; + v_createRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := 5; + + f_CSE_GMG_BV_001(int9, v_createRequest); // Group + + } + + + function f_CSE_GMG_BV_001(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on M2M { + + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + + // Test Body + v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, v_aeIndex); + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int6010)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Creation failed because member ID exceed max number of member"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + } + + } // end group g_CSE_GMG_BV_001 + + + + + // Test objective: + // Check that the IUT rejects the creation of the group resource when the memberType cannot + // be retrieved due to lack of privilege. + group g_CSE_GMG_BV_002 { + + testcase TC_CSE_GMG_BV_002() runs on M2M system M2MSystem + { + + } + + } // end group g_CSE_GMG_BV_002 + + + + // Test objective: + // Check that the IUT rejects the update of the group resource when the + // memberType cannot be retrieved due to lack of privilege. + group g_CSE_GMG_BV_003 { + + testcase TC_CSE_GMG_BV_003() runs on M2M system M2MSystem + { + + } + + } // end group g_CSE_GMG_BV_003 + + // Test objective: + // Check that the IUT rejects the update of the group + // resource when member ID exceed max number of members. + group g_CSE_GMG_BV_004 { + + testcase TC_CSE_GMG_BV_004() runs on M2M system M2MSystem + { + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + + + v_updateRequest.primitiveContent.any_1[0].Group_optional.currentNrOfMembers := 6; + v_updateRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := 5; + + f_CSE_GMG_BV_004(int9, v_createRequest, v_updateRequest); + + + } + + function f_CSE_GMG_BV_004(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on M2M { + + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_resourceIndex := f_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + // Test Body + v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int4005)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Update failed because member ID exceed max number of member"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + } + + } // end group g_CSE_GMG_BV_004 + + // Test objective: + // Check that the IUT accepts the creation of the RESOURCE_TYPE resource by using + // fanOutPoint in group resource. + group g_CSE_GMG_BV_005 { + + testcase TC_CSE_GMG_BV_005() runs on M2M system M2MSystem + { + + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; + var ResourceType c_RessourceType1 := int1; + + // Local variables + var ResponsePrimitive.primitiveContent v_responsePrimitive; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + + + v_createRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; + v_createRequest.primitiveContent.any_1[0].Group_optional.resourceType := c_RessourceType1; + + v_responsePrimitive := f_CSE_GMG_BV_005(int9, v_createRequest); + + // TODO: check for aggregatedResponse representation + + } + + function f_CSE_GMG_BV_005(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on M2M return ResponsePrimitive.primitiveContent { + + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + + v_resourceIndex := f_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + // Test Body + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2001)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": creation successfull by using fanOutPoint in group resource"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + + } // end group g_CSE_GMG_BV_005 + + // Test objective: + // Check that the IUT returns successfully the resource of the group members by using + // fanOutPoint in group resource. + group g_CSE_GMG_BV_006 { + + testcase TC_CSE_GMG_BV_006() runs on M2M system M2MSystem + { + + + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; + var ResourceType c_RessourceType1 := int1; + + // Local variables + var XSD.ID v_resourceId := "NonExisting"; + var ResponsePrimitive.primitiveContent v_responsePrimitive; + var RequestPrimitive v_request; + + v_request := m_retrieveResource(f_getResourceAddress(-2) & "/" & v_resourceId); + v_request.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; + + + v_responsePrimitive := f_CSE_GMG_BV_006(int9, v_request); + + + // TODO: check for aggregatedResponse representation + + + + } + + + function f_CSE_GMG_BV_006(ResourceType p_resourceType, template RequestPrimitive p_retriveRequest) runs on M2M return ResponsePrimitive.primitiveContent { + + var M2MResponsePrimitive v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + + v_resourceIndex := f_createResource(p_resourceType, p_retriveRequest, v_aeIndex); + + // Test Body + + mcaPort.send(m_request(valueof(p_retriveRequest))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2000)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": retrieve attributes successfull by using fanOutPoint in group resource"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + + } // end group g_CSE_GMG_BV_006 + + // Test objective: + // Check that the IUT accepts the update of the RESOURCE_TYPE resource by using + // fanOutPoint in group resource. + group g_CSE_GMG_BV_007 { + + testcase TC_CSE_GMG_BV_007() runs on M2M system M2MSystem + { + + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; + + // Local variables + + var ResponsePrimitive.primitiveContent v_responsePrimitive; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + + var Group_optional v_group_optional; + v_updateRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; + + v_responsePrimitive := f_CSE_GMG_BV_007(int9, v_createRequest, v_updateRequest); + + // TODO: check for aggregatedResponse representation + + + } + + function f_CSE_GMG_BV_007(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on M2M return ResponsePrimitive.primitiveContent { + + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_resourceIndex := f_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + // Test Body + v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2004)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": update successfull by using fanOutPoint in group resource"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + + } + + } // end group g_CSE_GMG_BV_007 + + // Test objective: + // Check that the IUT could delete the RESOURCE_TYPE resource by using + // fanOutPoint in group resource. + group g_CSE_GMG_BV_008_1 { + + testcase TC_CSE_GMG_BV_008_1() runs on M2M system M2MSystem + { + // TODO: use right values for c_fanoutPointAddress and c_deleteAddress + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; + var XSD.ID c_deleteAddress := "DELETE"; + + //Local variables + var ResponsePrimitive.primitiveContent v_responsePrimitive; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_deleteRequest := m_deleteRequest(c_deleteAddress); + + + v_deleteRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; + + v_responsePrimitive := f_CSE_GMG_BV_008_1(int9, v_createRequest, v_deleteRequest); + + // TODO: check for aggregatedResponse representation + + + + } + + function f_CSE_GMG_BV_008_1(ResourceType p_resourceType, template RequestPrimitive p_createRequest, template RequestPrimitive p_deleteRequest) runs on M2M return ResponsePrimitive.primitiveContent { + + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_resourceIndex := f_createResource(p_resourceType, p_createRequest, v_aeIndex); + + // Test Body + v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_deleteRequest); + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2002)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": delete successfull by using fanOutPoint in group resource"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + + } + + } // end group g_CSE_GMG_BV_008_1 + + // Test objective: + // Check that the IUT detects the presence of duplicate member IDs during the creation of the + // group resource and removes the duplicate member IDs prior to creation of the group resource. + group g_CSE_GMG_BV_008_2 { + + testcase TC_CSE_GMG_BV_008_2() runs on M2M system M2MSystem + { + + // TODO: use right values for c_memberRessourceAddress + var XSD.AnyURI c_memberRessourceAddress := "MEMBER_RESSOURCE_ADDRESS"; + + // Local variables + + var ResponsePrimitive.primitiveContent v_responsePrimitive; + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + + + v_responsePrimitive := f_CSE_GMG_BV_008_2(int9, v_createRequest, c_memberRessourceAddress); + + if(getverdict == pass){ + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberIDs)){ + setverdict(fail, testcasename(), ": Error, memberID attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberIDs[0] != c_memberRessourceAddress){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not correct"); + } + } + } + + } + + + function f_CSE_GMG_BV_008_2(ResourceType p_resourceType, template RequestPrimitive p_createRequest, XSD.AnyURI p_memberRessourceAddress) runs on M2M return ResponsePrimitive.primitiveContent { + + var M2MResponsePrimitive v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_preamble_registerAe();//c_CRUDNDi); + + + + p_createRequest.from_ := f_getOriginator(v_aeIndex); + p_createRequest.to_ := f_addPrefix(f_getResourceAddress(v_aeIndex)); + + + p_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup (1, {p_memberRessourceAddress, p_memberRessourceAddress}, omit); + + + + mcaPort.send(m_request(valueof(p_createRequest))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2001)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + + } // end group g_CSE_GMG_BV_008_2 + + // Test objective: + // Check that the IUT validates the resource type during the creation of the + // group resource when memberType attribute is not ‘mixed’. + group g_CSE_GMG_BV_009 { + + testcase TC_CSE_GMG_BV_009() runs on M2M system M2MSystem + { + + + // TODO: use right values for c_RessourceType1 + var ResourceType c_RessourceType1 := int1; + + var ResponsePrimitive.primitiveContent v_responsePrimitive; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + + v_responsePrimitive := f_CSE_GMG_BV_009(int9, v_createRequest, c_RessourceType1); + + if(getverdict == pass){ + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated)){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated == false){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); + } + } + } + } + + + function f_CSE_GMG_BV_009(ResourceType p_resourceType, template RequestPrimitive p_createRequest, ResourceType p_resourceType_test) runs on M2M return ResponsePrimitive.primitiveContent { + + // Local variables + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_preamble_registerAe(); //c_CRUDNDi + + + + v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_createRequest, v_aeIndex); + + v_request.primitiveContent.any_1[0].Group_optional.resourceType := p_resourceType_test; + + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2001)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + } // end group g_CSE_GMG_BV_009 + + + // Test objective: + // Check that the IUT handles unsuccessful validation of the resource type during the creation of the + // group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is SET_MIXED. + group g_CSE_GMG_BV_010 { + + testcase TC_CSE_GMG_BV_010() runs on M2M system M2MSystem + { + + // TODO: use right values for c_RessourceType1 and c_RessourceType2 + var MemberType c_RessourceType1 := int1; + var MemberType c_RessourceType2 := int2; + + // Local variables + var ResponsePrimitive.primitiveContent v_responsePrimitive; + var template RequestPrimitive v_createRequest := m_createGroupBase; + + v_responsePrimitive := f_CSE_GMG_BV_010(int9, v_createRequest, c_RessourceType2); + + if(getverdict == pass){ + // check for memberTypeValidated + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated)){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated == false){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); + } + } + // check for memberType (MIXED) + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberType)){ + setverdict(fail, testcasename(), ": Error, memberType attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberType != int3){ + setverdict(fail, testcasename(), ": Error, memberType attribute not correct"); + } + } + } + + } + + + function f_CSE_GMG_BV_010(ResourceType p_resourceType, template RequestPrimitive p_createRequest, MemberType p_resourceType_test) runs on M2M return ResponsePrimitive.primitiveContent { + var M2MResponsePrimitive v_response; + + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var RequestPrimitive v_request; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_preamble_registerAe();//c_CRUDNDi); + + + + v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_createRequest, v_aeIndex); + + v_request.primitiveContent.any_1[0].Group_optional.memberType := p_resourceType_test; + v_request.primitiveContent.any_1[0].Group_optional.consistencyStrategy := int3; // MIXED + + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2001)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + } // end group g_CSE_GMG_BV_010 + + // Test objective: + // Check that the IUT handles unsuccessful validation of the resource type during the creation of the + // group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is + // ABANDON_MEMBER,. + group g_CSE_GMG_BV_011 { + + testcase TC_CSE_GMG_BV_011() runs on M2M system M2MSystem + { + + + // TODO: use right values for c_RessourceType1 and c_RessourceType2 and c_memberRessourceAddress1 and c_memberRessourceAddress2 + var MemberType c_RessourceType1 := int1; + var MemberType c_RessourceType2 := int2; + var XSD.AnyURI c_memberRessourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + var XSD.AnyURI c_memberRessourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var ResponsePrimitive.primitiveContent v_responsePrimitive; + + + v_responsePrimitive := f_CSE_GMG_BV_011(int9, v_createRequest, c_RessourceType1, c_memberRessourceAddress1, c_memberRessourceAddress2); + + if(getverdict == pass){ + // check for memberTypeValidated + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated)){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated == false){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); + } + } + // check for membersId + if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberIDs)){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not provided"); + } else { + if(v_responsePrimitive.any_1[0].Group_optional.memberIDs[0] != c_memberRessourceAddress1){ + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); + } + } + } + } + + function f_CSE_GMG_BV_011(ResourceType p_resourceType, + template RequestPrimitive p_createRequest, + MemberType p_resourceType_test, + XSD.AnyURI p_memberRessourceAddress1, + XSD.AnyURI p_memberRessourceAddress2) runs on M2M return ResponsePrimitive.primitiveContent { + + // Local variables + var M2MResponsePrimitive v_response; + + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_preamble_registerAe(); //c_CRUDNDi); + + + + p_createRequest.from_ := f_getOriginator(v_aeIndex); + p_createRequest.to_ := f_addPrefix(f_getResourceAddress(v_aeIndex)); + + + p_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup (1, {p_memberRessourceAddress1, p_memberRessourceAddress2}, omit); + + + p_createRequest.primitiveContent.any_1[0].Group_optional.memberType := p_resourceType_test; + p_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := int1; // ABANDON_MEMBER + + + + mcaPort.send(m_request(valueof(p_createRequest))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int2001)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_postamble_deleteResources(); + + return v_response.responsePrimitive_.primitiveContent; + } + + } // end group g_CSE_GMG_BV_011 + + // Test objective: + // Check that the IUT handles unsuccessful validation of the resource type during the creation of the + // group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is + // ABANDON_GROUP. + group g_CSE_GMG_BV_012 { + + testcase TC_CSE_GMG_BV_012() runs on M2M system M2MSystem + { + + + // TODO: use right values for c_RessourceType1 and c_RessourceType2 and c_memberRessourceAddress1 and c_memberRessourceAddress2 + var MemberType c_RessourceType1 := int1; + var MemberType c_RessourceType2 := int2; + var XSD.AnyURI c_memberRessourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + var XSD.AnyURI c_memberRessourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + + var template RequestPrimitive v_createRequest := m_createGroupBase; + + + f_CSE_GMG_BV_012(int9, v_createRequest, c_RessourceType1, c_memberRessourceAddress1, c_memberRessourceAddress2); + + } + + function f_CSE_GMG_BV_012(ResourceType p_resourceType, + template RequestPrimitive p_createRequest, + MemberType p_resourceType_test, + XSD.AnyURI p_memberRessourceAddress1, + XSD.AnyURI p_memberRessourceAddress2) runs on M2M { + + // Local variables + var M2MResponsePrimitive v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_preamble_registerAe(); //c_CRUDNDi); + + p_createRequest.from_ := f_getOriginator(v_aeIndex); + p_createRequest.to_ := f_addPrefix(f_getResourceAddress(v_aeIndex)); + + + p_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup (1, {p_memberRessourceAddress1, p_memberRessourceAddress2}, omit); + + p_createRequest.primitiveContent.any_1[0].Group_optional.memberType := p_resourceType_test; + p_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := int2; // ABANDON_GROUP + + + + mcaPort.send(m_request(valueof(p_createRequest))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int6011)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": unsuccessful validation of the resource type during the creation of the group"); + } + [] mcaPort.receive(mw_responseKO) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_postamble_deleteResources(); + } + + + } // end group g_CSE_GMG_BV_012 + + } // end group Group_Managment_GMG + + }//end group CSE + +} + + +