From 5c9d5ccdf6ba191a9852e5e6c9ebed6adf8a63bb Mon Sep 17 00:00:00 2001 From: Jay Sharma Date: Wed, 22 Jul 2015 20:58:54 +0530 Subject: [PATCH] [Resource Manipulation] Integrated Resource Manipulation libraries into 4 categories - rcs_server - rcs_client - rcs_common - rcs_container Change-Id: I262b7e9c57c48530e2128d14545c335c6a098223 Signed-off-by: Jay Sharma Reviewed-on: https://gerrit.iotivity.org/gerrit/1814 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- service/notification-manager/SConscript | 9 +- .../SampleApp/linux/SConscript | 9 +- service/resource-manipulation/SConscript | 42 ++++--- .../examples/linux/SConscript | 6 +- .../resource-manipulation/src/common/SConscript | 97 ++++++++++++++++- .../src/common/expiryTimer/SConscript | 71 ------------ .../src/common/primitiveResource/SConscript | 103 ------------------ .../src/resourceBroker/SConscript | 121 --------------------- .../unittest}/SConscript | 54 ++++----- .../src/resourceCache/unittests/SConscript | 12 +- .../src/resourceContainer/SConscript | 14 +-- .../src/resourceContainer/unittests/SConscript | 6 +- .../src/serverBuilder/SConscript | 13 ++- .../unittests/ResourceClient_Test.cpp | 34 +++--- service/resource-manipulation/unittests/SConscript | 2 +- 15 files changed, 192 insertions(+), 401 deletions(-) delete mode 100644 service/resource-manipulation/src/common/expiryTimer/SConscript delete mode 100644 service/resource-manipulation/src/common/primitiveResource/SConscript delete mode 100755 service/resource-manipulation/src/resourceBroker/SConscript rename service/resource-manipulation/src/{resourceCache => resourceBroker/unittest}/SConscript (51%) diff --git a/service/notification-manager/SConscript b/service/notification-manager/SConscript index 3255bfa..e6c08ff 100644 --- a/service/notification-manager/SConscript +++ b/service/notification-manager/SConscript @@ -52,12 +52,9 @@ notimgr_env.AppendUnique(CPPPATH = ['../resource-manipulation/src/common/expiryT #notimgr_env.AppendUnique(CPPPATH = ['../../extlibs/cjson']) #notimgr_env.AppendUnique(CPPPATH = ['../../resource/csdk/logger/include']) notimgr_env.PrependUnique(LIBS = [ - 'ResourceClient', - 'ResourceCache', - 'ResourceBroker', - 'ExpiryTimer', - 'server_builder', - 'service_common', + 'rcs_client', + 'rcs_server', + 'rcs_common', 'oc', 'octbstack', 'oc_logger', diff --git a/service/notification-manager/SampleApp/linux/SConscript b/service/notification-manager/SampleApp/linux/SConscript index 573ccb3..772c7d8 100644 --- a/service/notification-manager/SampleApp/linux/SConscript +++ b/service/notification-manager/SampleApp/linux/SConscript @@ -18,12 +18,9 @@ notimgr_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', notimgr_sample_env = notimgr_env.Clone() notimgr_env.AppendUnique(LIBS = [ 'NotificationManager', - 'ResourceClient', - 'ResourceCache', - 'ResourceBroker', - 'ExpiryTimer', - 'server_builder', - 'service_common', + 'rcs_client', + 'rcs_server', + 'rcs_common', 'oc', 'octbstack', 'oc_logger', diff --git a/service/resource-manipulation/SConscript b/service/resource-manipulation/SConscript index b0e8056..e3c69ff 100644 --- a/service/resource-manipulation/SConscript +++ b/service/resource-manipulation/SConscript @@ -22,17 +22,14 @@ # Resource-manipulation build script ###################################################################### import platform - Import('env') SConscript('src/common/SConscript') -SConscript('src/resourceBroker/SConscript') -SConscript('src/resourceCache/SConscript') SConscript('src/serverBuilder/SConscript') SConscript('src/resourceContainer/SConscript') ###################################################################### -#building Resource client +#building Resource client, resourceBroker and resourceCache ###################################################################### if env.get('RELEASE'): @@ -50,34 +47,47 @@ SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') resourceClient_env = lib_env.Clone() target_os = env.get('TARGET_OS') + ###################################################################### # Build flags ###################################################################### resourceClient_env.AppendUnique(CPPPATH = ['include']) resourceClient_env.AppendUnique(CPPPATH = ['src/common/primitiveResource/include']) resourceClient_env.AppendUnique(CPPPATH = ['src/common/expiryTimer/include']) +resourceClient_env.AppendUnique(CPPPATH = ['src/common/expiryTimer/src']) resourceClient_env.AppendUnique(CPPPATH = ['src/resourceBroker/include']) resourceClient_env.AppendUnique(CPPPATH = ['src/resourceCache/include']) - -resourceClient_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) - -resourceClient_env.PrependUnique(LIBS = ['oc', 'service_common', 'ResourceBroker' , 'ResourceCache', 'octbstack', 'gnustl_shared','oc_logger', 'compatibility', 'log']) - +resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack', 'gnustl_shared','oc_logger', 'compatibility', 'log']) if target_os not in ['windows', 'winrt']: resourceClient_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) if target_os == 'linux': resourceClient_env.AppendUnique(LIBS = ['pthread']) + +if target_os == 'android': + resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) + resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log']) + +resourceClient_env.AppendUnique(LIBS = ['dl']) ###################################################################### # Source files and Targets ###################################################################### -resourceClient_src = 'src/' +BROKER_SRC_DIR = 'src/resourceBroker/src/' +CACHE_SRC_DIR = 'src/resourceCache/src/' +RESOURCECLIENT_DIR = 'src/' client_src = [ - resourceClient_src+ 'ResourceClient.cpp'] -ResourceClientsdk = resourceClient_env.StaticLibrary('ResourceClient', client_src) -resourceClient_env.InstallTarget(ResourceClientsdk , 'libResourceClient') + BROKER_SRC_DIR + 'DeviceAssociation.cpp', + BROKER_SRC_DIR + 'DevicePresence.cpp', + BROKER_SRC_DIR + 'ResourcePresence.cpp', + BROKER_SRC_DIR + 'ResourceBroker.cpp', + CACHE_SRC_DIR + 'DataCache.cpp', + CACHE_SRC_DIR + 'ResourceCacheManager.cpp', + RESOURCECLIENT_DIR + 'ResourceClient.cpp' + ] +ResourceClientsdk = resourceClient_env.StaticLibrary('rcs_client', client_src) +resourceClient_env.InstallTarget(ResourceClientsdk , 'librcs_client') ###################################################################### # Build Sample App: SampleResourceClient & SampleResourceServer @@ -85,7 +95,9 @@ resourceClient_env.InstallTarget(ResourceClientsdk , 'libResourceClient') SConscript('examples/SConscript') ###################################################################### -# Build UnitTests Resource Client +# Build UnitTests Resource Client , resourceCache and resourceBroker ################################################ ###################### -#SConscript('unittests/SConscript') +SConscript('unittests/SConscript') +SConscript('src/resourceCache/unittests/SConscript') +SConscript('src/resourceBroker/unittest/SConscript') diff --git a/service/resource-manipulation/examples/linux/SConscript b/service/resource-manipulation/examples/linux/SConscript index 6c5a98d..0031212 100644 --- a/service/resource-manipulation/examples/linux/SConscript +++ b/service/resource-manipulation/examples/linux/SConscript @@ -35,20 +35,18 @@ ResourceServer_env = lib_env.Clone() ###################################################################### ResourceClient_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) -ResourceClient_env.AppendUnique(LIBS = ['ResourceClient','ResourceCache', 'ResourceBroker', 'ExpiryTimer','service_common','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'pthread']) +ResourceClient_env.AppendUnique(LIBS = ['rcs_client', 'rcs_common','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'pthread']) ResourceClient_env.AppendUnique(CPPPATH = ['../../include']) ResourceClient_env.AppendUnique(CPPPATH = ['../../src/resourceBroker/include']) ResourceClient_env.AppendUnique(CPPPATH = ['../../src/resourceCache/include']) ResourceClient_env.AppendUnique(CPPPATH = ['../../src/common/primitiveResource/include']) - - ###################################################################### # ##### Resource Server ##### ###################################################################### ResourceServer_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) -ResourceServer_env.AppendUnique(LIBS = ['libserver_builder', 'libservice_common','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'pthread']) +ResourceServer_env.AppendUnique(LIBS = ['rcs_server', 'rcs_common','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'pthread']) ResourceServer_env.AppendUnique(CPPPATH = ['../../include']) ResourceServer_env.AppendUnique(CPPPATH = ['../../src/common/primitiveResource/include']) ResourceServer_env.AppendUnique(CPPPATH = ['../../src/serverBuilder/include']) diff --git a/service/resource-manipulation/src/common/SConscript b/service/resource-manipulation/src/common/SConscript index 7f07604..4799686 100644 --- a/service/resource-manipulation/src/common/SConscript +++ b/service/resource-manipulation/src/common/SConscript @@ -19,13 +19,100 @@ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -# basis build script +# rcs_common (primitiveResource and expiryTimer) build script ## -import platform - +import os Import('env') -SConscript('primitiveResource/SConscript') -SConscript('expiryTimer/SConscript') +# Add third party libraries +lib_env = env.Clone() +SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env') + +src_dir = lib_env.get('SRC_DIR') + +gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0' + +rcs_common_env = lib_env.Clone() +target_os = env.get('TARGET_OS') + +release = env.get('RELEASE') + +###################################################################### +# Build flags +###################################################################### +rcs_common_env.AppendUnique(CPPPATH = [ + env.get('SRC_DIR')+'/extlibs', + '../../include', + 'primitiveResource/include']) + +rcs_common_env.AppendUnique(CPPPATH = [ + 'expiryTimer/include', + 'expiryTimer/src']) + +if target_os not in ['windows', 'winrt']: + rcs_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall']) + if target_os != 'android': + rcs_common_env.AppendUnique(CXXFLAGS = ['-pthread']) + +if target_os == 'android': + rcs_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) + rcs_common_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log']) + +rcs_common_env.AppendUnique(LIBS = ['dl']) + +if not release: + rcs_common_env.AppendUnique(CXXFLAGS = ['--coverage']) + rcs_common_env.PrependUnique(LIBS = ['gcov']) + +###################################################################### +# Source files and Targets +###################################################################### +TIMER_SRC_DIR = 'expiryTimer/src/' +RESOURCE_SRC = 'primitiveResource/src/' +rcs_common_src = [ + TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp', + TIMER_SRC_DIR + 'ExpiryTimer.cpp', + RESOURCE_SRC + 'PresenceSubscriber.cpp', + RESOURCE_SRC + 'PrimitiveResource.cpp', + RESOURCE_SRC + 'RCSException.cpp', + RESOURCE_SRC + 'RCSAddress.cpp', + RESOURCE_SRC + 'ResourceAttributes.cpp', + RESOURCE_SRC + 'ResponseStatement.cpp' + ] + +rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src) +rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src) +rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common') + +###################################################################### +# Build Test primitive Resource +###################################################################### +rcs_common_test_env = rcs_common_env.Clone(); + +rcs_common_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) +rcs_common_test_env.PrependUnique(CPPPATH = [ + env.get('SRC_DIR')+'/extlibs/hippomocks-master', + gtest_dir + '/include', + 'utils/include' + ]) + +gtest = File(gtest_dir + '/lib/.libs/libgtest.a') +gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a') + +rcs_common_test_env.PrependUnique(LIBS = [ + 'oc', + 'octbstack', + 'oc_logger', + 'connectivity_abstraction', + 'coap', + 'rcs_common', + gtest, + gtest_main, + 'pthread' + ]) +rcs_common_test_src = env.Glob('primitiveResource/unittests/*.cpp') +rcs_common_test = rcs_common_test_env.Program('rcs_common_test', rcs_common_test_src) +Alias("rcs_common_test", rcs_common_test) +env.AppendTarget('rcs_common_test') \ No newline at end of file diff --git a/service/resource-manipulation/src/common/expiryTimer/SConscript b/service/resource-manipulation/src/common/expiryTimer/SConscript deleted file mode 100644 index a6bb47c..0000000 --- a/service/resource-manipulation/src/common/expiryTimer/SConscript +++ /dev/null @@ -1,71 +0,0 @@ -#****************************************************************** -# -# Copyright 2015 Samsung Electronics All Rights Reserved. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -## -# ResourceCache build script -## - -Import('env') - -if env.get('RELEASE'): - env.AppendUnique(CCFLAGS = ['-Os']) - env.AppendUnique(CPPDEFINES = ['NDEBUG']) -else: - env.AppendUnique(CCFLAGS = ['-g']) - -if env.get('LOGGING'): - env.AppendUnique(CPPDEFINES = ['TB_LOG']) - -lib_env = env.Clone() -SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') -timer_env = lib_env.Clone() - -target_os = env.get('TARGET_OS') -###################################################################### -# Build flags -###################################################################### -timer_env.AppendUnique(CPPPATH = ['include']) -timer_env.AppendUnique(CPPPATH = ['src']) -timer_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap']) - -if target_os not in ['windows', 'winrt']: - timer_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) - -if target_os == 'linux': - timer_env.AppendUnique(LIBS = ['pthread']) - -###################################################################### -# Source files and Targets -###################################################################### -TIMER_SRC_DIR = 'src/' -timer_src = [ - TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp', TIMER_SRC_DIR + 'ExpiryTimer.cpp' - ] - -if target_os in ['tizen','android'] : - timersdk = timer_env.SharedLibrary('ExpiryTimer', timer_src) -else : - timersdk = timer_env.StaticLibrary('ExpiryTimer', timer_src) - -timer_env.InstallTarget(timersdk, 'libExpiryTimer') - -# Go to build sample apps -#SConscript('SampleApp/SConscript') - diff --git a/service/resource-manipulation/src/common/primitiveResource/SConscript b/service/resource-manipulation/src/common/primitiveResource/SConscript deleted file mode 100644 index cc3f398..0000000 --- a/service/resource-manipulation/src/common/primitiveResource/SConscript +++ /dev/null @@ -1,103 +0,0 @@ -#****************************************************************** -# -# Copyright 2015 Samsung Electronics All Rights Reserved. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -## -# things_manager project build script -## -import os -Import('env') - -# Add third party libraries -lib_env = env.Clone() -SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env') - -src_dir = lib_env.get('SRC_DIR') - -gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0' - -service_common_env = lib_env.Clone() -target_os = env.get('TARGET_OS') - -release = env.get('RELEASE') - -###################################################################### -# Build flags -###################################################################### -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']) - if target_os != 'android': - service_common_env.AppendUnique(CXXFLAGS = ['-pthread']) - -if target_os == 'android': - service_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) - service_common_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log']) - -service_common_env.AppendUnique(LIBS = ['dl']) - -if not release: - service_common_env.AppendUnique(CXXFLAGS = ['--coverage']) - service_common_env.PrependUnique(LIBS = ['gcov']) - -###################################################################### -# Source files and Targets -###################################################################### -service_common_src = env.Glob('src/*.cpp') -service_common_static = service_common_env.StaticLibrary('service_common', service_common_src) -service_common_shared = service_common_env.SharedLibrary('service_common', service_common_src) - -service_common_env.InstallTarget([service_common_static,service_common_shared], 'service_common') - -###################################################################### -# Build Test -###################################################################### -service_common_test_env = service_common_env.Clone(); - -service_common_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) -service_common_test_env.PrependUnique(CPPPATH = [ - env.get('SRC_DIR')+'/extlibs/hippomocks-master', - gtest_dir + '/include', - '../utils/include' - ]) - -gtest = File(gtest_dir + '/lib/.libs/libgtest.a') -gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a') - -service_common_test_env.PrependUnique(LIBS = [ - 'oc', - 'octbstack', - 'oc_logger', - 'connectivity_abstraction', - 'coap', - 'service_common', - gtest, - gtest_main, - 'pthread' - ]) - -service_common_test_src = env.Glob('unittests/*.cpp') - -service_common_test = service_common_test_env.Program('service_common_test', service_common_test_src) -Alias("service_common_test", service_common_test) -env.AppendTarget('service_common_test') diff --git a/service/resource-manipulation/src/resourceBroker/SConscript b/service/resource-manipulation/src/resourceBroker/SConscript deleted file mode 100755 index 8ba723b..0000000 --- a/service/resource-manipulation/src/resourceBroker/SConscript +++ /dev/null @@ -1,121 +0,0 @@ -#****************************************************************** -# -# Copyright 2015 Samsung Electronics All Rights Reserved. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -## -# ResourceBroker build script -## - -Import('env') - -if env.get('RELEASE'): - env.AppendUnique(CCFLAGS = ['-Os']) - env.AppendUnique(CPPDEFINES = ['NDEBUG']) -else: - env.AppendUnique(CCFLAGS = ['-g']) - -if env.get('LOGGING'): - env.AppendUnique(CPPDEFINES = ['TB_LOG']) - -lib_env = env.Clone() -SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') -######################### unit test setting ########################## -src_dir = lib_env.get('SRC_DIR') -gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0' -###################################################################### -resourcebroker_env = lib_env.Clone() - -target_os = env.get('TARGET_OS') -###################################################################### -# Build flags -###################################################################### -resourcebroker_env.AppendUnique(CPPPATH = ['include']) -resourcebroker_env.AppendUnique(CPPPATH = ['../../include']) -resourcebroker_env.AppendUnique(CPPPATH = ['../common/primitiveResource/include']) -resourcebroker_env.AppendUnique(CPPPATH = ['../common/expiryTimer/include']) -resourcebroker_env.AppendUnique(CPPPATH = ['../common/expiryTimer/src']) -resourcebroker_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) -resourcebroker_env.PrependUnique(LIBS = ['service_common', 'ExpiryTimer', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap']) - - -if target_os not in ['windows', 'winrt']: - resourcebroker_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) - -if target_os == 'linux': - resourcebroker_env.AppendUnique(LIBS = ['pthread']) - -###################################################################### -# Source files and Targets -###################################################################### -BROKER_SRC_DIR = 'src/' -resourcebroker_src = [ - BROKER_SRC_DIR + 'DeviceAssociation.cpp', - BROKER_SRC_DIR + 'DevicePresence.cpp', - BROKER_SRC_DIR + 'ResourcePresence.cpp', - BROKER_SRC_DIR + 'ResourceBroker.cpp' - ] - - -if target_os in ['tizen','android'] : - resourcebrokersdk = resourcebroker_env.SharedLibrary('ResourceBroker', resourcebroker_src) -else : - resourcebrokersdk = resourcebroker_env.StaticLibrary('ResourceBroker', resourcebroker_src) - -resourcebroker_env.InstallTarget(resourcebrokersdk, 'libResouceBroker') -resourcebroker_env.UserInstallTargetLib(resourcebrokersdk, 'libResouceBroker') -###################################################################### -# Build Test -###################################################################### - -broker_test_env = resourcebroker_env.Clone(); - -broker_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) -broker_test_env.AppendUnique(CCFLAGS = ['-Wnoexcept']) -broker_test_env.PrependUnique(CPPPATH = [ - env.get('SRC_DIR')+'/extlibs/hippomocks-master', - gtest_dir + '/include' - ]) - -gtest = File(gtest_dir + '/lib/.libs/libgtest.a') -gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a') - -broker_test_env.PrependUnique(LIBS = [ - 'oc', - 'octbstack', - 'oc_logger', - 'connectivity_abstraction', - 'coap', - 'service_common', - 'pthread', - 'ResourceBroker', - 'ExpiryTimer', - gtest, - gtest_main - ]) - -broker_test_src = env.Glob('unittest/*.cpp') -broker_test = broker_test_env.Program('broker_test', broker_test_src) -Alias("broker_test", broker_test) -env.AppendTarget('broker_test') - -###################################################################### -# Go to build sample apps -#SConscript('SampleApp/SConscript') - - diff --git a/service/resource-manipulation/src/resourceCache/SConscript b/service/resource-manipulation/src/resourceBroker/unittest/SConscript similarity index 51% rename from service/resource-manipulation/src/resourceCache/SConscript rename to service/resource-manipulation/src/resourceBroker/unittest/SConscript index 6593940..8a862b6 100644 --- a/service/resource-manipulation/src/resourceCache/SConscript +++ b/service/resource-manipulation/src/resourceBroker/unittest/SConscript @@ -19,7 +19,7 @@ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -# ResourceCache build script +# ResourceBroker Unit Test build script ## Import('env') @@ -35,45 +35,45 @@ if env.get('LOGGING'): lib_env = env.Clone() SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') -resourcecache_env = lib_env.Clone() +###################################################################### +#unit test setting +###################################################################### +src_dir = lib_env.get('SRC_DIR') +gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0' + +broker_test_env = lib_env.Clone() target_os = env.get('TARGET_OS') ###################################################################### # Build flags ###################################################################### - -resourcecache_env.AppendUnique(CPPPATH = ['include']) -resourcecache_env.AppendUnique(CPPPATH = ['../../include']) -resourcecache_env.AppendUnique(CPPPATH = ['../common/primitiveResource/include']) -resourcecache_env.AppendUnique(CPPPATH = ['../common/expiryTimer/include']) -resourcecache_env.AppendUnique(CPPPATH = ['../common/expiryTimer/src']) -resourcecache_env.PrependUnique(LIBS = ['service_common', 'ExpiryTimer', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap']) - +gtest = File(gtest_dir + '/lib/.libs/libgtest.a') +gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a') + +broker_test_env.AppendUnique(CPPPATH = ['../include']) +broker_test_env.AppendUnique(CPPPATH = ['../../../include']) +broker_test_env.AppendUnique(CPPPATH = ['../../common/primitiveResource/include']) +broker_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/include']) +broker_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/src']) +broker_test_env.PrependUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/hippomocks-master', + gtest_dir + '/include']) +broker_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) +broker_test_env.PrependUnique(LIBS = ['rcs_client','rcs_common', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap', gtest, gtest_main]) if target_os not in ['windows', 'winrt']: - resourcecache_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) + broker_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) if target_os == 'linux': - resourcecache_env.AppendUnique(LIBS = ['pthread']) + broker_test_env.AppendUnique(LIBS = ['pthread']) ###################################################################### -# Source files and Targets +# Build Test ###################################################################### -CACHE_SRC_DIR = 'src/' -resourcecache_src = [ - CACHE_SRC_DIR + 'DataCache.cpp', - CACHE_SRC_DIR + 'ResourceCacheManager.cpp' - ] - -resourcecachesdk = resourcecache_env.StaticLibrary('ResourceCache', resourcecache_src) - -resourcecache_env.InstallTarget(resourcecachesdk, 'libResouceCache') -resourcecache_env.UserInstallTargetLib(resourcecachesdk, 'libResouceCache') -# Go to build sample apps -#SConscript('SampleApp/SConscript') +broker_test_src = env.Glob('./*.cpp') +broker_test = broker_test_env.Program('broker_test', broker_test_src) +Alias("broker_test", broker_test) +env.AppendTarget('broker_test') -# Go to Unit Test -SConscript('unittests/SConscript') diff --git a/service/resource-manipulation/src/resourceCache/unittests/SConscript b/service/resource-manipulation/src/resourceCache/unittests/SConscript index a7a8933..43397f7 100644 --- a/service/resource-manipulation/src/resourceCache/unittests/SConscript +++ b/service/resource-manipulation/src/resourceCache/unittests/SConscript @@ -36,13 +36,13 @@ if env.get('LOGGING'): lib_env = env.Clone() SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') -######################### unit test setting ########################## +###################################################################### +# unit test setting +###################################################################### src_dir = lib_env.get('SRC_DIR') gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0' -###################################################################### cache_test_env = lib_env.Clone() - target_os = env.get('TARGET_OS') ###################################################################### @@ -59,8 +59,7 @@ cache_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/src']) cache_test_env.PrependUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/hippomocks-master', gtest_dir + '/include']) cache_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) -cache_test_env.PrependUnique(LIBS = ['ResourceCache', 'service_common', 'ExpiryTimer', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', gtest, gtest_main]) - +cache_test_env.PrependUnique(LIBS = ['rcs_client', 'rcs_common', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', gtest, gtest_main]) if target_os not in ['windows', 'winrt']: cache_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x']) @@ -72,10 +71,7 @@ if target_os == 'linux': ###################################################################### # Build Test ###################################################################### - - cache_test_src = env.Glob('./*.cpp') - cache_test = cache_test_env.Program('cache_test', cache_test_src) Alias("cache_test", cache_test) env.AppendTarget('cache_test') diff --git a/service/resource-manipulation/src/resourceContainer/SConscript b/service/resource-manipulation/src/resourceContainer/SConscript index f8c6014..4e23751 100644 --- a/service/resource-manipulation/src/resourceContainer/SConscript +++ b/service/resource-manipulation/src/resourceContainer/SConscript @@ -95,7 +95,7 @@ except KeyError: print '' -resource_container_env.PrependUnique(LIBS = ['server_builder', 'service_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction']) +resource_container_env.PrependUnique(LIBS = ['rcs_server', 'rcs_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction']) resource_container_env.AppendUnique(LIBS = ['dl']) try: @@ -112,8 +112,8 @@ res_container_src = ['src/BaseActivator.cpp','src/BundleActivator.cpp','src/Bund 'src/ProtocolBridgeConnector.cpp', 'src/ResourceContainer.cpp', 'src/ResourceContainerBundleAPI.cpp', 'src/ResourceContainerImpl.cpp', 'src/SoftSensorResource.cpp'] -res_container_static = resource_container_env.StaticLibrary('ResContainerLib', res_container_src) -res_container_shared = resource_container_env.SharedLibrary('ResContainerLib', res_container_src) +res_container_static = resource_container_env.StaticLibrary('rcs_container', res_container_src) +res_container_shared = resource_container_env.SharedLibrary('rcs_container', res_container_src) resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer') @@ -131,7 +131,7 @@ ss_resource_bundle_env.AppendUnique(CPPPATH = [ '../../include', ]) -ss_resource_bundle_env.PrependUnique(LIBS = ['ResContainerLib']) +ss_resource_bundle_env.PrependUnique(LIBS = ['rcs_container']) ss_resource_bundle_src = [ Glob(SS_RESOURCE_BUNDLE_DIR + 'src/*.cpp')] @@ -164,7 +164,7 @@ else: 'include/' ]) - hue_resource_bundle_env.PrependUnique(LIBS = ['curl', 'ResContainerLib']) + hue_resource_bundle_env.PrependUnique(LIBS = ['curl', 'rcs_container']) hue_resource_bundle_src = [ Glob(HUE_RESOURCE_BUNDLE_DIR + 'src/*.cpp')] @@ -187,7 +187,7 @@ containersample_env.AppendUnique(LINKFLAGS=["-rdynamic"]) Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE")) Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml") -containersample_env.AppendUnique(LIBS = ['ResContainerLib']) +containersample_env.AppendUnique(LIBS = ['rcs_container']) containersampleapp_src = ['src/ContainerSample.cpp'] containersampleapp = containersample_env.Program('ContainerSample',containersampleapp_src) @@ -199,7 +199,7 @@ env.AppendTarget('containersample') ###################################################################### containersampleclient_env = resource_container_env.Clone(); -containersample_env.AppendUnique(LIBS = ['ResContainerLib']) +containersample_env.AppendUnique(LIBS = ['rcs_container']) containersampleclient_src = ['src/ContainerSampleClient.cpp'] containersampleclientapp = containersample_env.Program('ContainerSampleClient',containersampleclient_src) Alias("containersampleclient", containersampleclientapp) diff --git a/service/resource-manipulation/src/resourceContainer/unittests/SConscript b/service/resource-manipulation/src/resourceContainer/unittests/SConscript index abe6add..e3e7306 100644 --- a/service/resource-manipulation/src/resourceContainer/unittests/SConscript +++ b/service/resource-manipulation/src/resourceContainer/unittests/SConscript @@ -19,7 +19,7 @@ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -# ResourceContainer Unit Test build script +# ResourceContainer (rcs_container) Unit Test build script ## import os Import('env') @@ -121,9 +121,7 @@ except KeyError: container_gtest_env.AppendUnique(CCFLAGS = ['-Wnoexcept']) - - -container_gtest_env.PrependUnique(LIBS = ['ResContainerLib', 'server_builder', 'service_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', gtest, gtest_main]) +container_gtest_env.PrependUnique(LIBS = ['rcs_container', 'rcs_server', 'rcs_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', gtest, gtest_main]) container_gtest_env.AppendUnique(LIBS = ['dl']) diff --git a/service/resource-manipulation/src/serverBuilder/SConscript b/service/resource-manipulation/src/serverBuilder/SConscript index 2973af9..e7acde0 100644 --- a/service/resource-manipulation/src/serverBuilder/SConscript +++ b/service/resource-manipulation/src/serverBuilder/SConscript @@ -19,7 +19,7 @@ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -# server_builder project build script +# rcs_server (Server Builder) project build script ## import os Import('env') @@ -67,10 +67,10 @@ if not release: ###################################################################### server_builder_src = env.Glob('src/*.cpp') -server_builder_static = server_builder_env.StaticLibrary('server_builder', server_builder_src) -server_builder_shared = server_builder_env.SharedLibrary('server_builder', server_builder_src) +server_builder_static = server_builder_env.StaticLibrary('rcs_server', server_builder_src) +server_builder_shared = server_builder_env.SharedLibrary('rcs_server', server_builder_src) -server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'server_builder') +server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'rcs_server') ###################################################################### # Build Test @@ -88,8 +88,9 @@ gtest = File(gtest_dir + '/lib/.libs/libgtest.a') gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a') server_builder_test_env.PrependUnique(LIBS = [ - 'server_builder', - 'service_common', + 'rcs_server', + 'rcs_common', + 'pthread', 'oc', 'octbstack', 'oc_logger', diff --git a/service/resource-manipulation/unittests/ResourceClient_Test.cpp b/service/resource-manipulation/unittests/ResourceClient_Test.cpp index e4cfc1c..80183b6 100644 --- a/service/resource-manipulation/unittests/ResourceClient_Test.cpp +++ b/service/resource-manipulation/unittests/ResourceClient_Test.cpp @@ -82,7 +82,7 @@ TEST(ResourceClientTest, testDiscoverResourcePass) destroyResource(); } -//Get remote attributes when callback is not NULL +//Get remote attributes when callback is valid TEST(ResourceClientTest, testGetRemoteAttributesPass) { createResource(); @@ -95,7 +95,7 @@ TEST(ResourceClientTest, testGetRemoteAttributesPass) destroyResource(); } -//Set remote attributes when callback is not NULL +//Set remote attributes when callback is valid TEST(ResourceClientTest, testSetRemoteAttributesPass) { createResource(); @@ -120,14 +120,14 @@ TEST(ResourceClientTest, testSetRemoteAttributesPass) destroyResource(); } -//Check value of isWatching -TEST(ResourceClientTest, testIsWatching) +//Check value of isMonitoring +TEST(ResourceClientTest, testIsMonitoring) { createResource(); manager->DiscoveryManager::discoverResource("", uri, CT_DEFAULT, &onResourceDiscoveredCallback); sleep(1); destroyResource(); - EXPECT_FALSE(object->isWatching()); + EXPECT_FALSE(object->isMonitoring()); } //Check value of isCaching @@ -145,34 +145,34 @@ TEST(ResourceClientTest, testIsObservable) EXPECT_TRUE(object->isObservable()); } -//Check value of startWatching for NULL callback -TEST(ResourceClientTest, testStartWatchingFail) +//Check value of startMonitoring for NULL callback +TEST(ResourceClientTest, testStartMonitoringFail) { createResource(); - object->m_watchingFlag = false; + object->m_monitoringFlag = false; object->startMonitoring(NULL); - EXPECT_TRUE(object->m_watchingFlag); + EXPECT_TRUE(object->m_monitoringFlag); object->stopMonitoring(); destroyResource(); } -//Check value of startWatching for non NULL callback -TEST(ResourceClientTest, testStartWatchingPass) +//Check value of startMonitoring for valid callback +TEST(ResourceClientTest, testStartMonitoringPass) { createResource(); object->startMonitoring(&onResourceStateChanged); - EXPECT_TRUE(object->m_watchingFlag); + EXPECT_TRUE(object->m_monitoringFlag); object->stopMonitoring(); destroyResource(); } -//Stop watching when watching is true -TEST(ResourceClientTest, testStopWatching) +//Stop Monitoring when Monitoring is true +TEST(ResourceClientTest, testStopMonitoring) { createResource(); object->startMonitoring(&onResourceStateChanged); object->stopMonitoring(); - EXPECT_FALSE(object->m_watchingFlag); + EXPECT_FALSE(object->m_monitoringFlag); object->startMonitoring(&onResourceStateChanged); destroyResource(); } @@ -182,7 +182,7 @@ TEST(ResourceClientTest, testGetStatePass) { createResource(); ResourceState result = object->getState(); - EXPECT_TRUE(result >= ResourceState::NOT_WATCHING && result <= ResourceState::DESTROYED); + EXPECT_TRUE(result >= ResourceState::NOT_MONITORING && result <= ResourceState::DESTROYED); destroyResource(); } @@ -216,7 +216,7 @@ TEST(ResourceClientTest, testRefreshCache) destroyResource(); } -//Callback for start caching is not NULL +//Callback for start caching is valid TEST(ResourceClientTest, testStartCachingCbPass) { createResource(); diff --git a/service/resource-manipulation/unittests/SConscript b/service/resource-manipulation/unittests/SConscript index 4a67e17..bf00ac3 100644 --- a/service/resource-manipulation/unittests/SConscript +++ b/service/resource-manipulation/unittests/SConscript @@ -79,7 +79,7 @@ if target_os not in ['windows', 'winrt']: ResourceClient_gtest_env.PrependUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/hippomocks-master/HippoMocks', gtest_dir + '/include']) ResourceClient_gtest_env.AppendUnique(LIBPATH = ['/usr/lib/jvm/jdk1.8.0_40/jre/lib/amd64/server/']) -ResourceClient_gtest_env.PrependUnique(LIBS = ['ResourceClient','ResourceCache', 'ResourceBroker', 'ExpiryTimer','server_builder', 'service_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', gtest, gtest_main]) +ResourceClient_gtest_env.PrependUnique(LIBS = ['rcs_client','rcs_server', 'rcs_common', 'oc','octbstack', 'oc_logger', 'oc_logger_core', 'connectivity_abstraction', gtest, gtest_main]) ResourceClient_gtest_env.AppendUnique(LIBS = ['dl']) ###################################################################### -- 2.7.4