|
@@ -74,7 +74,8 @@ static void teardown(void) {
|
|
}
|
|
}
|
|
|
|
|
|
START_TEST(Client_connect) {
|
|
START_TEST(Client_connect) {
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
|
|
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
@@ -85,7 +86,8 @@ START_TEST(Client_connect) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_connect_username) {
|
|
START_TEST(Client_connect_username) {
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
UA_StatusCode retval = UA_Client_connect_username(client, "opc.tcp://localhost:4840", "user1", "password");
|
|
UA_StatusCode retval = UA_Client_connect_username(client, "opc.tcp://localhost:4840", "user1", "password");
|
|
|
|
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
@@ -96,7 +98,8 @@ START_TEST(Client_connect_username) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_endpoints) {
|
|
START_TEST(Client_endpoints) {
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
|
|
|
|
UA_EndpointDescription* endpointArray = NULL;
|
|
UA_EndpointDescription* endpointArray = NULL;
|
|
size_t endpointArraySize = 0;
|
|
size_t endpointArraySize = 0;
|
|
@@ -112,14 +115,15 @@ START_TEST(Client_endpoints) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_endpoints_empty) {
|
|
START_TEST(Client_endpoints_empty) {
|
|
- /* Issue a getEndpoints call with empty endpointUrl.
|
|
|
|
- * Using UA_Client_getEndpoints automatically passes the client->endpointUrl as requested endpointUrl.
|
|
|
|
- * The spec says:
|
|
|
|
- * The Server should return a suitable default URL if it does not recognize the HostName in the URL.
|
|
|
|
- *
|
|
|
|
- * See https://github.com/open62541/open62541/issues/775
|
|
|
|
- */
|
|
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ /* Issue a getEndpoints call with empty endpointUrl.
|
|
|
|
+ * Using UA_Client_getEndpoints automatically passes the client->endpointUrl as requested endpointUrl.
|
|
|
|
+ * The spec says:
|
|
|
|
+ * The Server should return a suitable default URL if it does not recognize the HostName in the URL.
|
|
|
|
+ *
|
|
|
|
+ * See https://github.com/open62541/open62541/issues/775
|
|
|
|
+ */
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
|
|
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
@@ -145,7 +149,8 @@ START_TEST(Client_endpoints_empty) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_read) {
|
|
START_TEST(Client_read) {
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
|
|
@@ -162,12 +167,14 @@ START_TEST(Client_read) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_renewSecureChannel) {
|
|
START_TEST(Client_renewSecureChannel) {
|
|
- UA_Client *client = UA_Client_new(UA_ClientConfig_default);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
|
|
/* Forward the time */
|
|
/* Forward the time */
|
|
- UA_fakeSleep((UA_UInt32)((UA_Double)UA_ClientConfig_default.secureChannelLifeTime * 0.8));
|
|
|
|
|
|
+ UA_ClientConfig *cc = UA_Client_getConfig(client);
|
|
|
|
+ UA_fakeSleep((UA_UInt32)((UA_Double)cc->secureChannelLifeTime * 0.8));
|
|
|
|
|
|
/* Now read */
|
|
/* Now read */
|
|
UA_Variant val;
|
|
UA_Variant val;
|
|
@@ -182,14 +189,14 @@ START_TEST(Client_renewSecureChannel) {
|
|
} END_TEST
|
|
} END_TEST
|
|
|
|
|
|
START_TEST(Client_renewSecureChannelWithActiveSubscription) {
|
|
START_TEST(Client_renewSecureChannelWithActiveSubscription) {
|
|
- UA_ClientConfig uaClientConfig = UA_ClientConfig_default;
|
|
|
|
- uaClientConfig.secureChannelLifeTime = 10000;
|
|
|
|
- UA_Client *client = UA_Client_new(uaClientConfig);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
|
|
+ UA_ClientConfig *cc = UA_Client_getConfig(client);
|
|
|
|
+ cc->secureChannelLifeTime = 10000;
|
|
|
|
+
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
UA_CreateSubscriptionRequest request = UA_CreateSubscriptionRequest_default();
|
|
UA_CreateSubscriptionRequest request = UA_CreateSubscriptionRequest_default();
|
|
request.requestedLifetimeCount = 1000;
|
|
request.requestedLifetimeCount = 1000;
|
|
UA_CreateSubscriptionResponse response = UA_Client_Subscriptions_create(client, request,
|
|
UA_CreateSubscriptionResponse response = UA_Client_Subscriptions_create(client, request,
|
|
@@ -208,8 +215,8 @@ START_TEST(Client_renewSecureChannelWithActiveSubscription) {
|
|
} END_TEST
|
|
} END_TEST
|
|
|
|
|
|
START_TEST(Client_reconnect) {
|
|
START_TEST(Client_reconnect) {
|
|
- UA_ClientConfig clientConfig = UA_ClientConfig_default;
|
|
|
|
- UA_Client *client = UA_Client_new(clientConfig);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
|
|
|
|
|
@@ -239,8 +246,8 @@ START_TEST(Client_reconnect) {
|
|
END_TEST
|
|
END_TEST
|
|
|
|
|
|
START_TEST(Client_delete_without_connect) {
|
|
START_TEST(Client_delete_without_connect) {
|
|
- UA_ClientConfig clientConfig = UA_ClientConfig_default;
|
|
|
|
- UA_Client *client = UA_Client_new(clientConfig);
|
|
|
|
|
|
+ UA_Client *client = UA_Client_new();
|
|
|
|
+ UA_ClientConfig_setDefault(UA_Client_getConfig(client));
|
|
ck_assert_msg(client != NULL);
|
|
ck_assert_msg(client != NULL);
|
|
UA_Client_delete(client);
|
|
UA_Client_delete(client);
|
|
}
|
|
}
|