From a02a4d46de27560f7d396db83bf7e1c3ef072d45 Mon Sep 17 00:00:00 2001 From: Martin <martin.miao@keti.re.kr> Date: Tue, 14 Mar 2017 02:24:59 -0700 Subject: [PATCH] correct compiling errors generated by Eclipse Titan v6.1.0 --- LibOneM2M/OneM2M_Functions.ttcn | 52 ++++++++++++++++++--------------- LibOneM2M/OneM2M_Templates.ttcn | 2 +- OneM2M_Testcases.ttcn | 16 ++++++---- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index ef908a3..185f545 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -868,30 +868,34 @@ module OneM2M_Functions { var integer v_resourceIndex; // AE TODO To review the code (use of indexes, generation of value for certain attributes, etc..) - if(p_resourceType == int2 and ischosen(p_resource.any_1[0].AE_optional)) { - var AE_optional v_ae := p_resource.any_1[0].AE_optional; - var AE_optional v_aeModified; - - v_resourceIndex := lengthof(vc_resourcesList) - 1; - v_ae.resourceType := p_resourceType; - - v_ae.parentID := int2str(p_parentIndex); - v_ae.creationTime := fx_generateTimestamp(); - v_ae.lastModifiedTime := v_ae.creationTime; - v_ae.resourceID := "ae" & int2char(v_resourceIndex); - v_ae.aE_ID := "ae" & int2char(v_resourceIndex); - v_ae.resourceName := "ae" & int2char(v_resourceIndex); - - v_aeModified.parentID := v_ae.parentID; - v_aeModified.creationTime := v_ae.creationTime; - v_aeModified.lastModifiedTime := v_ae.lastModifiedTime; - v_aeModified.resourceID := v_ae.resourceID; - v_aeModified.aE_ID := v_ae.aE_ID; - v_aeModified.resourceName := v_ae.resourceName; - - p_resource.any_1[0].AE_optional := v_ae; - p_modifiedResource.AE_optional := v_aeModified; - return f_setResource(p_resource, p_parentIndex); + if(p_resourceType == int2 and ispresent(p_resource)) { + if(ischosen(p_resource.any_1[0].AE_optional)){ + var AE_optional v_ae := p_resource.any_1[0].AE_optional; + var AE_optional v_aeModified; + + v_resourceIndex := lengthof(vc_resourcesList) - 1; + v_ae.resourceType := p_resourceType; + + v_ae.parentID := int2str(p_parentIndex); + v_ae.creationTime := fx_generateTimestamp(); + v_ae.lastModifiedTime := v_ae.creationTime; + v_ae.resourceID := "ae" & int2char(v_resourceIndex); + v_ae.aE_ID := "ae" & int2char(v_resourceIndex); + v_ae.resourceName := "ae" & int2char(v_resourceIndex); + + v_aeModified.parentID := v_ae.parentID; + v_aeModified.creationTime := v_ae.creationTime; + v_aeModified.lastModifiedTime := v_ae.lastModifiedTime; + v_aeModified.resourceID := v_ae.resourceID; + v_aeModified.aE_ID := v_ae.aE_ID; + v_aeModified.resourceName := v_ae.resourceName; + + p_resource.any_1[0].AE_optional := v_ae; + p_modifiedResource.AE_optional := v_aeModified; + return f_setResource(p_resource, p_parentIndex); + + } + } // TODO: implement other resource types diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 1a802fc..8867d91 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -2381,7 +2381,7 @@ module OneM2M_Templates { * @param p_statusCode Status code * @param p_requestId Request ID of the corresponding request */ - template (value) ResponsePrimitive m_responsePrimitive_content(in ResponseStatusCode p_statusCode, in RequestID p_requestId, in PrimitiveContent p_content) modifies m_responsePrimitive := { + template (value) ResponsePrimitive m_responsePrimitive_content(in ResponseStatusCode p_statusCode, in RequestID p_requestId, in template (value) PrimitiveContent p_content) modifies m_responsePrimitive := { primitiveContent := p_content } diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 97e6214..8d00db7 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -1682,7 +1682,9 @@ module OneM2M_Testcases { var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; - + + var AttributeAux v_invalidAttribute; + // Test control // Test component configuration @@ -1695,20 +1697,22 @@ module OneM2M_Testcases { // Test Body v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex); - - mcaPort.send(m_request(v_request, {valueof(p_invalidAttribute)})); + + v_invalidAttribute := valueof(p_invalidAttribute); + + mcaPort.send(m_request(v_request, {v_invalidAttribute})); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(pass, testcasename() & ": Creation rejected for resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute " & p_invalidAttribute.name); + setverdict(pass, testcasename() & ": Creation rejected for resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute " & v_invalidAttribute.name); } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Accepted creation of resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute" & p_invalidAttribute.name); + setverdict(fail, testcasename() & ": Accepted creation of resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute" & v_invalidAttribute.name); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); } } -- GitLab