Commit 86769553 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Testcase for timeSeries TC_CSE_DMR_TS_001 added


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent b17171ae
......@@ -1182,11 +1182,12 @@ module OneM2M_Templates {
primitiveContent := {timeSeries := m_contentCreateTimeSeries ()}
};
template (value) RequestPrimitive m_createTimeSeries(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName) modifies m_create := {
to_ := p_parentResourceAddress,
requestIdentifier := testcasename() & "-m_createTimeSeries",
resourceType := int29,
primitiveContent := {timeSeries := m_contentCreateTimeSeries (p_name)}
template (value) RequestPrimitive m_createTimeSeries(in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName,
in XSD.Boolean p_missingDataDetect := true,
in XSD.NonNegativeInteger p_periodicInterval := 5,
in XSD.NonNegativeInteger p_missingDataMaxNr := 5,
in XSD.NonNegativeInteger p_missingDataDetectTimer := 2000) modifies m_createTimeSeriesBase := {
primitiveContent := {timeSeries := m_contentCreateTimeSeriesAttributes (p_name, p_missingDataDetect, p_periodicInterval, p_missingDataMaxNr, p_missingDataDetectTimer)}
};
/**
......@@ -2434,6 +2435,21 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for CREATE operation for timeSeries resource
* @param p_name Resource name
*/
template (value) TimeSeries_optional m_contentCreateTimeSeriesAttributes (in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName,
in template (omit) XSD.Boolean p_missingDataDetect := omit,
in template (omit) XSD.NonNegativeInteger p_periodicInterval := omit,
in template (omit) XSD.NonNegativeInteger p_missingDataMaxNr := omit,
in template (omit) XSD.NonNegativeInteger p_missingDataDetectTimer := omit) modifies m_contentCreateTimeSeries := {
periodicInterval := p_periodicInterval,//O
missingDataDetect := p_missingDataDetect,//O
missingDataMaxNr := p_missingDataMaxNr,//O
missingDataDetectTimer := p_missingDataDetectTimer//O
}
/**
* @desc Base primitiveContent for invalid CREATE operation for timeSeries resource (using Container_update_invalid)
* @param p_name Resource name
......
......@@ -7201,7 +7201,11 @@ module OneM2M_Testcases_CSE_Release_2 {
group timeSeries {
testcase TC_CSE_DMR_TS_001() runs on Tester system CseSystem {
/**
* @desc Check that the IUT inserts the dataGenerationTime informantion of a missing data point and increases the missingDataCurrentNr attribute when a missing data point is detected
*
*/
testcase TC_CSE_DMR_TS_001() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
......@@ -7230,7 +7234,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_aeIndex := f_cse_preamble_registerAe();
v_resourceIndex := f_cse_createResource(int29, m_createTimeSeriesBase, v_aeIndex);
v_resourceIndex := f_cse_createResource(int29, m_createTimeSeries(-, -, 5, -, 2000), v_aeIndex);
//Create data points and force a missingDataPoint
f_cse_generateMissingDataPoint(v_resourceIndex);
......@@ -7276,6 +7280,144 @@ module OneM2M_Testcases_CSE_Release_2 {
}//end f_CSE_DMR_TS_001
/**
* @desc Check that the IUT removes the oldest element in MissingDataList when MissingDataCurrentNr reaches MissingDataMaxNr to enable insertion of a new missing data point
*
*/
testcase TC_CSE_DMR_TS_002() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_DMR_TS_002());
v_ae1.done;
}
function f_CSE_DMR_TS_002() runs on AeSimu return ResponsePrimitive {
// Local variables
var MsgIn v_response;
var RequestPrimitive v_request := valueof(m_createTimeSeriesBase);
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var Timestamp v_missingDataPointTimestamp;
var XSD.Long v_missingDataPointRel;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();
v_resourceIndex := f_cse_createResource(int29, m_createTimeSeries(-, -, 5, 1, 2000), v_aeIndex);
//Create data points and force a missingDataPoint
f_cse_generateMissingDataPoint(v_resourceIndex);
//Retrieve first missing data point
mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
if(not(ispresent(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList))) {
setverdict(inconc, __SCOPE__ & ": missingDataList attribute not present");
} else {
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_)) {
v_missingDataPointTimestamp := v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_[0];
} else {
v_missingDataPointRel := v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_1[0];
}
}
if(not(ispresent(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataCurrentNr))) {
setverdict(inconc, __SCOPE__ & ": missingDataCurrentNr attribute not present");
} else {
if(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataCurrentNr != 1) {
setverdict(inconc, __SCOPE__ & ": missingDataCurrentNr attribute wrong value");
}
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK())) -> value v_response {
tc_ac.stop;
setverdict(inconc, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(inconc, __SCOPE__ & ": Error while retrieving resource");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__ & ": No answer while retrieving resource");
}
}
f_checkAeSimuStatus();
//Test body
//Create data points and force a second missingDataPoint
f_cse_generateMissingDataPoint(v_resourceIndex);
//Retrieve second missing data point
mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
if(not(ispresent(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList))) {
setverdict(inconc, __SCOPE__ & ": missingDataList attribute not present");
} else {
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_)) {
if(v_missingDataPointTimestamp < v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_[0]) {
setverdict(pass, __SCOPE__ & ": missingData point inserted in missingDataList");
} else {
setverdict(fail, __SCOPE__ & ": missingData point not inserted in missingDataList");
}
} else {
if(v_missingDataPointRel < v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_1[0]) {
setverdict(pass, __SCOPE__ & ": missingData point inserted in missingDataList");
} else {
setverdict(fail, __SCOPE__ & ": missingData point not inserted in missingDataList");
}
}
}
if(not(ispresent(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataCurrentNr))) {
setverdict(fail, __SCOPE__ & ": missingDataCurrentNr attribute not present");
} else {
if(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataCurrentNr != 1) {
setverdict(fail, __SCOPE__ & ": missingDataCurrentNr attribute wrong value");
}
}
}
[] 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 retrieving resource");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
}
}
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
return vc_response.primitive.responsePrimitive;
}//end f_CSE_DMR_TS_002
}//end group timeSeries
}//end group dataManagement
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment