[ITC][iotcon][Non-ACR][Fix iotcon TC fail of RC12]
authorNibha Sharma <nibha.sharma@samsung.com>
Tue, 28 Jun 2016 05:29:15 +0000 (14:29 +0900)
committerNibha Sharma <nibha.sharma@samsung.com>
Tue, 28 Jun 2016 05:29:15 +0000 (14:29 +0900)
Change-Id: Ie7eecb88afe05518f697be3f6282a322ad549214
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
src/itc/iotcon/CMakeLists.txt
src/itc/iotcon/ITs-iotcon-common.h
src/itc/iotcon/ITs-iotcon-serive.c [new file with mode: 0755]
src/itc/iotcon/ITs-iotcon.c
src/itc/iotcon/tct-iotcon-native_common_iot.h
src/itc/iotcon/tct-iotcon-native_mobile.h
src/itc/iotcon/tct-iotcon-native_tv.h
src/itc/iotcon/tct-iotcon-native_wearable.h

index eb75e10..206af94 100755 (executable)
@@ -21,6 +21,7 @@ SET(TC_SOURCES
        ITs-iotcon-resource.c
        ITs-iotcon-presence.c
        ITs-iotcon-presence-response.c
+       ITs-iotcon-serive.c
 )
 
 PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
index 816036e..13f70fc 100755 (executable)
@@ -96,6 +96,11 @@ int icitc_send_ok_response(iotcon_request_h request);
        }\
 }
 
+#define START_TEST_SERVICE{\
+       FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+}
+
+
 #define RUN_POLLING_LOOP {\
        g_pMainLoop = g_main_loop_new(NULL, false);\
        nIotconTimeoutId = g_timeout_add(TIMEOUT_CB, TimeoutFunction, g_pMainLoop);\
diff --git a/src/itc/iotcon/ITs-iotcon-serive.c b/src/itc/iotcon/ITs-iotcon-serive.c
new file mode 100755 (executable)
index 0000000..7161901
--- /dev/null
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+#include "ITs-iotcon-common.h"
+
+//& set: Iotcon
+
+/** @addtogroup itc-iotcon
+*  @ingroup itc
+*  @{
+*/
+
+
+/**
+ * @function           ITs_iotcon_service_startup
+ * @description                Called before each test
+ * @parameter          NA
+ * @return                     NA
+ */
+
+void ITs_iotcon_service_startup(void)
+{
+       struct stat stBuff;
+       char *svr_db_path;
+       if ( stat(ERR_LOG, &stBuff) == 0 )
+       {
+               remove(ERR_LOG);
+       }
+       g_bFeatureUnsupported = false;
+       if ( !TCTCheckSystemInfoFeatureSupported(IOTCON_FEATURE, API_NAMESPACE) )
+       {
+               g_bFeatureUnsupported = true;
+       }
+       return;
+}
+
+
+/**
+ * @function           ITs_iotcon_service_cleanup
+ * @description                Called after each test
+ * @parameter          NA
+ * @return                     NA
+ */
+void ITs_iotcon_service_cleanup(void)
+{
+       return;
+}
+
+/** @addtogroup itc-iotcon-testcases
+*  @brief              Integration testcases for module iotcon
+*  @ingroup    itc-iotcon
+*  @{
+*/
+
+//& type: auto
+//& purpose: scenario to connect and disconnect iotcon.
+/**
+* @testcase                    ITc_iotcon_initialize_deinitialize_p
+* @author              SRID(sk.roy)
+* @reviewer            SRID(parshant.v)
+* @type                                auto
+* @since_tizen                         3.0
+* @description                 connect and disconnect iotcon.
+* @scenario                            connect iotcon \n
+*                                              disconnect iotcon\n
+* @apicovered                  iotcon_initialize, iotcon_deinitialize
+* @passcase                            if iotcon_initialize and iotcon_deinitialize passes
+* @failcase                            if iotcon_initialize or iotcon_deinitialize fails
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITc_iotcon_initialize_deinitialize_p(void)
+{
+       START_TEST_SERVICE;
+       char *svr_db_path;
+
+       ic_get_svr_db_path(&svr_db_path);
+       int nRet = iotcon_initialize(svr_db_path);
+       free(svr_db_path);
+       if(g_bFeatureUnsupported)
+       {
+               if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+               {
+                       FPRINTF("[Line : %d][%s] iotcon_initialize API call returned mismatch %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, IotConGetError(nRet));
+                       return 1;
+
+               }
+               else
+               {
+                       FPRINTF("[Line : %d][%s] iotcon_initialize API call correctly returned %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, IotConGetError(nRet));
+                       return 0;
+               }
+       }
+       else
+       {
+               PRINT_RESULT(IOTCON_ERROR_NONE, nRet, "iotcon_initialize", IotConGetError(nRet));
+       }
+
+       iotcon_deinitialize();
+
+       return 0;
+}
+/** @} */
+/** @} */
index fab67d3..145f653 100755 (executable)
@@ -96,45 +96,6 @@ void ITs_iotcon_cleanup(void)
 */
 
 //& type: auto
