Rearrange the headers
authorcoderhyme <jhyo.kim@samsung.com>
Fri, 17 Jul 2015 01:53:29 +0000 (10:53 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 17 Jul 2015 02:13:10 +0000 (02:13 +0000)
The headers to be exposed as a part of API are moved to include folder of root of resource-manipulation

Change-Id: I40ee68e9aefcacdaef2272338674b66d5dbbf47c
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1703
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
27 files changed:
service/resource-manipulation/include/RCSException.h [moved from service/resource-manipulation/src/common/primitiveResource/include/PrimitiveException.h with 66% similarity, mode: 0644]
service/resource-manipulation/include/RCSRequest.h [moved from service/resource-manipulation/src/serverBuilder/include/PrimitiveRequest.h with 79% similarity]
service/resource-manipulation/include/RCSResponse.h [moved from service/resource-manipulation/src/serverBuilder/include/PrimitiveResponse.h with 52% similarity]
service/resource-manipulation/include/ResourceAttributes.h [moved from service/resource-manipulation/src/common/primitiveResource/include/ResourceAttributes.h with 96% similarity, mode: 0644]
service/resource-manipulation/include/ResourceObject.h [moved from service/resource-manipulation/src/serverBuilder/include/ResourceObject.h with 94% similarity, mode: 0644]
service/resource-manipulation/src/common/primitiveResource/SConscript
service/resource-manipulation/src/common/primitiveResource/include/AssertUtils.h [moved from service/resource-manipulation/src/common/primitiveResource/include/internal/AssertUtils.h with 99% similarity]
service/resource-manipulation/src/common/primitiveResource/include/PrimitiveResourceImpl.h [moved from service/resource-manipulation/src/common/primitiveResource/include/internal/PrimitiveResourceImpl.h with 98% similarity]
service/resource-manipulation/src/common/primitiveResource/include/ResourceAttributesConverter.h [moved from service/resource-manipulation/src/common/primitiveResource/include/internal/ResourceAttributesConverter.h with 100% similarity]
service/resource-manipulation/src/common/primitiveResource/include/ResourceAttributesUtils.h [moved from service/resource-manipulation/src/common/primitiveResource/include/internal/ResourceAttributesUtils.h with 100% similarity]
service/resource-manipulation/src/common/primitiveResource/src/PresenceSubscriber.cpp
service/resource-manipulation/src/common/primitiveResource/src/PrimitiveResource.cpp
service/resource-manipulation/src/common/primitiveResource/src/RCSException.cpp [moved from service/resource-manipulation/src/common/primitiveResource/src/PrimtiveException.cpp with 69% similarity]
service/resource-manipulation/src/common/primitiveResource/src/ResourceAttributes.cpp
service/resource-manipulation/src/common/primitiveResource/src/ResponseStatement.cpp
service/resource-manipulation/src/common/primitiveResource/unittests/PresenceSubscriberTest.cpp
service/resource-manipulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp
service/resource-manipulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp
service/resource-manipulation/src/serverBuilder/SConscript
service/resource-manipulation/src/serverBuilder/include/RequestHandler.h [moved from service/resource-manipulation/src/serverBuilder/include/internal/RequestHandler.h with 91% similarity]
service/resource-manipulation/src/serverBuilder/src/RCSRequest.cpp [moved from service/resource-manipulation/src/serverBuilder/src/PrimitiveRequest.cpp with 85% similarity]
service/resource-manipulation/src/serverBuilder/src/RCSResponse.cpp [moved from service/resource-manipulation/src/serverBuilder/src/PrimitiveResponse.cpp with 58% similarity]
service/resource-manipulation/src/serverBuilder/src/RequestHandler.cpp
service/resource-manipulation/src/serverBuilder/src/ResourceObject.cpp
service/resource-manipulation/src/serverBuilder/unittests/RCSResponseTest.cpp [moved from service/resource-manipulation/src/serverBuilder/unittests/PrimitiveResponseTest.cpp with 64% similarity]
service/resource-manipulation/src/serverBuilder/unittests/RequestHandlerTest.cpp
service/resource-manipulation/src/serverBuilder/unittests/ResourceObjectTest.cpp

old mode 100755 (executable)
new mode 100644 (file)
similarity index 66%
rename from service/resource-manipulation/src/common/primitiveResource/include/PrimitiveException.h
rename to service/resource-manipulation/include/RCSException.h
index 967008d..a8e5a18
@@ -18,8 +18,8 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#ifndef RES_MANIPULATION_PRIMITIVEEXCEPTION_H
-#define RES_MANIPULATION_PRIMITIVEEXCEPTION_H
+#ifndef RES_MANIPULATION_RCSEXCEPTION_H
+#define RES_MANIPULATION_RCSEXCEPTION_H
 
 #include <string>
 
@@ -30,25 +30,22 @@ namespace OIC
     namespace Service
     {
 
-        class PrimitiveException: public std::exception
+        class RCSException: public std::exception
         {
         public:
-            PrimitiveException() {}
-            explicit PrimitiveException(const std::string& what) : m_what{ what } {}
-            explicit PrimitiveException(std::string&& what) : m_what{ std::move(what) } {}
+            RCSException();
+            explicit RCSException(const std::string&);
+            explicit RCSException(std::string&&);
 
-            virtual ~PrimitiveException() noexcept {}
+            virtual ~RCSException() noexcept {}
 
-            virtual const char* what() const noexcept
-            {
-                return m_what.c_str();
-            }
+            virtual const char* what() const noexcept;
 
         private:
             std::string m_what;
         };
 
-        class PlatformException: public PrimitiveException
+        class PlatformException: public RCSException
         {
         public:
             explicit PlatformException(OCStackResult reason);
@@ -62,4 +59,4 @@ namespace OIC
     }
 }
 
-#endif // RES_MANIPULATION_PRIMITIVEEXCEPTION_H
+#endif // RES_MANIPULATION_RCSEXCEPTION_H
@@ -18,8 +18,8 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#ifndef __PRIMITIVEREQUEST_H
-#define __PRIMITIVEREQUEST_H
+#ifndef SERVERBUILDER_PRIMITIVEREQUEST_H
+#define SERVERBUILDER_PRIMITIVEREQUEST_H
 
 #include <string>
 
@@ -28,12 +28,12 @@ namespace OIC
     namespace Service
     {
 
-        class PrimitiveRequest
+        class RCSRequest
         {
         public:
-            explicit PrimitiveRequest(const std::string& resourceUri);
+            explicit RCSRequest(const std::string& resourceUri);
 
-            PrimitiveRequest& operator=(PrimitiveRequest&) = delete;
+            RCSRequest& operator=(RCSRequest&) = delete;
 
             std::string getResourceUri() const;
 
@@ -44,4 +44,4 @@ namespace OIC
     }
 }
 
-#endif // __PRIMITIVEREQUEST_H
+#endif // SERVERBUILDER_PRIMITIVEREQUEST_H
@@ -18,8 +18,8 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#ifndef __PRIMITIVERESPONSE_H
-#define __PRIMITIVERESPONSE_H
+#ifndef SERVERBUILDER_RCSRESPONSE_H
+#define SERVERBUILDER_RCSRESPONSE_H
 
 #include <cstdint>
 #include <memory>
@@ -35,31 +35,31 @@ namespace OIC
         class RequestHandler;
         class SetRequestHandler;
 
-        class PrimitiveGetResponse
+        class RCSGetResponse
         {
         public:
-            static PrimitiveGetResponse defaultAction();
+            static RCSGetResponse defaultAction();
 
-            static PrimitiveGetResponse create(const OCEntityHandlerResult&, int errorCode);
+            static RCSGetResponse create(const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveGetResponse create(const ResourceAttributes&);
-            static PrimitiveGetResponse create(const ResourceAttributes&,
+            static RCSGetResponse create(const ResourceAttributes&);
+            static RCSGetResponse create(const ResourceAttributes&,
                     const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveGetResponse create(ResourceAttributes&&);
-            static PrimitiveGetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
+            static RCSGetResponse create(ResourceAttributes&&);
+            static RCSGetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
                     int errorCode);
 
             RequestHandler* getHandler() const;
 
         private:
-            PrimitiveGetResponse(std::shared_ptr< RequestHandler >&&);
+            RCSGetResponse(std::shared_ptr< RequestHandler >&&);
 
         private:
             std::shared_ptr< RequestHandler > m_handler;
         };
 
-        class PrimitiveSetResponse
+        class RCSSetResponse
         {
         public:
             enum class AcceptanceMethod
@@ -69,33 +69,33 @@ namespace OIC
                 IGNORE
             };
 
-            static PrimitiveSetResponse defaultAction();
+            static RCSSetResponse defaultAction();
 
-            static PrimitiveSetResponse accept();
-            static PrimitiveSetResponse accept(const OCEntityHandlerResult&, int errorCode);
+            static RCSSetResponse accept();
+            static RCSSetResponse accept(const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveSetResponse ignore();
-            static PrimitiveSetResponse ignore(const OCEntityHandlerResult&, int errorCode);
+            static RCSSetResponse ignore();
+            static RCSSetResponse ignore(const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveSetResponse create(const OCEntityHandlerResult&, int errorCode);
+            static RCSSetResponse create(const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveSetResponse create(const ResourceAttributes&);
-            static PrimitiveSetResponse create(const ResourceAttributes&,
+            static RCSSetResponse create(const ResourceAttributes&);
+            static RCSSetResponse create(const ResourceAttributes&,
                     const OCEntityHandlerResult&, int errorCode);
 
-            static PrimitiveSetResponse create(ResourceAttributes&&);
-            static PrimitiveSetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
+            static RCSSetResponse create(ResourceAttributes&&);
+            static RCSSetResponse create(ResourceAttributes&&, const OCEntityHandlerResult&,
                     int errorCode);
 
             SetRequestHandler* getHandler() const;
 
             AcceptanceMethod getAcceptanceMethod() const;
 
-            PrimitiveSetResponse& setAcceptanceMethod(AcceptanceMethod);
+            RCSSetResponse& setAcceptanceMethod(AcceptanceMethod);
 
         private:
-            PrimitiveSetResponse(std::shared_ptr< SetRequestHandler >&&);
-            PrimitiveSetResponse(std::shared_ptr< SetRequestHandler >&&, AcceptanceMethod);
+            RCSSetResponse(std::shared_ptr< SetRequestHandler >&&);
+            RCSSetResponse(std::shared_ptr< SetRequestHandler >&&, AcceptanceMethod);
 
         private:
             AcceptanceMethod m_acceptanceMethod;
@@ -104,4 +104,4 @@ namespace OIC
     }
 }
 
-#endif
+#endif // SERVERBUILDER_RCSRESPONSE_H
old mode 100755 (executable)
new mode 100644 (file)
similarity index 96%
rename from service/resource-manipulation/src/common/primitiveResource/include/ResourceAttributes.h
rename to service/resource-manipulation/include/ResourceAttributes.h
index 9151cab..bd50b08
 #include <boost/mpl/begin_end.hpp>
 #include <boost/scoped_ptr.hpp>
 
-#include <PrimitiveException.h>
+#include <RCSException.h>
 
 namespace OIC
 {
     namespace Service
     {
-        class BadGetException: public PrimitiveException
+        class BadGetException: public RCSException
         {
         public:
-            BadGetException(const std::string& what) : PrimitiveException{ what } {}
-            BadGetException(std::string&& what) : PrimitiveException{ std::move(what) } {}
+            BadGetException(const std::string& what) : RCSException{ what } {}
+            BadGetException(std::string&& what) : RCSException{ std::move(what) } {}
         };
 
-        class InvalidKeyException: public PrimitiveException
+        class InvalidKeyException: public RCSException
         {
         public:
-            InvalidKeyException(const std::string& what) : PrimitiveException{ what } {}
-            InvalidKeyException(std::string&& what) : PrimitiveException{ std::move(what) } {}
+            InvalidKeyException(const std::string& what) : RCSException{ what } {}
+            InvalidKeyException(std::string&& what) : RCSException{ std::move(what) } {}
         };
 
         class ResourceAttributes
old mode 100755 (executable)
new mode 100644 (file)
similarity index 94%
rename from service/resource-manipulation/src/serverBuilder/include/ResourceObject.h
rename to service/resource-manipulation/include/ResourceObject.h
index e6a4345..205de53
@@ -18,8 +18,8 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#ifndef __OIC_RESOURCEOBJECT_H
-#define __OIC_RESOURCEOBJECT_H
+#ifndef SERVERBUILDER_RESOURCEOBJECT_H
+#define SERVERBUILDER_RESOURCEOBJECT_H
 
 #include <string>
 #include <mutex>
@@ -28,8 +28,8 @@
 #include <boost/atomic.hpp>
 
 #include <ResourceAttributes.h>
-#include <PrimitiveResponse.h>
-#include <PrimitiveRequest.h>
+#include <RCSResponse.h>
+#include <RCSRequest.h>
 
 namespace OC
 {
@@ -41,10 +41,10 @@ namespace OIC
     namespace Service
     {
 
-        class NoLockException: public PrimitiveException
+        class NoLockException: public RCSException
         {
         public:
-            NoLockException(std::string&& what) : PrimitiveException{ std::move(what) } {}
+            NoLockException(std::string&& what) : RCSException{ std::move(what) } {}
         };
 
         class ResourceObject
@@ -96,9 +96,9 @@ namespace OIC
 
             class LockGuard;
 
-            typedef std::function< PrimitiveGetResponse(const PrimitiveRequest&,
+            typedef std::function< RCSGetResponse(const RCSRequest&,
                         ResourceAttributes&) > GetRequestHandler;
-            typedef std::function< PrimitiveSetResponse(const PrimitiveRequest&,
+            typedef std::function< RCSSetResponse(const RCSRequest&,
                         ResourceAttributes&) > SetRequestHandler;
             typedef std::function< void(const ResourceAttributes::Value&,
                     const ResourceAttributes::Value&) > AttributeUpdatedHandler;
@@ -238,4 +238,4 @@ namespace OIC
     }
 }
 
-#endif // __OIC_RESOURCEOBJECT_H
+#endif // SERVERBUILDER_RESOURCEOBJECT_H
index 9c93386..c43ab6b 100644 (file)
@@ -40,7 +40,10 @@ release = env.get('RELEASE')
 ######################################################################
 # Build flags
 ######################################################################
-service_common_env.AppendUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs', 'include', 'src'])
+service_common_env.AppendUnique(CPPPATH = [
+    env.get('SRC_DIR')+'/extlibs',
+    '../../../include',
+    'include'])
 
 if target_os not in ['windows', 'winrt']:
     service_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
@@ -28,7 +28,7 @@
 #include <octypes.h>
 #include <OCException.h>
 
-#include <PrimitiveException.h>
+#include <RCSException.h>
 
 namespace OIC
 {
@@ -61,7 +61,6 @@ namespace OIC
                 typedef A type;
             };
 
-
             template< typename T, typename = typename std::enable_if<
                     std::is_class<T>::value && std::is_pointer<T>::value>::type >
             struct EnableIfClassPointer
index 5a58c06..e66d21a 100755 (executable)
@@ -20,8 +20,8 @@
 
 #include <PrimitiveResource.h>
 
-#include <internal/PrimitiveResourceImpl.h>
-#include <internal/AssertUtils.h>
+#include <PrimitiveResourceImpl.h>
+#include <AssertUtils.h>
 
 #include <OCPlatform.h>
 
@@ -18,7 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include <PrimitiveException.h>
+#include <RCSException.h>
 
 #include <OCException.h>
 
@@ -27,9 +27,29 @@ namespace OIC
     namespace Service
     {
 
+        RCSException::RCSException()
+        {
+        }
+
+        RCSException::RCSException(const std::string& what) :
+                m_what{ what }
+        {
+        }
+
+        RCSException::RCSException(std::string&& what) :
+                m_what{ std::move(what) }
+        {
+        }
+
+        const char* RCSException::what() const noexcept
+        {
+            return m_what.c_str();
+        }
+
+
         PlatformException::PlatformException(OCStackResult reason) :
-            PrimitiveException{ "Failed : " + OC::OCException::reason(reason) },
-            m_reason { reason }
+                RCSException{ "Failed : " + OC::OCException::reason(reason) },
+                m_reason { reason }
         {
         }
 
index 6572d15..b8b5739 100755 (executable)
@@ -20,8 +20,8 @@
 
 #include <ResourceAttributes.h>
 
-#include <internal/ResourceAttributesUtils.h>
-#include <internal/ResourceAttributesConverter.h>
+#include <ResourceAttributesUtils.h>
+#include <ResourceAttributesConverter.h>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/mpl/advance.hpp>
index e178475..04684e9 100644 (file)
@@ -21,8 +21,8 @@
 #include <gtest/gtest.h>
 #include <HippoMocks/hippomocks.h>
 
-#include <internal/PrimitiveResourceImpl.h>
-#include <internal/AssertUtils.h>
+#include <PrimitiveResourceImpl.h>
+#include <AssertUtils.h>
 
 #include <OCResource.h>
 #include <OCPlatform.h>
index fd81835..3fcd364 100644 (file)
@@ -19,8 +19,8 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 #include <ResourceAttributes.h>
-#include <internal/ResourceAttributesConverter.h>
-#include <internal/ResourceAttributesUtils.h>
+#include <ResourceAttributesConverter.h>
+#include <ResourceAttributesUtils.h>
 
 #include <gtest/gtest.h>
 
index 59f3035..c64412e 100644 (file)
@@ -41,7 +41,8 @@ release = env.get('RELEASE')
 # Build flags
 ######################################################################
 server_builder_env.AppendUnique(CPPPATH = [
-    '../common/primitiveResource/include/',
+    '../common/primitiveResource/include',
+    '../../include',
     ])
 
 server_builder_env.AppendUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs', 'include'])
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#ifndef __REQUESTHANDLER_H
-#define __REQUESTHANDLER_H
+#ifndef SERVERBUILDER_REQUESTHANDLER_H
+#define SERVERBUILDER_REQUESTHANDLER_H
 
 #include <ResourceObject.h>
-#include <PrimitiveResponse.h>
-
-#include <internal/ResourceAttributesUtils.h>
+#include <RCSResponse.h>
+#include <ResourceAttributesUtils.h>
 
 namespace OC
 {
@@ -36,6 +35,7 @@ namespace OIC
 {
     namespace Service
     {
+
         class RequestHandler
         {
         private:
@@ -92,11 +92,11 @@ namespace OIC
                     const OCEntityHandlerResult& result = DEFAULT_RESULT,
                     int errorCode = DEFAULT_ERROR_CODE);
 
-            AttrKeyValuePairs applyAcceptanceMethod(PrimitiveSetResponse::AcceptanceMethod,
+            AttrKeyValuePairs applyAcceptanceMethod(RCSSetResponse::AcceptanceMethod,
                     ResourceObject&, const ResourceAttributes&) const;
         };
 
     }
 }
 
-#endif // __REQUESTHANDLER_H
+#endif // SERVERBUILDER_REQUESTHANDLER_H
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include <PrimitiveRequest.h>
+#include <RCSRequest.h>
 
 namespace OIC
 {
     namespace Service
     {
 
-        PrimitiveRequest::PrimitiveRequest(const std::string& resourceUri) :
+        RCSRequest::RCSRequest(const std::string& resourceUri) :
                 m_resourceUri{ resourceUri }
         {
         }
 
-        std::string PrimitiveRequest::getResourceUri() const
+        std::string RCSRequest::getResourceUri() const
         {
             return m_resourceUri;
         }
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include <PrimitiveResponse.h>
+#include <RCSResponse.h>
 
-#include <internal/RequestHandler.h>
+#include <RequestHandler.h>
 
 namespace OIC
 {
     namespace Service
     {
-        PrimitiveGetResponse PrimitiveGetResponse::defaultAction()
+        RCSGetResponse RCSGetResponse::defaultAction()
         {
-            static PrimitiveGetResponse defaultRes { std::make_shared< RequestHandler >() };
+            static RCSGetResponse defaultRes { std::make_shared< RequestHandler >() };
 
             return defaultRes;
         }
 
-        PrimitiveGetResponse PrimitiveGetResponse::create(const OCEntityHandlerResult& result,
+        RCSGetResponse RCSGetResponse::create(const OCEntityHandlerResult& result,
                 int errorCode)
         {
-            return PrimitiveGetResponse {
+            return RCSGetResponse {
                 std::make_shared< RequestHandler >( result, errorCode) };
         }
 
-        PrimitiveGetResponse PrimitiveGetResponse::create(const ResourceAttributes& attrs)
+        RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs)
         {
-            return PrimitiveGetResponse { std::make_shared< RequestHandler >(attrs) };
+            return RCSGetResponse { std::make_shared< RequestHandler >(attrs) };
         }
 
-        PrimitiveGetResponse PrimitiveGetResponse::create(const ResourceAttributes& attrs,
+        RCSGetResponse RCSGetResponse::create(const ResourceAttributes& attrs,
                 const OCEntityHandlerResult& result, int errorCode)
         {
-            return PrimitiveGetResponse {
+            return RCSGetResponse {
                 std::make_shared< RequestHandler >(attrs, result, errorCode) };
         }
 
-        PrimitiveGetResponse PrimitiveGetResponse::create(ResourceAttributes&& result)
+        RCSGetResponse RCSGetResponse::create(ResourceAttributes&& result)
         {
-            return PrimitiveGetResponse {
+            return RCSGetResponse {
                 std::make_shared< RequestHandler >(std::move(result)) };
         }
 
-        PrimitiveGetResponse PrimitiveGetResponse::create(ResourceAttributes&& attrs,
+        RCSGetResponse RCSGetResponse::create(ResourceAttributes&& attrs,
                 const OCEntityHandlerResult& result, int errorCode)
         {
-            return PrimitiveGetResponse { std::make_shared< RequestHandler >(
+            return RCSGetResponse { std::make_shared< RequestHandler >(
                 std::move(attrs), result, errorCode) };
         }
 
-        PrimitiveGetResponse::PrimitiveGetResponse(std::shared_ptr< RequestHandler >&& handler) :
+        RCSGetResponse::RCSGetResponse(std::shared_ptr< RequestHandler >&& handler) :
                 m_handler{ std::move(handler) }
         {
             assert(m_handler);
         }
 
-        RequestHandler* PrimitiveGetResponse::getHandler() const
+        RequestHandler* RCSGetResponse::getHandler() const
         {
             return m_handler.get();
         }
 
 
-        PrimitiveSetResponse PrimitiveSetResponse::defaultAction()
+        RCSSetResponse RCSSetResponse::defaultAction()
         {
             return std::make_shared< SetRequestHandler >();
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::accept()
+        RCSSetResponse RCSSetResponse::accept()
         {
             return defaultAction().setAcceptanceMethod(AcceptanceMethod::ACCEPT);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::accept(const OCEntityHandlerResult& result,
+        RCSSetResponse RCSSetResponse::accept(const OCEntityHandlerResult& result,
                 int errorCode)
         {
             return create(result, errorCode).setAcceptanceMethod(AcceptanceMethod::ACCEPT);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::ignore()
+        RCSSetResponse RCSSetResponse::ignore()
         {
             return defaultAction().setAcceptanceMethod(AcceptanceMethod::IGNORE);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::ignore(const OCEntityHandlerResult& result,
+        RCSSetResponse RCSSetResponse::ignore(const OCEntityHandlerResult& result,
                 int errorCode)
         {
             return create(result, errorCode).setAcceptanceMethod(AcceptanceMethod::IGNORE);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::create(const OCEntityHandlerResult& result,
+        RCSSetResponse RCSSetResponse::create(const OCEntityHandlerResult& result,
                 int errorCode)
         {
             return std::make_shared< SetRequestHandler >(result, errorCode);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::create(const ResourceAttributes& attrs)
+        RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs)
         {
             return std::make_shared< SetRequestHandler >(attrs);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::create(const ResourceAttributes& attrs,
+        RCSSetResponse RCSSetResponse::create(const ResourceAttributes& attrs,
                 const OCEntityHandlerResult& result, int errorCode)
         {
             return std::make_shared< SetRequestHandler >(attrs, result, errorCode);
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::create(ResourceAttributes&& result)
+        RCSSetResponse RCSSetResponse::create(ResourceAttributes&& result)
         {
             return std::make_shared< SetRequestHandler >(std::move(result));
         }
 
-        PrimitiveSetResponse PrimitiveSetResponse::create(ResourceAttributes&& attrs,
+        RCSSetResponse RCSSetResponse::create(ResourceAttributes&& attrs,
                 const OCEntityHandlerResult& result, int errorCode)
         {
             return std::make_shared< SetRequestHandler >(std::move(attrs), result, errorCode);
         }
 
-        PrimitiveSetResponse::PrimitiveSetResponse(std::shared_ptr< SetRequestHandler >&& handler) :
+        RCSSetResponse::RCSSetResponse(std::shared_ptr< SetRequestHandler >&& handler) :
                 m_acceptanceMethod { AcceptanceMethod::DEFAULT },
                 m_handler{ std::move(handler) }
         {
         }
 
-        PrimitiveSetResponse::PrimitiveSetResponse(std::shared_ptr< SetRequestHandler >&& handler,
+        RCSSetResponse::RCSSetResponse(std::shared_ptr< SetRequestHandler >&& handler,
                 AcceptanceMethod method) :
                 m_acceptanceMethod{ method },
                 m_handler{ std::move(handler) }
@@ -146,17 +146,17 @@ namespace OIC
             assert(m_handler);
         }
 
-        SetRequestHandler* PrimitiveSetResponse::getHandler() const
+        SetRequestHandler* RCSSetResponse::getHandler() const
         {
             return m_handler.get();
         }
 
-        auto PrimitiveSetResponse::getAcceptanceMethod() const -> AcceptanceMethod
+        auto RCSSetResponse::getAcceptanceMethod() const -> AcceptanceMethod
         {
             return m_acceptanceMethod;
         }
 
-        PrimitiveSetResponse& PrimitiveSetResponse::setAcceptanceMethod(AcceptanceMethod method)
+        RCSSetResponse& RCSSetResponse::setAcceptanceMethod(AcceptanceMethod method)
         {
             m_acceptanceMethod = method;
             return *this;
index e6b38ad..20d9964 100755 (executable)
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include <internal/RequestHandler.h>
-
-#include <internal/ResourceAttributesConverter.h>
+#include <RequestHandler.h>
 
 #include <OCResourceResponse.h>
+#include <ResourceAttributesConverter.h>
 
 namespace
 {
@@ -87,18 +86,18 @@ namespace
         return AttrKeyValuePairs();
     }
 
-    auto getApplyAcceptanceFunc(PrimitiveSetResponse::AcceptanceMethod method) ->
+    auto getApplyAcceptanceFunc(RCSSetResponse::AcceptanceMethod method) ->
             std::function<AttrKeyValuePairs(ResourceObject&, const ResourceAttributes&)>
     {
         switch (method)
         {
-            case PrimitiveSetResponse::AcceptanceMethod::DEFAULT:
+            case RCSSetResponse::AcceptanceMethod::DEFAULT:
                 return applyDefaultMethod;
 
-            case PrimitiveSetResponse::AcceptanceMethod::ACCEPT:
+            case RCSSetResponse::AcceptanceMethod::ACCEPT:
                 return applyAcceptMethod;
 
-            case PrimitiveSetResponse::AcceptanceMethod::IGNORE:
+            case RCSSetResponse::AcceptanceMethod::IGNORE:
                 return applyIgnoreMethod;
         }
 
@@ -171,7 +170,7 @@ namespace OIC
         }
 
         AttrKeyValuePairs SetRequestHandler::applyAcceptanceMethod(
-                PrimitiveSetResponse::AcceptanceMethod method, ResourceObject& resource,
+                RCSSetResponse::AcceptanceMethod method, ResourceObject& resource,
                 const ResourceAttributes& requestAttrs) const
         {
             return getApplyAcceptanceFunc(method)(resource, requestAttrs);
index 60ad8c3..cb4e841 100755 (executable)
@@ -24,9 +24,9 @@
 #include <functional>
 #include <vector>
 
-#include <internal/RequestHandler.h>
-#include <internal/AssertUtils.h>
-#include <internal/ResourceAttributesConverter.h>
+#include <RequestHandler.h>
+#include <AssertUtils.h>
+#include <ResourceAttributesConverter.h>
 
 #include <logger.h>
 #include <OCPlatform.h>
@@ -35,7 +35,7 @@ namespace
 {
     using namespace OIC::Service;
 
-    constexpr char LOG_TAG[]{ "PrimitiveServerResource" };
+    constexpr char LOG_TAG[]{ "ResourceObject" };
 
     inline bool hasProperty(uint8_t base, uint8_t target)
     {
@@ -87,7 +87,7 @@ namespace
     {
         if (handler)
         {
-            return handler(PrimitiveRequest{ ocRequest->getResourceUri() }, attrs);
+            return handler(RCSRequest{ ocRequest->getResourceUri() }, attrs);
         }
 
         return RESPONSE::defaultAction();
 #include <gtest/gtest.h>
 #include <HippoMocks/hippomocks.h>
 
-#include <PrimitiveResponse.h>
+#include <RCSResponse.h>
 #include <ResourceObject.h>
 
-#include <internal/RequestHandler.h>
-#include <internal/ResourceAttributesConverter.h>
+#include <RequestHandler.h>
+#include <ResourceAttributesConverter.h>
 
 #include <OCPlatform.h>
 
@@ -56,7 +56,7 @@ void EXPECT_RESPONSE(shared_ptr< OCResourceResponse > ocResponse,
 }
 
 
-class PrimitiveResponseTest: public Test
+class RCSResponseTest: public Test
 {
 public:
     MockRepository mocks;
@@ -81,23 +81,23 @@ protected:
     }
 };
 
-TEST_F(PrimitiveResponseTest, GetDefaultActionHasEmptyAttrs)
+TEST_F(RCSResponseTest, GetDefaultActionHasEmptyAttrs)
 {
-    EXPECT_RESPONSE(buildResponse(PrimitiveGetResponse::defaultAction()),
+    EXPECT_RESPONSE(buildResponse(RCSGetResponse::defaultAction()),
             RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE,
             ResourceAttributes());
 }
 
-TEST_F(PrimitiveResponseTest, GetResponseHasResultsPassedCodes)
+TEST_F(RCSResponseTest, GetResponseHasResultsPassedCodes)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
 
-    EXPECT_RESPONSE(buildResponse(PrimitiveGetResponse::create(result, errorCode)),
+    EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(result, errorCode)),
             result, errorCode, ResourceAttributes());
 }
 
-TEST_F(PrimitiveResponseTest, GetResponseHasAttrsAndResultsPassedCodes)
+TEST_F(RCSResponseTest, GetResponseHasAttrsAndResultsPassedCodes)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
@@ -105,11 +105,11 @@ TEST_F(PrimitiveResponseTest, GetResponseHasAttrsAndResultsPassedCodes)
     ResourceAttributes attrs;
     attrs[KEY] = 100;
 
-    EXPECT_RESPONSE(buildResponse(PrimitiveGetResponse::create(attrs, result, errorCode)),
+    EXPECT_RESPONSE(buildResponse(RCSGetResponse::create(attrs, result, errorCode)),
             result, errorCode, attrs);
 }
 
-TEST_F(PrimitiveResponseTest, GetResponseCanMoveAttrs)
+TEST_F(RCSResponseTest, GetResponseCanMoveAttrs)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
@@ -121,29 +121,29 @@ TEST_F(PrimitiveResponseTest, GetResponseCanMoveAttrs)
     attrsClone[KEY] = 100;
 
     EXPECT_RESPONSE(
-            buildResponse(PrimitiveGetResponse::create(std::move(attrs), result, errorCode)),
+            buildResponse(RCSGetResponse::create(std::move(attrs), result, errorCode)),
             result, errorCode, attrsClone);
 
     EXPECT_TRUE(attrs.empty());
 }
 
-TEST_F(PrimitiveResponseTest, SetDefaultActionHasEmptyAttrs)
+TEST_F(RCSResponseTest, SetDefaultActionHasEmptyAttrs)
 {
-    EXPECT_RESPONSE(buildResponse(PrimitiveSetResponse::defaultAction()),
+    EXPECT_RESPONSE(buildResponse(RCSSetResponse::defaultAction()),
             RequestHandler::DEFAULT_RESULT, RequestHandler::DEFAULT_ERROR_CODE,
             ResourceAttributes());
 }
 
-TEST_F(PrimitiveResponseTest, SetResponseHasResultsPassedCodes)
+TEST_F(RCSResponseTest, SetResponseHasResultsPassedCodes)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
 
-    EXPECT_RESPONSE(buildResponse(PrimitiveSetResponse::create(result, errorCode)),
+    EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(result, errorCode)),
             result, errorCode, ResourceAttributes());
 }
 
-TEST_F(PrimitiveResponseTest, SetResponseHasAttrsAndResultsPassedCodes)
+TEST_F(RCSResponseTest, SetResponseHasAttrsAndResultsPassedCodes)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
@@ -151,11 +151,11 @@ TEST_F(PrimitiveResponseTest, SetResponseHasAttrsAndResultsPassedCodes)
     ResourceAttributes attrs;
     attrs[KEY] = 100;
 
-    EXPECT_RESPONSE(buildResponse(PrimitiveSetResponse::create(attrs, result, errorCode)),
+    EXPECT_RESPONSE(buildResponse(RCSSetResponse::create(attrs, result, errorCode)),
             result, errorCode, attrs);
 }
 
-TEST_F(PrimitiveResponseTest, SetResponseCanMoveAttrs)
+TEST_F(RCSResponseTest, SetResponseCanMoveAttrs)
 {
     constexpr OCEntityHandlerResult result{ OC_EH_ERROR };
     constexpr int errorCode{ -10 };
@@ -167,36 +167,36 @@ TEST_F(PrimitiveResponseTest, SetResponseCanMoveAttrs)
     attrsClone[KEY] = 100;
 
     EXPECT_RESPONSE(
-            buildResponse(PrimitiveSetResponse::create(std::move(attrs), result, errorCode)),
+            buildResponse(RCSSetResponse::create(std::move(attrs), result, errorCode)),
             result, errorCode, attrsClone);
 
     EXPECT_TRUE(attrs.empty());
 }
 
 
-TEST_F(PrimitiveResponseTest, DefaultSetResponseHasDefaultMethod)
+TEST_F(RCSResponseTest, DefaultSetResponseHasDefaultMethod)
 {
-    EXPECT_EQ(PrimitiveSetResponse::AcceptanceMethod::DEFAULT,
-            PrimitiveSetResponse::defaultAction().getAcceptanceMethod());
+    EXPECT_EQ(RCSSetResponse::AcceptanceMethod::DEFAULT,
+            RCSSetResponse::defaultAction().getAcceptanceMethod());
 }
 
-TEST_F(PrimitiveResponseTest, AcceptSetResponseHasAcceptMethod)
+TEST_F(RCSResponseTest, AcceptSetResponseHasAcceptMethod)
 {
-    EXPECT_EQ(PrimitiveSetResponse::AcceptanceMethod::ACCEPT,
-            PrimitiveSetResponse::accept().getAcceptanceMethod());
+    EXPECT_EQ(RCSSetResponse::AcceptanceMethod::ACCEPT,
+            RCSSetResponse::accept().getAcceptanceMethod());
 }
 
-TEST_F(PrimitiveResponseTest, IgnoreSetResponseHasIgnoreMethod)
+TEST_F(RCSResponseTest, IgnoreSetResponseHasIgnoreMethod)
 {
-    EXPECT_EQ(PrimitiveSetResponse::AcceptanceMethod::IGNORE,
-            PrimitiveSetResponse::ignore().getAcceptanceMethod());
+    EXPECT_EQ(RCSSetResponse::AcceptanceMethod::IGNORE,
+            RCSSetResponse::ignore().getAcceptanceMethod());
 }
 
-TEST_F(PrimitiveResponseTest, SetResponseHasMethodSetBySetter)
+TEST_F(RCSResponseTest, SetResponseHasMethodSetBySetter)
 {
-    PrimitiveSetResponse::AcceptanceMethod method = PrimitiveSetResponse::AcceptanceMethod::ACCEPT;
-    PrimitiveSetResponse response =
-            PrimitiveSetResponse::defaultAction().setAcceptanceMethod(method);
+    RCSSetResponse::AcceptanceMethod method = RCSSetResponse::AcceptanceMethod::ACCEPT;
+    RCSSetResponse response =
+            RCSSetResponse::defaultAction().setAcceptanceMethod(method);
 
     EXPECT_EQ(method, response.getAcceptanceMethod());
 }
index 1055dbf..f83a4e5 100644 (file)
@@ -21,7 +21,7 @@
 #include <gtest/gtest.h>
 #include <HippoMocks/hippomocks.h>
 
-#include <internal/RequestHandler.h>
+#include <RequestHandler.h>
 
 #include <OCPlatform.h>
 
@@ -116,7 +116,7 @@ protected:
 TEST_F(SetRequestHandlerAcceptanceTest, NothingReplacedWithIgnoreMethod)
 {
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-            PrimitiveSetResponse::AcceptanceMethod::IGNORE, *server, requestAttrs);
+            RCSSetResponse::AcceptanceMethod::IGNORE, *server, requestAttrs);
 
     ASSERT_TRUE(replaced.empty());
 }
@@ -125,7 +125,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, NothingReplacedWithIgnoreMethod)
 TEST_F(SetRequestHandlerAcceptanceTest, NewValueApplyedWithAcceptMethod)
 {
     setRequestHandler->applyAcceptanceMethod(
-            PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
+            RCSSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
 
     ASSERT_EQ(NEW_VALUE, server->getAttribute<int>(EXISTING));
 }
@@ -133,7 +133,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, NewValueApplyedWithAcceptMethod)
 TEST_F(SetRequestHandlerAcceptanceTest, ReturnedAttrPairsHaveOldValue)
 {
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-            PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
+            RCSSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
 
     ASSERT_EQ(ORIGIN_VALUE, replaced[0].second);
 }
@@ -141,7 +141,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, ReturnedAttrPairsHaveOldValue)
 TEST_F(SetRequestHandlerAcceptanceTest, NothingHappenedWithEmptyAttrs)
 {
     setRequestHandler->applyAcceptanceMethod(
-            PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, ResourceAttributes{ });
+            RCSSetResponse::AcceptanceMethod::ACCEPT, *server, ResourceAttributes{ });
 
     ASSERT_EQ(ORIGIN_VALUE, server->getAttribute<int>(EXISTING));
 }
@@ -151,7 +151,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, EverythingAppliedIfMethodIsAccept)
     requestAttrs[EXISTING] = "";
 
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-             PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
+             RCSSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
 
      ASSERT_EQ(ORIGIN_VALUE, replaced[0].second);
 }
@@ -162,7 +162,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, NoReplaceIfMethodIsDefaultAndTypeMismatc
     requestAttrs[EXISTING] = "";
 
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-             PrimitiveSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
+             RCSSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
 
      ASSERT_TRUE(replaced.empty());
 }
@@ -176,7 +176,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, NoReplacefMethodIsDefaultAndRequestAttrs
 
 
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-             PrimitiveSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
+             RCSSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
 
      ASSERT_TRUE(replaced.empty());
 }
index add5323..efacf15 100755 (executable)
@@ -296,11 +296,10 @@ public:
 
         mc.addRepresentation(ocRep);
 
-        string json = mc.getJSONRepresentation(OCInfoFormat::IncludeOC);
         ocEntityHandlerRequest.requestHandle = fakeRequestHandle;
         ocEntityHandlerRequest.resource = fakeResourceHandle;
         ocEntityHandlerRequest.method = method;
-        ocEntityHandlerRequest.reqJSONPayload = &json[0];
+        ocEntityHandlerRequest.payload = reinterpret_cast<OCPayload*>(mc.getPayload());
 
         formResourceRequest(OC_REQUEST_FLAG, &ocEntityHandlerRequest, request);
 
@@ -352,15 +351,15 @@ TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithSameHandlesPassedByReq
     ASSERT_EQ(OC_EH_OK, handler(createRequest()));
 }
 
-TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithPrimitiveResponseResults)
+TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithRCSResponseResults)
 {
     constexpr int errorCode{ 1999 };
     constexpr OCEntityHandlerResult result{ OC_EH_SLOW };
 
     server->setGetRequestHandler(
-            [](const PrimitiveRequest&, ResourceAttributes&) -> PrimitiveGetResponse
+            [](const RCSRequest&, ResourceAttributes&) -> RCSGetResponse
             {
-                return PrimitiveGetResponse::create(result, errorCode);
+                return RCSGetResponse::create(result, errorCode);
             }
     );
 
@@ -382,11 +381,11 @@ TEST_F(ResourceObjectHandlingRequestTest, SendSetResponseWithCustomAttrsAndResul
     constexpr char value[]{ "value" };
 
     server->setSetRequestHandler(
-            [](const PrimitiveRequest&, ResourceAttributes&) -> PrimitiveSetResponse
+            [](const RCSRequest&, ResourceAttributes&) -> RCSSetResponse
             {
                 ResourceAttributes attrs;
                 attrs[KEY] = value;
-                return PrimitiveSetResponse::create(attrs, result, errorCode);
+                return RCSSetResponse::create(attrs, result, errorCode);
             }
     );