Fix OCResourceResponseTest warning
[iotivity.git] / resource / unittests / OCResourceResponseTest.cpp
index 0768836..942b60e 100644 (file)
@@ -31,14 +31,6 @@ namespace OCResourceResponseTest
     using namespace OC;
     using namespace std;
 
-    TEST(ErrorCodeTest, SetGetErrorCodeValidCode)
-    {
-        OCResourceResponse response;
-        int setCode = 200;
-        EXPECT_NO_THROW(response.setErrorCode(setCode));
-        EXPECT_EQ(setCode, response.getErrorCode());
-    }
-
     TEST(NewResourceUriTest, SetGetNewResourceUriValidUri)
     {
         OCResourceResponse response;
@@ -83,19 +75,20 @@ namespace OCResourceResponseTest
 
     TEST(RequestHandleTest, SetGetRequestHandleValidHandle)
     {
-        char query[] = "?rt=core.light";
-        char address[] = "127.0.0.1";
+        const char query[] = "?rt=core.light";
+        const char address[] = "127.0.0.1";
         OCResourceResponse response;
         OCServerRequest request;
+
         request.method = OC_REST_GET;
-        strncpy(request.query, query, sizeof(query));
-        request.connectivityType = CA_IPV4;
-        strncpy(request.addressInfo.IP.ipAddress, address, sizeof(query));
-        request.addressInfo.IP.port = 5364;
-        request.qos =  OC_LOW_QOS;
+        strncpy(request.query, query, sizeof(request.query));
+        request.devAddr.flags = OC_DEFAULT_FLAGS;
+        request.devAddr.adapter = OC_DEFAULT_ADAPTER;
+        strncpy(request.devAddr.addr, address, sizeof(request.devAddr.addr));
+        request.devAddr.port = 5364;
+        request.qos = OC_LOW_QOS;
         request.coapID = 0;
         request.delayedResNeeded = 0;
-        request.secured = 0;
 
         OCRequestHandle handle = static_cast<OCRequestHandle>(&request);
         EXPECT_EQ(NULL, response.getRequestHandle());
@@ -113,19 +106,23 @@ namespace OCResourceResponseTest
         EXPECT_EQ(NULL, response.getRequestHandle());
     }
 
+#ifdef _MSC_VER
+    TEST(ResourceHandleTest, DISABLED_SetGetResourceHandleValidHandle)
+#else
     TEST(ResourceHandleTest, SetGetResourceHandleValidHandle)
+#endif
     {
         OCResourceResponse response;
         OCResourceHandle resHandle;
 
-        std::string resourceURI = "/a/light1";
+        std::string resourceURI = "/a/light2";
         std::string resourceTypeName = "core.light";
         std::string resourceInterface = DEFAULT_INTERFACE;
         uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
 
-        EXPECT_EQ(OC_STACK_OK, OCCreateResource(&resHandle, resourceURI.c_str(),
-                resourceTypeName.c_str(), resourceInterface.c_str(), nullptr,
-                resourceProperty));
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(resHandle, resourceURI,
+                                         resourceTypeName, resourceInterface, nullptr,
+                                         resourceProperty));
         EXPECT_EQ(NULL, response.getResourceHandle());
         EXPECT_NO_THROW(response.setResourceHandle(resHandle));
         EXPECT_NE(static_cast<OCResourceHandle>(NULL), response.getResourceHandle());