#include "cainterface.h"
#include "cacommon.h"
+#define CA_TRANSPORT_ADAPTER_SCOPE 1000
class CATests : public testing::Test {
protected:
}
};
-void request_handler(CARemoteEndpoint_t* object, CARequestInfo_t* requestInfo);
-void response_handler(CARemoteEndpoint_t* object, CAResponseInfo_t* responseInfo);
+void request_handler(CAEndpoint_t* object, CARequestInfo_t* requestInfo);
+void response_handler(CAEndpoint_t* object, CAResponseInfo_t* responseInfo);
+void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
CAResult_t checkGetNetworkInfo();
CAResult_t checkSelectNetwork();
+void request_handler(const CAEndpoint_t * /*object*/,
+ const CARequestInfo_t * /*requestInfo*/)
+{
+}
-void request_handler(const CARemoteEndpoint_t *object, const CARequestInfo_t *requestInfo)
+void response_handler(const CAEndpoint_t * /*object*/,
+ const CAResponseInfo_t * /*responseInfo*/)
{
}
-void response_handler(const CARemoteEndpoint_t *object, const CAResponseInfo_t *responseInfo)
+void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo)
{
+ if(!object || !errorInfo)
+ {
+ return;
+ }
+ //error handling shall be added
+ return;
}
-static char* uri = NULL;
-static CARemoteEndpoint_t* tempRep = NULL;
+static char* addr = NULL;
+static CAEndpoint_t* tempRep = NULL;
static CARequestInfo_t requestInfo;
static CAInfo_t requestData;
static CAInfo_t responseData;
static CAResponseInfo_t responseInfo;
static CAToken_t tempToken = NULL;
static uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-static CAResult_t g_selectNetworkResult = CA_STATUS_OK;
-static const char URI[] = "coap://10.11.12.13:4545/a/light";
-static const char RESOURCE_URI[] = "/a/light";
+static const char ADDRESS[] = "10.11.12.13";
+static const uint16_t PORT = 4545;
-static const char SECURE_INFO_DATA[] =
- "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
- "\"if\":[\"oc.mi.def\"],\"obs\":1,\"sec\":1,\"port\":%d}}]}";
static const char NORMAL_INFO_DATA[] =
"{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
"\"if\":[\"oc.mi.def\"],\"obs\":1}}]}";
}
// CAStartListeningServer TC
// check return value
-TEST(StartListeningServerTest, TC_03_Positive_01)
+TEST(StartListeningServerTest, DISABLED_TC_03_Positive_01)
{
- CASelectNetwork(CA_ETHERNET);
+ CASelectNetwork(CA_ADAPTER_IP);
EXPECT_EQ(CA_STATUS_OK, CAStartListeningServer());
}
// CAStartDiscoveryServer TC
// check return value
-TEST(StartDiscoveryServerTest, TC_04_Positive_01)
+TEST(StartDiscoveryServerTest, DISABLED_TC_04_Positive_01)
{
EXPECT_EQ(CA_STATUS_OK, CAStartDiscoveryServer());
}
// check return value
TEST_F(CATests, RegisterHandlerTest)
{
- CARegisterHandler(request_handler, response_handler);
+ CARegisterHandler(request_handler, response_handler, error_handler);
char* check = (char *) "registerHandler success";
EXPECT_STREQ(check, "registerHandler success");
}
// check return value
TEST_F(CATests, CreateRemoteEndpointTestGood)
{
- uri = (char *) URI;
+ addr = (char *) ADDRESS;
- EXPECT_EQ(CA_STATUS_OK, CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep));
+ EXPECT_EQ(CA_STATUS_OK, CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr,
+ PORT, &tempRep));
if (tempRep != NULL)
{
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
}
// check remoteEndpoint and values of remoteEndpoint
TEST_F(CATests, CreateRemoteEndpointTestValues)
{
- uri = (char *) URI;
+ addr = (char *) ADDRESS;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
EXPECT_TRUE(tempRep != NULL);
if (tempRep != NULL)
{
- EXPECT_STRNE(NULL, tempRep->resourceUri);
- }
-
- if (tempRep != NULL)
- {
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
- }
-}
-
-// check return value when uri is NULL
-TEST_F(CATests, CreateRemoteEndpointTestBad)
-{
- uri = NULL;
-
- EXPECT_EQ(CA_STATUS_FAILED, CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep));
-
- if (tempRep != NULL)
- {
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
- }
-}
-
-// check values of remoteEndpoint when uri is NULL
-TEST_F(CATests, CreateRemoteEndpointTestWithNullUri)
-{
- uri = NULL;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
-
- if (tempRep != NULL)
- {
- EXPECT_STREQ(NULL, tempRep->resourceUri);
-
- }
-
- if (tempRep != NULL)
- {
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
}
-// CADestroyRemoteEndpoint TC
-// check destroyed remoteEndpoint
-TEST_F(CATests, DestroyRemoteEndpointTest)
-{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
-
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
-
- char * check = (char *) "destroy success";
- EXPECT_STREQ(check, "destroy success");
-}
-
// CAGerateToken TC
// check return value
TEST_F(CATests, GenerateTokenTestGood)
EXPECT_STREQ(check, "destroy success");
}
-// CAFindResource TC
-// check return value
-TEST(FindResourceTest, TC_14_Positive_01)
-{
- uri = (char *) RESOURCE_URI;
-
- CAGenerateToken(&tempToken, tokenLength);
- EXPECT_EQ(CA_STATUS_OK, CAFindResource(uri, tempToken, tokenLength));
- CADestroyToken(tempToken);
-}
-
-// check return value when uri is NULL
-TEST_F(CATests, FindResourceTest)
-{
- uri = NULL;
- CAGenerateToken(&tempToken, tokenLength);
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CAFindResource(uri, tempToken, tokenLength));
- CADestroyToken(tempToken);
-}
-
// CASendRequest TC
// check return value
-TEST(SendRequestTest, TC_16_Positive_01)
+TEST(SendRequestTest, DISABLED_TC_16_Positive_01)
{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = (char *) ADDRESS;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
memset(&requestData, 0, sizeof(CAInfo_t));
CAGenerateToken(&tempToken, tokenLength);
int length = strlen(NORMAL_INFO_DATA) + strlen("a/light");
requestData.payload = (CAPayload_t) calloc(length, sizeof(char));
- snprintf(requestData.payload, length, NORMAL_INFO_DATA, "a/light");
+ if(!requestData.payload)
+ {
+ CADestroyToken(tempToken);
+ FAIL() << "requestData.payload allocation failed";
+ }
+ snprintf((char*)requestData.payload, length, NORMAL_INFO_DATA, "a/light");
+ requestData.payloadSize = length + 1;
requestData.type = CA_MSG_NONCONFIRM;
memset(&requestInfo, 0, sizeof(CARequestInfo_t));
free(requestData.payload);
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
-// check return value when uri is NULL
-TEST_F(CATests, SendRequestTestWithNullURI)
-{
- uri = NULL;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
-
- memset(&requestData, 0, sizeof(CAInfo_t));
- CAGenerateToken(&tempToken, tokenLength);
- requestData.token = tempToken;
- requestData.tokenLength = tokenLength;
-
- int length = strlen(NORMAL_INFO_DATA) + strlen("a/light");
- requestData.payload = (CAPayload_t) calloc(length, sizeof(char));
- snprintf(requestData.payload, length, NORMAL_INFO_DATA, "a/light");
- requestData.type = CA_MSG_NONCONFIRM;
-
- memset(&requestInfo, 0, sizeof(CARequestInfo_t));
- requestInfo.method = CA_GET;
- requestInfo.info = requestData;
-
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendRequest(tempRep, &requestInfo));
-
- CADestroyToken(tempToken);
-
- free(requestData.payload);
-
- if (tempRep != NULL)
- {
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
- }
-}
-
// check return value when a NULL is passed instead of a valid CARequestInfo_t address
TEST_F(CATests, SendRequestTestWithNullAddr)
{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = (char *) ADDRESS;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendRequest(tempRep, NULL));
if (tempRep != NULL)
{
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
}
// CASendResponse TC
// check return value
-TEST(SendResponseTest, TC_19_Positive_01)
+TEST(SendResponseTest, DISABLED_TC_19_Positive_01)
{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = (char *) ADDRESS;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
memset(&responseData, 0, sizeof(CAInfo_t));
responseData.type = CA_MSG_NONCONFIRM;
responseData.messageId = 1;
- responseData.payload = (char *) "response payload";
+ responseData.payload = (CAPayload_t)malloc(sizeof("response payload"));
+
+ EXPECT_TRUE(responseData.payload != NULL);
+ if(!responseData.payload)
+ {
+ CADestroyEndpoint(tempRep);
+ return;
+ }
+
+ memcpy(responseData.payload, "response payload", sizeof("response payload"));
+ responseData.payloadSize = sizeof("response payload");
CAGenerateToken(&tempToken, tokenLength);
requestData.token = tempToken;
requestData.tokenLength = tokenLength;
memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
- responseInfo.result = CA_SUCCESS;
+ responseInfo.result = CA_CONTENT;
responseInfo.info = responseData;
EXPECT_EQ(CA_STATUS_OK, CASendResponse(tempRep, &responseInfo));
CADestroyToken(tempToken);
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
+ free(responseData.payload);
tempRep = NULL;
}
-// check return value when uri is NULL
-TEST(SendResponseTest, TC_20_Negative_01)
+// check return value when address is NULL as multicast
+TEST(SendResponseTest, DISABLED_TC_20_Negative_01)
{
- uri = NULL;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = NULL;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, 0, &tempRep);
memset(&responseData, 0, sizeof(CAInfo_t));
responseData.type = CA_MSG_NONCONFIRM;
responseData.messageId = 1;
- responseData.payload = (char *) "response payload";
+ responseData.payload = (CAPayload_t)malloc(sizeof("response payload"));
+ EXPECT_TRUE(responseData.payload != NULL);
+
+ if(!responseData.payload)
+ {
+ CADestroyEndpoint(tempRep);
+ return;
+ }
+
+ memcpy(responseData.payload, "response payload", sizeof("response payload"));
+ responseData.payloadSize = sizeof("response payload");
CAGenerateToken(&tempToken, tokenLength);
requestData.token = tempToken;
requestData.tokenLength = tokenLength;
memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
- responseInfo.result = CA_SUCCESS;
+ responseInfo.result = CA_CONTENT;
responseInfo.info = responseData;
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendResponse(tempRep, &responseInfo));
+ EXPECT_EQ(CA_STATUS_OK, CASendResponse(tempRep, &responseInfo));
CADestroyToken(tempToken);
if (tempRep != NULL)
{
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
+ free (responseData.payload);
}
// check return value NULL is passed instead of a valid CAResponseInfo_t address
TEST_F(CATests, SendResponseTest)
{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = (char *) ADDRESS;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendResponse(tempRep, NULL));
if (tempRep != NULL)
{
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
}
// CASendNotification TC
// check return value
-TEST(SendNotificationTest, TC_22_Positive_01)
+TEST(SendNotificationTest, DISABLED_TC_22_Positive_01)
{
- uri = (char *) URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
+ addr = (char *) ADDRESS;
+ CACreateEndpoint(CA_DEFAULT_FLAGS, CA_ADAPTER_IP, addr, PORT, &tempRep);
memset(&responseData, 0, sizeof(CAInfo_t));
responseData.type = CA_MSG_NONCONFIRM;
- responseData.payload = (char *) "Temp Notification Data";
+ responseData.payload = (CAPayload_t)malloc(sizeof("Temp Notification Data"));
- CAGenerateToken(&tempToken, tokenLength);
- requestData.token = tempToken;
- requestData.tokenLength = tokenLength;
-
- memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
- responseInfo.result = CA_SUCCESS;
- responseInfo.info = responseData;
-
- EXPECT_EQ(CA_STATUS_OK, CASendNotification(tempRep, &responseInfo));
-
- CADestroyToken(tempToken);
- if (tempRep != NULL)
+ EXPECT_TRUE(responseData.payload != NULL);
+ if(!responseData.payload)
{
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
+ CADestroyEndpoint(tempRep);
+ return;
}
-}
-
-// check return value when uri is NULL
-TEST_F(CATests, SendNotificationTest)
-{
- uri = NULL;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
- memset(&responseData, 0, sizeof(CAInfo_t));
- responseData.type = CA_MSG_NONCONFIRM;
- responseData.payload = (char *) "Temp Notification Data";
+ memcpy(responseData.payload, "Temp Notification Data", sizeof("Temp Notification Data"));
+ responseData.payloadSize = sizeof("Temp Notification Data");
CAGenerateToken(&tempToken, tokenLength);
requestData.token = tempToken;
requestData.tokenLength = tokenLength;
memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
- responseInfo.result = CA_SUCCESS;
+ responseInfo.result = CA_CONTENT;
responseInfo.info = responseData;
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendNotification(tempRep, &responseInfo));
+ EXPECT_EQ(CA_STATUS_OK, CASendNotification(tempRep, &responseInfo));
CADestroyToken(tempToken);
if (tempRep != NULL)
{
- CADestroyRemoteEndpoint(tempRep);
+ CADestroyEndpoint(tempRep);
tempRep = NULL;
}
-}
-
-// CAAdvertiseResource TC
-// check return value
-TEST(AdvertiseResourceTest, TC_24_Positive_01)
-{
- uri = (char *) RESOURCE_URI;
- int optionNum = 2;
-
- CAHeaderOption_t* headerOpt;
- headerOpt = (CAHeaderOption_t *) calloc(1, optionNum * sizeof(CAHeaderOption_t));
-
- char* tmpOptionData1 = (char *) "Hello";
- size_t tmpOptionDataLen = (strlen(tmpOptionData1) < CA_MAX_HEADER_OPTION_DATA_LENGTH) ?
- strlen(tmpOptionData1) : CA_MAX_HEADER_OPTION_DATA_LENGTH - 1;
- headerOpt[0].optionID = 3000;
- memcpy(headerOpt[0].optionData, tmpOptionData1, tmpOptionDataLen);
- headerOpt[0].optionLength = (uint16_t) tmpOptionDataLen;
-
- char* tmpOptionData2 = (char *) "World";
- tmpOptionDataLen = (strlen(tmpOptionData2) < CA_MAX_HEADER_OPTION_DATA_LENGTH) ?
- strlen(tmpOptionData2) : CA_MAX_HEADER_OPTION_DATA_LENGTH - 1;
- headerOpt[1].optionID = 3001;
- memcpy(headerOpt[1].optionData, tmpOptionData2, tmpOptionDataLen);
- headerOpt[1].optionLength = (uint16_t) tmpOptionDataLen;
-
- CAGenerateToken(&tempToken, tokenLength);
-
- EXPECT_EQ(CA_STATUS_OK, CAAdvertiseResource(uri, tempToken, tokenLength,
- headerOpt, (uint8_t )optionNum));
-
- CADestroyToken(tempToken);
-
- free(headerOpt);
-}
-
-// check return value when uri is NULL
-TEST_F(CATests, AdvertiseResourceTest)
-{
- uri = NULL;
- int optionNum = 2;
-
- CAHeaderOption_t* headerOpt;
- headerOpt = (CAHeaderOption_t *) calloc(1, optionNum * sizeof(CAHeaderOption_t));
-
- char* tmpOptionData1 = (char *) "Hello";
- size_t tmpOptionDataLen = (strlen(tmpOptionData1) < CA_MAX_HEADER_OPTION_DATA_LENGTH) ?
- strlen(tmpOptionData1) : CA_MAX_HEADER_OPTION_DATA_LENGTH - 1;
- headerOpt[0].optionID = 3000;
- memcpy(headerOpt[0].optionData, tmpOptionData1, tmpOptionDataLen);
- headerOpt[0].optionLength = (uint16_t) tmpOptionDataLen;
-
- char* tmpOptionData2 = (char *) "World";
- tmpOptionDataLen = (strlen(tmpOptionData2) < CA_MAX_HEADER_OPTION_DATA_LENGTH) ?
- strlen(tmpOptionData2) : CA_MAX_HEADER_OPTION_DATA_LENGTH - 1;
- headerOpt[1].optionID = 3001;
- memcpy(headerOpt[1].optionData, tmpOptionData2, tmpOptionDataLen);
- headerOpt[1].optionLength = (uint16_t) tmpOptionDataLen;
-
- CAGenerateToken(&tempToken, tokenLength);
-
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CAAdvertiseResource(uri, tempToken, tokenLength,
- headerOpt, (uint8_t )optionNum));
-
- CADestroyToken(tempToken);
-
- free(headerOpt);
+ free(responseData.payload);
}
// CASelectNewwork TC
CAResult_t checkSelectNetwork()
{
- CAResult_t res = CASelectNetwork(CA_ETHERNET);
+ CAResult_t res = CASelectNetwork(CA_ADAPTER_IP);
if (CA_STATUS_OK == res)
{
- g_selectNetworkResult = res;
+ EXPECT_EQ(CA_STATUS_OK, CAUnSelectNetwork(CA_ADAPTER_IP));
return CA_STATUS_OK;
}
- else if (CA_NOT_SUPPORTED == res)
+ if (CA_NOT_SUPPORTED == res)
{
- g_selectNetworkResult = res;
+ EXPECT_EQ(CA_STATUS_FAILED, CAUnSelectNetwork(CA_ADAPTER_IP));
return CA_STATUS_OK;
}
- else
- {
- return CA_STATUS_FAILED;
- }
+
+ return res;
}
// check return value when selected network is disable
TEST_F(CATests, SelectNetworkTestBad)
{
//Select disable network
- EXPECT_EQ(CA_NOT_SUPPORTED, CASelectNetwork(1000));
-}
-
-// CAUnSelectNewwork TC
-// check return value
-TEST(UnSelectNetworkTest, TC_28_Positive_01)
-{
- if (CA_STATUS_OK == g_selectNetworkResult)
- {
- EXPECT_EQ(CA_STATUS_OK, CAUnSelectNetwork(CA_ETHERNET));
- }
-
- if (CA_NOT_SUPPORTED == g_selectNetworkResult)
- {
- EXPECT_EQ(CA_STATUS_FAILED, CAUnSelectNetwork(CA_ETHERNET));
- }
+ EXPECT_EQ(CA_NOT_SUPPORTED, CASelectNetwork((CATransportAdapter_t)
+ CA_TRANSPORT_ADAPTER_SCOPE));
}
// check return value when selected network is disable
TEST_F(CATests, UnSelectNetworkTest)
{
//UnSelect disable network
- EXPECT_EQ(CA_STATUS_FAILED, CAUnSelectNetwork(1000));
+ EXPECT_EQ(CA_STATUS_FAILED, CAUnSelectNetwork((CATransportAdapter_t)
+ CA_TRANSPORT_ADAPTER_SCOPE));
}
// CAHandlerRequestResponse TC
EXPECT_EQ(CA_STATUS_OK, CAHandleRequestResponse());
}
-// CASendRequestToAll TC
-// check return value
-TEST (SendRequestToAllTest, TC_31_Positive_01)
-{
- uri = (char *) RESOURCE_URI;
- CACreateRemoteEndpoint(uri, CA_ETHERNET, &tempRep);
- CAGroupEndpoint_t *group = NULL;
- group = (CAGroupEndpoint_t *) malloc(sizeof(CAGroupEndpoint_t));
- group->connectivityType = tempRep->connectivityType;
- group->resourceUri = tempRep->resourceUri;
-
- memset(&requestData, 0, sizeof(CAInfo_t));
- CAGenerateToken(&tempToken, tokenLength);
- requestData.token = tempToken;
- requestData.tokenLength = tokenLength;
-
- requestData.payload = (char *) "Temp Json Payload";
- requestData.type = CA_MSG_NONCONFIRM;
- memset(&requestInfo, 0, sizeof(CARequestInfo_t));
- requestInfo.method = CA_GET;
- requestInfo.info = requestData;
-
- EXPECT_EQ(CA_STATUS_OK, CASendRequestToAll(group, &requestInfo));
-
- CADestroyToken(tempToken);
-
- CADestroyRemoteEndpoint(tempRep);
- tempRep = NULL;
-
- free(group);
-}
-
-// check return value when group->resourceUri is NULL
-TEST (SendRequestToAllTest, TC_32_Negative_01)
-{
- uri = (char *) RESOURCE_URI;
- CAGroupEndpoint_t *group = NULL;
-
- memset(&requestData, 0, sizeof(CAInfo_t));
- CAGenerateToken(&tempToken, tokenLength);
- requestData.token = tempToken;
- requestData.tokenLength = tokenLength;
-
- requestData.payload = (char *) "Temp Json Payload";
- requestData.type = CA_MSG_NONCONFIRM;
- memset(&requestInfo, 0, sizeof(CARequestInfo_t));
- requestInfo.method = CA_GET;
- requestInfo.info = requestData;
-
- EXPECT_EQ(CA_STATUS_INVALID_PARAM, CASendRequestToAll(group, &requestInfo));
-
- CADestroyToken(tempToken);
-}
-
// CAGetNetworkInformation TC
// check return value
TEST_F (CATests, GetNetworkInformationTestGood)
CAResult_t checkGetNetworkInfo()
{
- CALocalConnectivity_t *tempInfo = NULL;
+ CAEndpoint_t *tempInfo = NULL;
uint32_t tempSize = 0;
CAResult_t res = CAGetNetworkInformation(&tempInfo, &tempSize);
+ free(tempInfo);
+
if (CA_STATUS_OK == res || CA_ADAPTER_NOT_ENABLED == res ||
CA_NOT_SUPPORTED == res)
{