|
@@ -3,7 +3,7 @@
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
|
|
|
#include "ua_types.h"
|
|
#include "ua_types.h"
|
|
-#include "server/ua_namespace.h"
|
|
|
|
|
|
+#include "server/ua_nodestore.h"
|
|
#include "check.h"
|
|
#include "check.h"
|
|
|
|
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
@@ -22,10 +22,10 @@ void printVisitor(const UA_Node* node) {
|
|
printf("%d\n", node->nodeId.identifier.numeric);
|
|
printf("%d\n", node->nodeId.identifier.numeric);
|
|
}
|
|
}
|
|
|
|
|
|
-START_TEST(test_UA_Namespace) {
|
|
|
|
- UA_Namespace *ns = UA_NULL;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+START_TEST(test_UA_NodeStore) {
|
|
|
|
+ UA_NodeStore *ns = UA_NULL;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
}
|
|
}
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
@@ -38,115 +38,115 @@ UA_Int32 createNode(UA_Node** p, UA_Int16 nsid, UA_Int32 id) {
|
|
return UA_SUCCESS;
|
|
return UA_SUCCESS;
|
|
}
|
|
}
|
|
|
|
|
|
-START_TEST(findNodeInUA_NamespaceWithSingleEntry) {
|
|
|
|
|
|
+START_TEST(findNodeInUA_NodeStoreWithSingleEntry) {
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
UA_Node* n1; createNode(&n1,0,2253);
|
|
UA_Node* n1; createNode(&n1,0,2253);
|
|
- UA_Namespace_insert(ns, &n1, UA_NAMESPACE_INSERT_UNIQUE | UA_NAMESPACE_INSERT_GETMANAGED);
|
|
|
|
|
|
+ UA_NodeStore_insert(ns, &n1, UA_NODESTORE_INSERT_UNIQUE | UA_NODESTORE_INSERT_GETMANAGED);
|
|
const UA_Node* nr = UA_NULL;
|
|
const UA_Node* nr = UA_NULL;
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
// when
|
|
// when
|
|
- retval = UA_Namespace_get(ns,&n1->nodeId,&nr);
|
|
|
|
|
|
+ retval = UA_NodeStore_get(ns,&n1->nodeId,&nr);
|
|
// then
|
|
// then
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_ptr_eq(nr,n1);
|
|
ck_assert_ptr_eq(nr,n1);
|
|
// finally
|
|
// finally
|
|
- UA_Namespace_releaseManagedNode(n1);
|
|
|
|
- UA_Namespace_releaseManagedNode(nr);
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_releaseManagedNode(n1);
|
|
|
|
+ UA_NodeStore_releaseManagedNode(nr);
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
-START_TEST(failToFindNodeInOtherUA_Namespace) {
|
|
|
|
|
|
+START_TEST(failToFindNodeInOtherUA_NodeStore) {
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns = UA_NULL;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
|
|
+ UA_NodeStore *ns = UA_NULL;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
|
|
|
|
- UA_Node* n1; createNode(&n1,0,2253); UA_Namespace_insert(ns, &n1, 0);
|
|
|
|
- UA_Node* n2; createNode(&n2,0,2253); UA_Namespace_insert(ns, &n2, 0);
|
|
|
|
|
|
+ UA_Node* n1; createNode(&n1,0,2253); UA_NodeStore_insert(ns, &n1, 0);
|
|
|
|
+ UA_Node* n2; createNode(&n2,0,2253); UA_NodeStore_insert(ns, &n2, 0);
|
|
|
|
|
|
const UA_Node* nr = UA_NULL;
|
|
const UA_Node* nr = UA_NULL;
|
|
// when
|
|
// when
|
|
UA_Node* n; createNode(&n,1,2255);
|
|
UA_Node* n; createNode(&n,1,2255);
|
|
- UA_Int32 retval = UA_Namespace_get(ns,&n->nodeId, &nr);
|
|
|
|
|
|
+ UA_Int32 retval = UA_NodeStore_get(ns,&n->nodeId, &nr);
|
|
// then
|
|
// then
|
|
ck_assert_int_ne(retval, UA_SUCCESS);
|
|
ck_assert_int_ne(retval, UA_SUCCESS);
|
|
// finally
|
|
// finally
|
|
UA_Node_delete(n);
|
|
UA_Node_delete(n);
|
|
- UA_Namespace_releaseManagedNode(nr);
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_releaseManagedNode(nr);
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
-START_TEST(findNodeInUA_NamespaceWithSeveralEntries) {
|
|
|
|
|
|
+START_TEST(findNodeInUA_NodeStoreWithSeveralEntries) {
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
- UA_Node* n1; createNode(&n1,0,2253); UA_Namespace_insert(ns, &n1, 0);
|
|
|
|
- UA_Node* n2; createNode(&n2,0,2255); UA_Namespace_insert(ns, &n2, 0);
|
|
|
|
- UA_Node* n3; createNode(&n3,0,2257); UA_Namespace_insert(ns, &n3, UA_NAMESPACE_INSERT_GETMANAGED);
|
|
|
|
- UA_Node* n4; createNode(&n4,0,2200); UA_Namespace_insert(ns, &n4, 0);
|
|
|
|
- UA_Node* n5; createNode(&n5,0,1); UA_Namespace_insert(ns, &n5, 0);
|
|
|
|
- UA_Node* n6; createNode(&n6,0,12); UA_Namespace_insert(ns, &n6, 0);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
|
|
+ UA_Node* n1; createNode(&n1,0,2253); UA_NodeStore_insert(ns, &n1, 0);
|
|
|
|
+ UA_Node* n2; createNode(&n2,0,2255); UA_NodeStore_insert(ns, &n2, 0);
|
|
|
|
+ UA_Node* n3; createNode(&n3,0,2257); UA_NodeStore_insert(ns, &n3, UA_NODESTORE_INSERT_GETMANAGED);
|
|
|
|
+ UA_Node* n4; createNode(&n4,0,2200); UA_NodeStore_insert(ns, &n4, 0);
|
|
|
|
+ UA_Node* n5; createNode(&n5,0,1); UA_NodeStore_insert(ns, &n5, 0);
|
|
|
|
+ UA_Node* n6; createNode(&n6,0,12); UA_NodeStore_insert(ns, &n6, 0);
|
|
|
|
|
|
const UA_Node* nr = UA_NULL;
|
|
const UA_Node* nr = UA_NULL;
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
// when
|
|
// when
|
|
- retval = UA_Namespace_get(ns,&(n3->nodeId),&nr);
|
|
|
|
|
|
+ retval = UA_NodeStore_get(ns,&(n3->nodeId),&nr);
|
|
// then
|
|
// then
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_ptr_eq(nr,n3);
|
|
ck_assert_ptr_eq(nr,n3);
|
|
// finally
|
|
// finally
|
|
- UA_Namespace_releaseManagedNode(n3);
|
|
|
|
- UA_Namespace_releaseManagedNode(nr);
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_releaseManagedNode(n3);
|
|
|
|
+ UA_NodeStore_releaseManagedNode(nr);
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
-START_TEST(iterateOverUA_NamespaceShallNotVisitEmptyNodes) {
|
|
|
|
|
|
+START_TEST(iterateOverUA_NodeStoreShallNotVisitEmptyNodes) {
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
- UA_Node* n1; createNode(&n1,0,2253); UA_Namespace_insert(ns, &n1, 0);
|
|
|
|
- UA_Node* n2; createNode(&n2,0,2255); UA_Namespace_insert(ns, &n2, 0);
|
|
|
|
- UA_Node* n3; createNode(&n3,0,2257); UA_Namespace_insert(ns, &n3, 0);
|
|
|
|
- UA_Node* n4; createNode(&n4,0,2200); UA_Namespace_insert(ns, &n4, 0);
|
|
|
|
- UA_Node* n5; createNode(&n5,0,1); UA_Namespace_insert(ns, &n5, 0);
|
|
|
|
- UA_Node* n6; createNode(&n6,0,12); UA_Namespace_insert(ns, &n6, 0);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
|
|
+ UA_Node* n1; createNode(&n1,0,2253); UA_NodeStore_insert(ns, &n1, 0);
|
|
|
|
+ UA_Node* n2; createNode(&n2,0,2255); UA_NodeStore_insert(ns, &n2, 0);
|
|
|
|
+ UA_Node* n3; createNode(&n3,0,2257); UA_NodeStore_insert(ns, &n3, 0);
|
|
|
|
+ UA_Node* n4; createNode(&n4,0,2200); UA_NodeStore_insert(ns, &n4, 0);
|
|
|
|
+ UA_Node* n5; createNode(&n5,0,1); UA_NodeStore_insert(ns, &n5, 0);
|
|
|
|
+ UA_Node* n6; createNode(&n6,0,12); UA_NodeStore_insert(ns, &n6, 0);
|
|
|
|
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
// when
|
|
// when
|
|
zeroCnt = 0;
|
|
zeroCnt = 0;
|
|
visitCnt = 0;
|
|
visitCnt = 0;
|
|
- retval = UA_Namespace_iterate(ns,checkZeroVisitor);
|
|
|
|
|
|
+ retval = UA_NodeStore_iterate(ns,checkZeroVisitor);
|
|
// then
|
|
// then
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(zeroCnt, 0);
|
|
ck_assert_int_eq(zeroCnt, 0);
|
|
ck_assert_int_eq(visitCnt, 6);
|
|
ck_assert_int_eq(visitCnt, 6);
|
|
// finally
|
|
// finally
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
@@ -158,25 +158,25 @@ START_TEST(findNodeInExpandedNamespace) {
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
UA_Node* n;
|
|
UA_Node* n;
|
|
UA_Int32 i=0;
|
|
UA_Int32 i=0;
|
|
for (; i<200; i++) {
|
|
for (; i<200; i++) {
|
|
- createNode(&n,0,i); UA_Namespace_insert(ns, &n, 0);
|
|
|
|
|
|
+ createNode(&n,0,i); UA_NodeStore_insert(ns, &n, 0);
|
|
}
|
|
}
|
|
const UA_Node* nr = UA_NULL;
|
|
const UA_Node* nr = UA_NULL;
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
// when
|
|
// when
|
|
createNode(&n,0,25);
|
|
createNode(&n,0,25);
|
|
- retval = UA_Namespace_get(ns,&(n->nodeId),&nr);
|
|
|
|
|
|
+ retval = UA_NodeStore_get(ns,&(n->nodeId),&nr);
|
|
// then
|
|
// then
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(nr->nodeId.identifier.numeric,n->nodeId.identifier.numeric);
|
|
ck_assert_int_eq(nr->nodeId.identifier.numeric,n->nodeId.identifier.numeric);
|
|
// finally
|
|
// finally
|
|
UA_free((void*)n);
|
|
UA_free((void*)n);
|
|
- UA_Namespace_releaseManagedNode(nr);
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_releaseManagedNode(nr);
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
@@ -188,53 +188,53 @@ START_TEST(iterateOverExpandedNamespaceShallNotVisitEmptyNodes) {
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
UA_Node* n;
|
|
UA_Node* n;
|
|
UA_Int32 i=0;
|
|
UA_Int32 i=0;
|
|
for (; i<200; i++) {
|
|
for (; i<200; i++) {
|
|
- createNode(&n,0,i); UA_Namespace_insert(ns, &n, 0);
|
|
|
|
|
|
+ createNode(&n,0,i); UA_NodeStore_insert(ns, &n, 0);
|
|
}
|
|
}
|
|
// when
|
|
// when
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
zeroCnt = 0;
|
|
zeroCnt = 0;
|
|
visitCnt = 0;
|
|
visitCnt = 0;
|
|
- retval = UA_Namespace_iterate(ns,checkZeroVisitor);
|
|
|
|
|
|
+ retval = UA_NodeStore_iterate(ns,checkZeroVisitor);
|
|
// then
|
|
// then
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
ck_assert_int_eq(zeroCnt, 0);
|
|
ck_assert_int_eq(zeroCnt, 0);
|
|
ck_assert_int_eq(visitCnt, 200);
|
|
ck_assert_int_eq(visitCnt, 200);
|
|
// finally
|
|
// finally
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
-START_TEST(failToFindNonExistantNodeInUA_NamespaceWithSeveralEntries) {
|
|
|
|
|
|
+START_TEST(failToFindNonExistantNodeInUA_NodeStoreWithSeveralEntries) {
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
#endif
|
|
#endif
|
|
// given
|
|
// given
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
- UA_Node* n1; createNode(&n1,0,2253); UA_Namespace_insert(ns, &n1, 0);
|
|
|
|
- UA_Node* n2; createNode(&n2,0,2255); UA_Namespace_insert(ns, &n2, 0);
|
|
|
|
- UA_Node* n3; createNode(&n3,0,2257); UA_Namespace_insert(ns, &n3, 0);
|
|
|
|
- UA_Node* n4; createNode(&n4,0,2200); UA_Namespace_insert(ns, &n4, 0);
|
|
|
|
- UA_Node* n5; createNode(&n5,0,1); UA_Namespace_insert(ns, &n5, 0);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
|
|
+ UA_Node* n1; createNode(&n1,0,2253); UA_NodeStore_insert(ns, &n1, 0);
|
|
|
|
+ UA_Node* n2; createNode(&n2,0,2255); UA_NodeStore_insert(ns, &n2, 0);
|
|
|
|
+ UA_Node* n3; createNode(&n3,0,2257); UA_NodeStore_insert(ns, &n3, 0);
|
|
|
|
+ UA_Node* n4; createNode(&n4,0,2200); UA_NodeStore_insert(ns, &n4, 0);
|
|
|
|
+ UA_Node* n5; createNode(&n5,0,1); UA_NodeStore_insert(ns, &n5, 0);
|
|
UA_Node* n6; createNode(&n6,0,12);
|
|
UA_Node* n6; createNode(&n6,0,12);
|
|
|
|
|
|
const UA_Node* nr = UA_NULL;
|
|
const UA_Node* nr = UA_NULL;
|
|
UA_Int32 retval;
|
|
UA_Int32 retval;
|
|
// when
|
|
// when
|
|
- retval = UA_Namespace_get(ns, &(n6->nodeId), &nr);
|
|
|
|
|
|
+ retval = UA_NodeStore_get(ns, &(n6->nodeId), &nr);
|
|
// then
|
|
// then
|
|
ck_assert_int_ne(retval, UA_SUCCESS);
|
|
ck_assert_int_ne(retval, UA_SUCCESS);
|
|
// finally
|
|
// finally
|
|
UA_free((void *)n6);
|
|
UA_free((void *)n6);
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
#endif
|
|
#endif
|
|
@@ -246,8 +246,8 @@ END_TEST
|
|
/************************************/
|
|
/************************************/
|
|
|
|
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
-struct UA_NamespaceProfileTest {
|
|
|
|
- UA_Namespace *ns;
|
|
|
|
|
|
+struct UA_NodeStoreProfileTest {
|
|
|
|
+ UA_NodeStore *ns;
|
|
UA_Int32 min_val;
|
|
UA_Int32 min_val;
|
|
UA_Int32 max_val;
|
|
UA_Int32 max_val;
|
|
UA_Int32 rounds;
|
|
UA_Int32 rounds;
|
|
@@ -255,16 +255,16 @@ struct UA_NamespaceProfileTest {
|
|
|
|
|
|
void *profileGetThread(void *arg) {
|
|
void *profileGetThread(void *arg) {
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
- struct UA_NamespaceProfileTest *test = (struct UA_NamespaceProfileTest*) arg;
|
|
|
|
|
|
+ struct UA_NodeStoreProfileTest *test = (struct UA_NodeStoreProfileTest*) arg;
|
|
UA_NodeId id = NS0NODEID(0);
|
|
UA_NodeId id = NS0NODEID(0);
|
|
const UA_Node *cn;
|
|
const UA_Node *cn;
|
|
UA_Int32 max_val = test->max_val;
|
|
UA_Int32 max_val = test->max_val;
|
|
- UA_Namespace *ns = test->ns;
|
|
|
|
|
|
+ UA_NodeStore *ns = test->ns;
|
|
for(UA_Int32 x = 0; x<test->rounds; x++) {
|
|
for(UA_Int32 x = 0; x<test->rounds; x++) {
|
|
for (UA_Int32 i=test->min_val; i<max_val; i++) {
|
|
for (UA_Int32 i=test->min_val; i<max_val; i++) {
|
|
id.identifier.numeric = i;
|
|
id.identifier.numeric = i;
|
|
- UA_Namespace_get(ns,&id, &cn);
|
|
|
|
- UA_Namespace_releaseManagedNode(cn);
|
|
|
|
|
|
+ UA_NodeStore_get(ns,&id, &cn);
|
|
|
|
+ UA_NodeStore_releaseManagedNode(cn);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
@@ -279,21 +279,21 @@ START_TEST(profileGetDelete) {
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#define N 1000000
|
|
#define N 1000000
|
|
- UA_Namespace *ns;
|
|
|
|
- UA_Namespace_new(&ns);
|
|
|
|
|
|
+ UA_NodeStore *ns;
|
|
|
|
+ UA_NodeStore_new(&ns);
|
|
UA_Int32 i=0;
|
|
UA_Int32 i=0;
|
|
UA_Node *n;
|
|
UA_Node *n;
|
|
for (; i<N; i++) {
|
|
for (; i<N; i++) {
|
|
- createNode(&n,0,i); UA_Namespace_insert(ns, &n, 0);
|
|
|
|
|
|
+ createNode(&n,0,i); UA_NodeStore_insert(ns, &n, 0);
|
|
}
|
|
}
|
|
clock_t begin, end;
|
|
clock_t begin, end;
|
|
begin = clock();
|
|
begin = clock();
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
#define THREADS 4
|
|
#define THREADS 4
|
|
pthread_t t[THREADS];
|
|
pthread_t t[THREADS];
|
|
- struct UA_NamespaceProfileTest p[THREADS];
|
|
|
|
|
|
+ struct UA_NodeStoreProfileTest p[THREADS];
|
|
for (int i = 0; i < THREADS; i++) {
|
|
for (int i = 0; i < THREADS; i++) {
|
|
- p[i] = (struct UA_NamespaceProfileTest){ns, i*(N/THREADS), (i+1)*(N/THREADS), 50};
|
|
|
|
|
|
+ p[i] = (struct UA_NodeStoreProfileTest){ns, i*(N/THREADS), (i+1)*(N/THREADS), 50};
|
|
pthread_create(&t[i], NULL, profileGetThread, &p[i]);
|
|
pthread_create(&t[i], NULL, profileGetThread, &p[i]);
|
|
}
|
|
}
|
|
for (int i = 0; i < THREADS; i++)
|
|
for (int i = 0; i < THREADS; i++)
|
|
@@ -306,15 +306,15 @@ START_TEST(profileGetDelete) {
|
|
for(UA_Int32 x = 0; x<50; x++) {
|
|
for(UA_Int32 x = 0; x<50; x++) {
|
|
for(i=0; i<N; i++) {
|
|
for(i=0; i<N; i++) {
|
|
id.identifier.numeric = i;
|
|
id.identifier.numeric = i;
|
|
- UA_Namespace_get(ns,&id, &cn);
|
|
|
|
- UA_Namespace_releaseManagedNode(cn);
|
|
|
|
|
|
+ UA_NodeStore_get(ns,&id, &cn);
|
|
|
|
+ UA_NodeStore_releaseManagedNode(cn);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end = clock();
|
|
end = clock();
|
|
printf("Time for single-threaded %d create/get/delete in a namespace: %fs.\n", N, (double)(end - begin) / CLOCKS_PER_SEC);
|
|
printf("Time for single-threaded %d create/get/delete in a namespace: %fs.\n", N, (double)(end - begin) / CLOCKS_PER_SEC);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- UA_Namespace_delete(ns);
|
|
|
|
|
|
+ UA_NodeStore_delete(ns);
|
|
|
|
|
|
#ifdef MULTITHREADING
|
|
#ifdef MULTITHREADING
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
@@ -323,22 +323,22 @@ START_TEST(profileGetDelete) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
Suite * namespace_suite (void) {
|
|
Suite * namespace_suite (void) {
|
|
- Suite *s = suite_create ("UA_Namespace");
|
|
|
|
|
|
+ Suite *s = suite_create ("UA_NodeStore");
|
|
|
|
|
|
TCase *tc_cd = tcase_create ("Create/Delete");
|
|
TCase *tc_cd = tcase_create ("Create/Delete");
|
|
- tcase_add_test (tc_cd, test_UA_Namespace);
|
|
|
|
|
|
+ tcase_add_test (tc_cd, test_UA_NodeStore);
|
|
suite_add_tcase (s, tc_cd);
|
|
suite_add_tcase (s, tc_cd);
|
|
|
|
|
|
TCase* tc_find = tcase_create ("Find");
|
|
TCase* tc_find = tcase_create ("Find");
|
|
- tcase_add_test (tc_find, findNodeInUA_NamespaceWithSingleEntry);
|
|
|
|
- tcase_add_test (tc_find, findNodeInUA_NamespaceWithSeveralEntries);
|
|
|
|
|
|
+ tcase_add_test (tc_find, findNodeInUA_NodeStoreWithSingleEntry);
|
|
|
|
+ tcase_add_test (tc_find, findNodeInUA_NodeStoreWithSeveralEntries);
|
|
tcase_add_test (tc_find, findNodeInExpandedNamespace);
|
|
tcase_add_test (tc_find, findNodeInExpandedNamespace);
|
|
- tcase_add_test (tc_find, failToFindNonExistantNodeInUA_NamespaceWithSeveralEntries);
|
|
|
|
- tcase_add_test (tc_find, failToFindNodeInOtherUA_Namespace);
|
|
|
|
|
|
+ tcase_add_test (tc_find, failToFindNonExistantNodeInUA_NodeStoreWithSeveralEntries);
|
|
|
|
+ tcase_add_test (tc_find, failToFindNodeInOtherUA_NodeStore);
|
|
suite_add_tcase (s, tc_find);
|
|
suite_add_tcase (s, tc_find);
|
|
|
|
|
|
TCase* tc_iterate = tcase_create ("Iterate");
|
|
TCase* tc_iterate = tcase_create ("Iterate");
|
|
- tcase_add_test (tc_iterate, iterateOverUA_NamespaceShallNotVisitEmptyNodes);
|
|
|
|
|
|
+ tcase_add_test (tc_iterate, iterateOverUA_NodeStoreShallNotVisitEmptyNodes);
|
|
tcase_add_test (tc_iterate, iterateOverExpandedNamespaceShallNotVisitEmptyNodes);
|
|
tcase_add_test (tc_iterate, iterateOverExpandedNamespaceShallNotVisitEmptyNodes);
|
|
suite_add_tcase (s, tc_iterate);
|
|
suite_add_tcase (s, tc_iterate);
|
|
|
|
|