|
@@ -46,16 +46,13 @@ static UA_Server* makeTestSequence(void) {
|
|
UA_Server_addObjectNode(server,UA_QUALIFIEDNAME(1, "Demo"), UA_NODEID_NUMERIC(1, 50), UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
|
|
UA_Server_addObjectNode(server,UA_QUALIFIEDNAME(1, "Demo"), UA_NODEID_NUMERIC(1, 50), UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
|
|
|
|
|
|
/* ReferenceTypeNode */
|
|
/* ReferenceTypeNode */
|
|
- UA_ReferenceTypeNode *hierarchicalreferences = UA_ReferenceTypeNode_new();
|
|
|
|
- copyNames((UA_Node*)hierarchicalreferences, "Hierarchicalreferences");
|
|
|
|
- hierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
|
|
|
|
- hierarchicalreferences->isAbstract = UA_TRUE;
|
|
|
|
- hierarchicalreferences->symmetric = UA_FALSE;
|
|
|
|
- hierarchicalreferences->inverseName = UA_LOCALIZEDTEXT("", "test");
|
|
|
|
-
|
|
|
|
- UA_Server_addNode(server, (UA_Node*)hierarchicalreferences,
|
|
|
|
- UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_REFERENCES),
|
|
|
|
- UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE));
|
|
|
|
|
|
+ UA_ReferenceTypeNode *organizes = UA_ReferenceTypeNode_new();
|
|
|
|
+ copyNames((UA_Node*)organizes, "Organizes");
|
|
|
|
+ organizes->inverseName = UA_LOCALIZEDTEXT_ALLOC("", "OrganizedBy");
|
|
|
|
+ organizes->nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
|
|
|
|
+ organizes->isAbstract = UA_FALSE;
|
|
|
|
+ organizes->symmetric = UA_FALSE;
|
|
|
|
+ UA_Server_addNode(server, (UA_Node*)organizes, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE));
|
|
|
|
|
|
/* ViewNode */
|
|
/* ViewNode */
|
|
UA_ViewNode *viewtest = UA_ViewNode_new();
|
|
UA_ViewNode *viewtest = UA_ViewNode_new();
|
|
@@ -167,7 +164,8 @@ START_TEST(ReadSingleAttributeNodeClassWithoutTimestamp)
|
|
&resp);
|
|
&resp);
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
- //ck_assert_int_eq(&UA_TYPES[UA_TYPES_NODECLASS],resp.value.type);
|
|
|
|
|
|
+ ck_assert_int_eq(&UA_TYPES[UA_TYPES_INT32],resp.value.type);
|
|
|
|
+ ck_assert_int_eq(*(UA_Int32*)resp.value.data,UA_NODECLASS_VARIABLE);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeBrowseNameWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeBrowseNameWithoutTimestamp)
|
|
@@ -283,13 +281,13 @@ START_TEST(ReadSingleAttributeWriteMaskWithoutTimestamp)
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
&resp);
|
|
&resp);
|
|
- //UA_UInt32* respval;
|
|
|
|
- //respval = (UA_UInt32*) resp.value.data;
|
|
|
|
- //UA_VariableNode* compNode = makeCompareSequence();
|
|
|
|
|
|
+
|
|
|
|
+ UA_UInt32* respval;
|
|
|
|
+ respval = (UA_UInt32*) resp.value.data;
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_UINT32], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_UINT32], resp.value.type);
|
|
- //ck_assert_int_eq(*(UA_UInt32* )compNode->writeMask,respval);
|
|
|
|
|
|
+ ck_assert_int_eq(0,*respval);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeUserWriteMaskWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeUserWriteMaskWithoutTimestamp)
|
|
@@ -308,8 +306,12 @@ START_TEST(ReadSingleAttributeUserWriteMaskWithoutTimestamp)
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
&resp);
|
|
&resp);
|
|
|
|
|
|
|
|
+ UA_UInt32* respval;
|
|
|
|
+ respval = (UA_UInt32*) resp.value.data;
|
|
|
|
+
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_UINT32], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_UINT32], resp.value.type);
|
|
|
|
+ ck_assert_int_eq(0,*respval);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeIsAbstractWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeIsAbstractWithoutTimestamp)
|
|
@@ -322,7 +324,7 @@ START_TEST(ReadSingleAttributeIsAbstractWithoutTimestamp)
|
|
UA_ReadRequest_init(&rReq);
|
|
UA_ReadRequest_init(&rReq);
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToReadSize = 1;
|
|
rReq.nodesToReadSize = 1;
|
|
- rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
|
|
|
|
|
|
+ rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_ISABSTRACT;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_ISABSTRACT;
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
@@ -330,7 +332,7 @@ START_TEST(ReadSingleAttributeIsAbstractWithoutTimestamp)
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
- ck_assert(*(UA_Boolean* )resp.value.data==UA_TRUE);
|
|
|
|
|
|
+ ck_assert(*(UA_Boolean* )resp.value.data==UA_FALSE);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeSymmetricWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeSymmetricWithoutTimestamp)
|
|
@@ -343,7 +345,7 @@ START_TEST(ReadSingleAttributeSymmetricWithoutTimestamp)
|
|
UA_ReadRequest_init(&rReq);
|
|
UA_ReadRequest_init(&rReq);
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToReadSize = 1;
|
|
rReq.nodesToReadSize = 1;
|
|
- rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
|
|
|
|
|
|
+ rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_SYMMETRIC;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_SYMMETRIC;
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
@@ -364,19 +366,19 @@ START_TEST(ReadSingleAttributeInverseNameWithoutTimestamp)
|
|
UA_ReadRequest_init(&rReq);
|
|
UA_ReadRequest_init(&rReq);
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToReadSize = 1;
|
|
rReq.nodesToReadSize = 1;
|
|
- rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
|
|
|
|
|
|
+ rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_INVERSENAME;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_INVERSENAME;
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
&resp);
|
|
&resp);
|
|
|
|
|
|
- /*UA_LocalizedText* respval;
|
|
|
|
|
|
+ UA_LocalizedText* respval;
|
|
respval = (UA_LocalizedText*) resp.value.data;
|
|
respval = (UA_LocalizedText*) resp.value.data;
|
|
- const UA_LocalizedText comp = UA_LOCALIZEDTEXT("", "test");
|
|
|
|
-*/
|
|
|
|
|
|
+ const UA_LocalizedText comp = UA_LOCALIZEDTEXT("", "OrganizedBy");
|
|
|
|
+
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_LOCALIZEDTEXT],resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_LOCALIZEDTEXT],resp.value.type);
|
|
- /*ck_assert_int_eq(comp.text.length, respval->text.length);
|
|
|
|
|
|
+ ck_assert_int_eq(comp.text.length, respval->text.length);
|
|
for (int var = 0; var < respval->text.length - 1; ++var) {
|
|
for (int var = 0; var < respval->text.length - 1; ++var) {
|
|
ck_assert_int_eq(comp.text.data[var], respval->text.data[var]);
|
|
ck_assert_int_eq(comp.text.data[var], respval->text.data[var]);
|
|
}
|
|
}
|
|
@@ -384,7 +386,7 @@ START_TEST(ReadSingleAttributeInverseNameWithoutTimestamp)
|
|
for (int var = 0; var < respval->locale.length - 1; ++var) {
|
|
for (int var = 0; var < respval->locale.length - 1; ++var) {
|
|
ck_assert_int_eq(comp.locale.data[var], respval->locale.data[var]);
|
|
ck_assert_int_eq(comp.locale.data[var], respval->locale.data[var]);
|
|
}
|
|
}
|
|
- UA_free(respval);*/
|
|
|
|
|
|
+ UA_free(respval);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeContainsNoLoopsWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeContainsNoLoopsWithoutTimestamp)
|
|
@@ -445,13 +447,13 @@ START_TEST(ReadSingleAttributeDataTypeWithoutTimestamp)
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
&resp);
|
|
&resp);
|
|
|
|
|
|
- //UA_NodeId* respval;
|
|
|
|
- //respval = (UA_NodeId*) resp.value.data;
|
|
|
|
- //const UA_VariableNode compNode = makeCompareSequence();
|
|
|
|
- //const UA_NodeId comp = compNode;
|
|
|
|
|
|
+ UA_NodeId* respval;
|
|
|
|
+ respval = (UA_NodeId*) resp.value.data;
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_NODEID], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_NODEID], resp.value.type);
|
|
|
|
+ ck_assert_int_eq(respval->namespaceIndex,0);
|
|
|
|
+ ck_assert_int_eq(respval->identifier.numeric,UA_NS0ID_INT32);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeValueRankWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeValueRankWithoutTimestamp)
|
|
@@ -494,6 +496,7 @@ START_TEST(ReadSingleAttributeArrayDimensionsWithoutTimestamp)
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_INT32], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_INT32], resp.value.type);
|
|
|
|
+ ck_assert_int_eq((UA_Int32*)resp.value.data,0);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeAccessLevelWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeAccessLevelWithoutTimestamp)
|
|
@@ -556,13 +559,15 @@ START_TEST(ReadSingleAttributeMinimumSamplingIntervalWithoutTimestamp)
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
&resp);
|
|
&resp);
|
|
|
|
|
|
- //UA_Double* respval;
|
|
|
|
- //respval = (UA_Double*) resp.value.data;
|
|
|
|
- //UA_VariableNode* compNode = makeCompareSequence();
|
|
|
|
|
|
+ UA_Double* respval;
|
|
|
|
+ respval = (UA_Double*) resp.value.data;
|
|
|
|
+ UA_VariableNode *compNode = makeCompareSequence();
|
|
|
|
+ UA_Double comp;
|
|
|
|
+ comp = (UA_Double) compNode->minimumSamplingInterval;
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_DOUBLE], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_DOUBLE], resp.value.type);
|
|
- //ck_assert_int_eq(compNode->minimumSamplingInterval,respval);
|
|
|
|
|
|
+ ck_assert(*respval == comp);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeHistorizingWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeHistorizingWithoutTimestamp)
|
|
@@ -596,13 +601,14 @@ START_TEST(ReadSingleAttributeExecutableWithoutTimestamp)
|
|
UA_ReadRequest_init(&rReq);
|
|
UA_ReadRequest_init(&rReq);
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToReadSize = 1;
|
|
rReq.nodesToReadSize = 1;
|
|
- rReq.nodesToRead[0].nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
|
|
+ rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_METHODNODE;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_EXECUTABLE;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_EXECUTABLE;
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0], &resp);
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0], &resp);
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
|
|
+ ck_assert(*(UA_Boolean*)resp.value.data==UA_FALSE);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp)
|
|
START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp)
|
|
@@ -615,7 +621,7 @@ START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp)
|
|
UA_ReadRequest_init(&rReq);
|
|
UA_ReadRequest_init(&rReq);
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToRead = UA_ReadValueId_new();
|
|
rReq.nodesToReadSize = 1;
|
|
rReq.nodesToReadSize = 1;
|
|
- rReq.nodesToRead[0].nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
|
|
+ rReq.nodesToRead[0].nodeId.identifier.numeric = UA_NS0ID_METHODNODE;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
|
|
rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
|
|
|
|
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
@@ -623,6 +629,353 @@ START_TEST(ReadSingleAttributeUserExecutableWithoutTimestamp)
|
|
|
|
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(-1, resp.value.arrayLength);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
ck_assert_int_eq(&UA_TYPES[UA_TYPES_BOOLEAN], resp.value.type);
|
|
|
|
+ ck_assert(*(UA_Boolean*)resp.value.data==UA_FALSE);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* Tests for writeValue method */
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeNodeId)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_NODEID;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeNodeclass)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_NODECLASS;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeBrowseName)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_BROWSENAME;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeDisplayName)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_DISPLAYNAME;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeDescription)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_DESCRIPTION;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeWriteMask)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_WRITEMASK;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeUserWriteMask)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_USERWRITEMASK;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeIsAbstract)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_ISABSTRACT;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeSymmetric)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_SYMMETRIC;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeInverseName)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_INVERSENAME;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeContainsNoLoops)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_CONTAINSNOLOOPS;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeEventNotifier)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_EVENTNOTIFIER;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeValue)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ UA_Variant *myIntegerVariant = UA_Variant_new();
|
|
|
|
+ UA_Int32 myInteger = 20;
|
|
|
|
+ UA_Variant_setScalarCopy(myIntegerVariant, &myInteger,
|
|
|
|
+ &UA_TYPES[UA_TYPES_INT32]);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_VALUE;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ wValue.value.value = *myIntegerVariant;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+
|
|
|
|
+ UA_DataValue resp;
|
|
|
|
+ UA_DataValue_init(&resp);
|
|
|
|
+ UA_ReadRequest rReq;
|
|
|
|
+ UA_ReadRequest_init(&rReq);
|
|
|
|
+ rReq.nodesToRead = UA_ReadValueId_new();
|
|
|
|
+ rReq.nodesToReadSize = 1;
|
|
|
|
+ rReq.nodesToRead[0].nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_VALUE;
|
|
|
|
+
|
|
|
|
+ readValue(server, UA_TIMESTAMPSTORETURN_NEITHER, &rReq.nodesToRead[0],
|
|
|
|
+ &resp);
|
|
|
|
+
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
+ ck_assert(wValue.value.hasValue);
|
|
|
|
+ const UA_Node *node = UA_NodeStore_get(server->nodestore, &wValue.nodeId);
|
|
|
|
+ ck_assert_int_eq(node->nodeClass, UA_NODECLASS_VARIABLE);
|
|
|
|
+ const UA_VariableNode *vn = (const UA_VariableNode*)node;
|
|
|
|
+ const UA_Variant *oldV = &vn->value.variant;
|
|
|
|
+ ck_assert_int_eq(&oldV->type->typeId, &wValue.value.value.type->typeId);
|
|
|
|
+
|
|
|
|
+ ck_assert_int_eq(20, *(UA_Int32* )resp.value.data);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeDataType)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_DATATYPE;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeValueRank)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_VALUERANK;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeArrayDimensions)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_ARRAYDIMENSIONS;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeAccessLevel)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_ACCESSLEVEL;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeUserAccessLevel)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_USERACCESSLEVEL;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeMinimumSamplingInterval)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeHistorizing)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_HISTORIZING;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeExecutable)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_EXECUTABLE;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeUserExecutable)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
|
|
|
|
+ wValue.value.hasValue = UA_TRUE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADWRITENOTSUPPORTED);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(WriteSingleAttributeNoValue)
|
|
|
|
+ {
|
|
|
|
+ UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_WriteValue wValue;
|
|
|
|
+ UA_WriteValue_init(&wValue);
|
|
|
|
+ wValue.nodeId = UA_NODEID_STRING(1, "the.answer");
|
|
|
|
+ wValue.attributeId = UA_ATTRIBUTEID_USEREXECUTABLE;
|
|
|
|
+ wValue.value.hasValue = UA_FALSE;
|
|
|
|
+ UA_StatusCode retval = writeValue(server, &wValue);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_BADTYPEMISMATCH);
|
|
|
|
+ }END_TEST
|
|
|
|
+
|
|
|
|
+START_TEST(numericRange)
|
|
|
|
+ {
|
|
|
|
+ //UA_Server *server = makeTestSequence();
|
|
|
|
+
|
|
|
|
+ UA_NumericRange range;
|
|
|
|
+ const UA_String str = (UA_String){9, (UA_Byte*)"1:2,0:3,5"};
|
|
|
|
+ UA_StatusCode retval = parse_numericrange(str, &range);
|
|
|
|
+ ck_assert_int_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
+ ck_assert_int_eq(range.dimensionsSize,3);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[0].min,1);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[0].max,2);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[1].min,0);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[1].max,3);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[2].min,5);
|
|
|
|
+ ck_assert_int_eq(range.dimensions[2].max,5);
|
|
}END_TEST
|
|
}END_TEST
|
|
|
|
|
|
static Suite * testSuite_services_attributes(void) {
|
|
static Suite * testSuite_services_attributes(void) {
|
|
@@ -675,6 +1028,38 @@ static Suite * testSuite_services_attributes(void) {
|
|
ReadSingleAttributeUserExecutableWithoutTimestamp);
|
|
ReadSingleAttributeUserExecutableWithoutTimestamp);
|
|
|
|
|
|
suite_add_tcase(s, tc_readSingleAttributes);
|
|
suite_add_tcase(s, tc_readSingleAttributes);
|
|
|
|
+
|
|
|
|
+ TCase *tc_writeSingleAttributes = tcase_create("writeSingleAttributes");
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeNodeId);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeNodeclass);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeBrowseName);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeDisplayName);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeDescription);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeWriteMask);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeUserWriteMask);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeIsAbstract);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeSymmetric);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeInverseName);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeContainsNoLoops);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeEventNotifier);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeValue);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeDataType);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeValueRank);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeArrayDimensions);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeAccessLevel);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeUserAccessLevel);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeMinimumSamplingInterval);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeHistorizing);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeExecutable);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeUserExecutable);
|
|
|
|
+ tcase_add_test(tc_writeSingleAttributes, WriteSingleAttributeNoValue);
|
|
|
|
+
|
|
|
|
+ suite_add_tcase(s, tc_writeSingleAttributes);
|
|
|
|
+
|
|
|
|
+ TCase *tc_parseNumericRange = tcase_create("parseNumericRange");
|
|
|
|
+ tcase_add_test(tc_parseNumericRange, numericRange);
|
|
|
|
+ suite_add_tcase(s, tc_parseNumericRange);
|
|
|
|
+
|
|
return s;
|
|
return s;
|
|
}
|
|
}
|
|
|
|
|