-//& purpose: scenario to connect and disconnect iotcon.
-/**
-* @testcase                    ITc_iotcon_initialize_deinitialize_p
-* @author              SRID(sk.roy)
-* @reviewer            SRID(parshant.v)
-* @type                                auto
-* @since_tizen                         3.0
-* @description                 connect and disconnect iotcon.
-* @scenario                            connect iotcon \n
-*                                              disconnect iotcon\n
-* @apicovered                  iotcon_initialize, iotcon_deinitialize
-* @passcase                            if iotcon_initialize and iotcon_deinitialize passes
-* @failcase                            if iotcon_initialize or iotcon_deinitialize fails
-* @precondition                        NA
-* @postcondition               NA
-*/
-int ITc_iotcon_initialize_deinitialize_p(void)
-{
-       START_TEST;
-       char *svr_db_path;
-
-       iotcon_deinitialize();
-
-       ic_get_svr_db_path(&svr_db_path);
-   int nRet = iotcon_initialize(svr_db_path);
-       PRINT_RESULT(IOTCON_ERROR_NONE, nRet, "iotcon_initialize", IotConGetError(nRet));
-
-       iotcon_deinitialize();
-       nRet = iotcon_initialize(svr_db_path);
-       free(svr_db_path);
-       PRINT_RESULT_NORETURN(IOTCON_ERROR_NONE, nRet, "iotcon_initialize", IotConGetError(nRet));
-
-       if(nRet != IOTCON_ERROR_NONE)
-               g_bIotconConnect = false;
-
-       return 0;
-}
-
-//& type: auto
 //& purpose:  scenario to create and destroy iotcon list
 /**
 * @testcase                    ITc_iotcon_set_get_timeout_p
index 0121170..6eed2d4 100755 (executable)
@@ -23,6 +23,8 @@ extern void ITs_iotcon_device_startup(void);
 extern void ITs_iotcon_device_cleanup(void);
 extern void ITs_iotcon_list_startup(void);
 extern void ITs_iotcon_list_cleanup(void);
+extern void ITs_iotcon_service_startup(void);
+extern void ITs_iotcon_service_cleanup(void);
 extern void ITs_iotcon_lite_resource_startup(void);
 extern void ITs_iotcon_lite_resource_cleanup(void);
 extern void ITs_iotcon_observers_startup(void);
@@ -277,7 +279,7 @@ testcase tc_array[] = {
     {"ITc_iotcon_response_set_get_representation_p", ITc_iotcon_response_set_get_representation_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_set_get_result_p", ITc_iotcon_response_set_get_result_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_send_p", ITc_iotcon_response_send_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
-    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_service_startup, ITs_iotcon_service_cleanup},
     {"ITc_iotcon_set_get_timeout_p", ITc_iotcon_set_get_timeout_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_set_get_polling_interval_p", ITc_iotcon_set_get_polling_interval_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_polling_invoke_p", ITc_iotcon_polling_invoke_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
index 65ce84e..47c8cfe 100755 (executable)
@@ -23,6 +23,8 @@ extern void ITs_iotcon_device_startup(void);
 extern void ITs_iotcon_device_cleanup(void);
 extern void ITs_iotcon_list_startup(void);
 extern void ITs_iotcon_list_cleanup(void);
+extern void ITs_iotcon_service_startup(void);
+extern void ITs_iotcon_service_cleanup(void);
 extern void ITs_iotcon_lite_resource_startup(void);
 extern void ITs_iotcon_lite_resource_cleanup(void);
 extern void ITs_iotcon_observers_startup(void);
@@ -277,7 +279,7 @@ testcase tc_array[] = {
     {"ITc_iotcon_response_set_get_representation_p", ITc_iotcon_response_set_get_representation_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_set_get_result_p", ITc_iotcon_response_set_get_result_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_send_p", ITc_iotcon_response_send_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
-    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_service_startup, ITs_iotcon_service_cleanup},
     {"ITc_iotcon_set_get_timeout_p", ITc_iotcon_set_get_timeout_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_set_get_polling_interval_p", ITc_iotcon_set_get_polling_interval_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_polling_invoke_p", ITc_iotcon_polling_invoke_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
index 65ce84e..47c8cfe 100755 (executable)
@@ -23,6 +23,8 @@ extern void ITs_iotcon_device_startup(void);
 extern void ITs_iotcon_device_cleanup(void);
 extern void ITs_iotcon_list_startup(void);
 extern void ITs_iotcon_list_cleanup(void);
+extern void ITs_iotcon_service_startup(void);
+extern void ITs_iotcon_service_cleanup(void);
 extern void ITs_iotcon_lite_resource_startup(void);
 extern void ITs_iotcon_lite_resource_cleanup(void);
 extern void ITs_iotcon_observers_startup(void);
@@ -277,7 +279,7 @@ testcase tc_array[] = {
     {"ITc_iotcon_response_set_get_representation_p", ITc_iotcon_response_set_get_representation_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_set_get_result_p", ITc_iotcon_response_set_get_result_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_send_p", ITc_iotcon_response_send_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
-    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_service_startup, ITs_iotcon_service_cleanup},
     {"ITc_iotcon_set_get_timeout_p", ITc_iotcon_set_get_timeout_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_set_get_polling_interval_p", ITc_iotcon_set_get_polling_interval_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_polling_invoke_p", ITc_iotcon_polling_invoke_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
index 65ce84e..47c8cfe 100755 (executable)
@@ -23,6 +23,8 @@ extern void ITs_iotcon_device_startup(void);
 extern void ITs_iotcon_device_cleanup(void);
 extern void ITs_iotcon_list_startup(void);
 extern void ITs_iotcon_list_cleanup(void);
+extern void ITs_iotcon_service_startup(void);
+extern void ITs_iotcon_service_cleanup(void);
 extern void ITs_iotcon_lite_resource_startup(void);
 extern void ITs_iotcon_lite_resource_cleanup(void);
 extern void ITs_iotcon_observers_startup(void);
@@ -277,7 +279,7 @@ testcase tc_array[] = {
     {"ITc_iotcon_response_set_get_representation_p", ITc_iotcon_response_set_get_representation_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_set_get_result_p", ITc_iotcon_response_set_get_result_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
     {"ITc_iotcon_response_send_p", ITc_iotcon_response_send_p, ITs_iotcon_response_startup, ITs_iotcon_response_cleanup},
-    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+    {"ITc_iotcon_initialize_deinitialize_p", ITc_iotcon_initialize_deinitialize_p, ITs_iotcon_service_startup, ITs_iotcon_service_cleanup},
     {"ITc_iotcon_set_get_timeout_p", ITc_iotcon_set_get_timeout_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_set_get_polling_interval_p", ITc_iotcon_set_get_polling_interval_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
 //    {"ITc_iotcon_polling_invoke_p", ITc_iotcon_polling_invoke_p, ITs_iotcon_startup, ITs_iotcon_cleanup},