celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlenfer...@apache.org
Subject [celix] branch develop updated: Corrected id for test case + corrected indentation
Date Fri, 21 Jun 2019 17:57:19 GMT
This is an automated email from the ASF dual-hosted git repository.

rlenferink pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/develop by this push:
     new 18c590b  Corrected id for test case + corrected indentation
18c590b is described below

commit 18c590b1619139a5c7ad8a31b7a15f97a51b7b45
Author: Roy Lenferink <lenferinkroy@gmail.com>
AuthorDate: Fri Jun 21 19:27:41 2019 +0200

    Corrected id for test case + corrected indentation
---
 .../topology_manager/tms_tst/tms_tests.cpp         | 274 ++++++++++-----------
 1 file changed, 132 insertions(+), 142 deletions(-)

diff --git a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
index 0bbd4f0..3e99dab 100644
--- a/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
+++ b/bundles/remote_services/topology_manager/tms_tst/tms_tests.cpp
@@ -266,7 +266,7 @@ extern "C" {
     /// \TEST_CASE_REQ{REQ-1}
     /// \TEST_CASE_DESC Checks if 3 bundles are installed after the framework setup
     static void testBundles(void) {
-    	printf("Begin: %s\n", __func__);
+        printf("Begin: %s\n", __func__);
             array_list_pt bundles = NULL;
 
             int rc = bundleContext_getBundles(context, &bundles);
@@ -288,13 +288,13 @@ extern "C" {
             }*/
 
             arrayList_destroy(bundles);
-        	printf("End: %s\n", __func__);
+            printf("End: %s\n", __func__);
     }
 
     static void scopeInit(const char *fileName, int *nr_exported, int *nr_imported)
     {
-    	celix_status_t	status = CELIX_SUCCESS;
-    	celix_status_t  added;
+        celix_status_t status = CELIX_SUCCESS;
+        celix_status_t added;
 
         json_t *js_root;
         json_error_t error;
@@ -303,77 +303,76 @@ extern "C" {
         *nr_exported = 0;
         *nr_imported = 0;
         js_root = json_load_file(fileName, 0, &error);
-        if (js_root != NULL)
-        {
+
+        if (js_root != NULL) {
             json_t *js_exportServices = json_object_get(js_root, JSON_EXPORT_SERVICES);
             json_t *js_importServices = json_object_get(js_root, JSON_IMPORT_SERVICES);
 
             if (js_exportServices != NULL)  {
-                 if (json_is_array(js_exportServices)) {
-                     int i = 0;
-                     int size = json_array_size(js_exportServices);
-
-                     for (; i < size; ++i) {
-                         json_t* js_service = json_array_get(js_exportServices, i);
-
-                         if (json_is_object(js_service)) {
-                        	 json_t* js_filter = json_object_get(js_service, JSON_SERVICE_NAME);
-                        	 json_t* js_serviceZone = json_object_get(js_service, JSON_SERVICE_ZONE);
-                        	 json_t* js_key1 = json_object_get(js_service, JSON_SERVICE_KEY1);
-                        	 json_t* js_key2 = json_object_get(js_service, JSON_SERVICE_KEY2);
-
-                             properties=properties_create();
-                             if (js_serviceZone != NULL) {
-                        	     properties_set(properties, (char*)JSON_SERVICE_ZONE,
-                        		    	                    (char*)json_string_value(js_serviceZone));
-			     }
-                             if (js_key1 != NULL) {
-                        	     properties_set(properties, (char*)JSON_SERVICE_KEY1,
-                        		    	 	 	  	 	    (char*)json_string_value(js_key1));
-			     }
-                             if (js_key2 != NULL) {
-                                 properties_set(properties, (char*)JSON_SERVICE_KEY2,
-                                    	 	 	  	 	    (char*)json_string_value(js_key2));
-			     }
-
-                        	 added = tmScopeService->addExportScope(tmScopeService->handle,
(char*)json_string_value(js_filter), properties);
-                             if (added == CELIX_SUCCESS) {
-                            	 (*nr_exported)++;
-                             }
+                if (json_is_array(js_exportServices)) {
+                    int i = 0;
+                    int size = json_array_size(js_exportServices);
+
+                    for (; i < size; ++i) {
+                        json_t* js_service = json_array_get(js_exportServices, i);
+
+                        if (json_is_object(js_service)) {
+                            json_t* js_filter = json_object_get(js_service, JSON_SERVICE_NAME);
+                            json_t* js_serviceZone = json_object_get(js_service, JSON_SERVICE_ZONE);
+                            json_t* js_key1 = json_object_get(js_service, JSON_SERVICE_KEY1);
+                            json_t* js_key2 = json_object_get(js_service, JSON_SERVICE_KEY2);
+
+                            properties=properties_create();
+                            if (js_serviceZone != NULL) {
+                                properties_set(properties, (char*)JSON_SERVICE_ZONE,
+                                                           (char*)json_string_value(js_serviceZone));
+                            }
+                            if (js_key1 != NULL) {
+                                properties_set(properties, (char*)JSON_SERVICE_KEY1,
+                                                           (char*)json_string_value(js_key1));
+                            }
+                            if (js_key2 != NULL) {
+                                properties_set(properties, (char*)JSON_SERVICE_KEY2,
+                                                           (char*)json_string_value(js_key2));
+                            }
+
+                            added = tmScopeService->addExportScope(tmScopeService->handle,
(char*)json_string_value(js_filter), properties);
+                            if (added == CELIX_SUCCESS) {
+                                (*nr_exported)++;
+                            }
                          }
                      }
                  }
              }
 
-             if (js_importServices != NULL)  {
-                 if (json_is_array(js_importServices)) {
-                     int i = 0;
-                     int size = json_array_size(js_importServices);
-
-                     for (; i < size; ++i) {
-                         json_t* js_service = json_array_get(js_importServices, i);
+            if (js_importServices != NULL)  {
+                if (json_is_array(js_importServices)) {
+                    int i = 0;
+                    int size = json_array_size(js_importServices);
 
-                         if (json_is_object(js_service)) {
-                        	 json_t* js_filter = json_object_get(js_service, JSON_SERVICE_NAME);
+                    for (; i < size; ++i) {
+                        json_t* js_service = json_array_get(js_importServices, i);
 
-                        	 added = tmScopeService->addImportScope(tmScopeService->handle,
(char*)json_string_value(js_filter));
-                             if (added == CELIX_SUCCESS) {
-                            	 (*nr_imported)++;
-                             }
-                         }
-                     }
-                 }
-             }
+                        if (json_is_object(js_service)) {
+                            json_t* js_filter = json_object_get(js_service, JSON_SERVICE_NAME);
 
+                            added = tmScopeService->addImportScope(tmScopeService->handle,
(char*)json_string_value(js_filter));
+                            if (added == CELIX_SUCCESS) {
+                                (*nr_imported)++;
+                            }
+                        }
+                    }
+                }
+            }
 
-        	json_decref(js_root);
+            json_decref(js_root);
         }
         else
         {
-        	printf("File error: %s\n", error.text);
-        	printf("File error: source %s\n", error.source);
-        	printf("File error: line %d position %d\n", error.line, error.position);
-        	status = CELIX_FILE_IO_EXCEPTION;
+            printf("File error: %s\n", error.text);
+            printf("File error: source %s\n", error.source);
+            printf("File error: line %d position %d\n", error.line, error.position);
+            status = CELIX_FILE_IO_EXCEPTION;
         }
         CHECK_EQUAL(CELIX_SUCCESS, status);
     }
@@ -383,11 +382,11 @@ extern "C" {
     /// \TEST_CASE_REQ{REQ-2}
     /// \TEST_CASE_DESC Checks if scopes can be added, but not twice
     static void testScope(void) {
-    	int nr_exported;
-    	int nr_imported;
-    	array_list_pt epList;
+        int nr_exported;
+        int nr_imported;
+        array_list_pt epList;
 
-    	printf("\nBegin: %s\n", __func__);
+        printf("\nBegin: %s\n", __func__);
         scopeInit("scope.json", &nr_exported, &nr_imported);
         CHECK_EQUAL(1, nr_exported);
         CHECK_EQUAL(0, nr_imported);
@@ -396,22 +395,22 @@ extern "C" {
         // We export two services: Calculator and Calculator2, but only 1 has DFI bundle
info
         CHECK_EQUAL(1, arrayList_size(epList));
         for (unsigned int i = 0; i < arrayList_size(epList); i++) {
-        	endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList, i);
-        	properties_pt props = ep->properties;
-        	hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
-        	char* value = (char*) hashMapEntry_getValue(entry);
-        	STRCMP_EQUAL("inaetics", value);
-        	/*
-        	printf("Service: %s ", ep->service);
-        	hash_map_iterator_pt iter = hashMapIterator_create(props);
-        	while (hashMapIterator_hasNext(iter)) {
-        		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-        		printf("%s - %s\n", (char*)hashMapEntry_getKey(entry),
-        						   (char*)hashMapEntry_getValue(entry));
-        	}
-        	printf("\n");
-        	hashMapIterator_destroy(iter);
-        	*/
+            endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList,
i);
+            properties_pt props = ep->properties;
+            hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
+            char* value = (char*) hashMapEntry_getValue(entry);
+            STRCMP_EQUAL("inaetics", value);
+            /*
+            printf("Service: %s ", ep->service);
+            hash_map_iterator_pt iter = hashMapIterator_create(props);
+            while (hashMapIterator_hasNext(iter)) {
+                hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+                printf("%s - %s\n", (char*)hashMapEntry_getKey(entry),
+                                   (char*)hashMapEntry_getValue(entry));
+            }
+            printf("\n");
+            hashMapIterator_destroy(iter);
+            */
         }
         printf("End: %s\n", __func__);
     }
@@ -421,10 +420,10 @@ extern "C" {
     /// \TEST_CASE_REQ{REQ-3}
     /// \TEST_CASE_DESC Checks if scopes can be added, but not twice
     static void testScope2(void) {
-    	int nr_exported;
-    	int nr_imported;
-    	array_list_pt epList;
-    	printf("\nBegin: %s\n", __func__);
+        int nr_exported;
+        int nr_imported;
+        array_list_pt epList;
+        printf("\nBegin: %s\n", __func__);
         scopeInit("scope2.json", &nr_exported, &nr_imported);
         CHECK_EQUAL(2, nr_exported);
         CHECK_EQUAL(1, nr_imported);
@@ -432,11 +431,11 @@ extern "C" {
         // We export two services: Calculator and Calculator2, but only 1 has DFI bundle
info
         CHECK_EQUAL(1, arrayList_size(epList));
         for (unsigned int i = 0; i < arrayList_size(epList); i++) {
-        	endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList, i);
-        	properties_pt props = ep->properties;
-        	hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
-        	char* value = (char*) hashMapEntry_getValue(entry);
-        	STRCMP_EQUAL("inaetics", value);
+            endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList,
i);
+            properties_pt props = ep->properties;
+            hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"key2");
+            char* value = (char*) hashMapEntry_getValue(entry);
+            STRCMP_EQUAL("inaetics", value);
         }
         printf("End: %s\n", __func__);
     }
@@ -446,21 +445,21 @@ extern "C" {
     /// \TEST_CASE_REQ{REQ-4}
     /// \TEST_CASE_DESC Checks if scopes can be added, but not twice
     static void testScope3(void) {
-    	int nr_exported;
-    	int nr_imported;
-    	array_list_pt epList;
-    	printf("\nBegin: %s\n", __func__);
+        int nr_exported;
+        int nr_imported;
+        array_list_pt epList;
+        printf("\nBegin: %s\n", __func__);
         scopeInit("scope3.json", &nr_exported, &nr_imported);
         CHECK_EQUAL(2, nr_exported);
         discMock->getEPDescriptors(discMock->handle, &epList);
         // We export two services: Calculator and Calculator2, but only 1 has DFI bundle
info
         CHECK_EQUAL(1, arrayList_size(epList));
         for (unsigned int i = 0; i < arrayList_size(epList); i++) {
-        	endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList, i);
-        	properties_pt props = ep->properties;
-        	hash_map_entry_pt entry = hashMap_getEntry(props, (void *)"key2");
-        	char* value = (char*) hashMapEntry_getValue(entry);
-        	STRCMP_EQUAL("inaetics", value);
+            endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList,
i);
+            properties_pt props = ep->properties;
+            hash_map_entry_pt entry = hashMap_getEntry(props, (void *)"key2");
+            char* value = (char*) hashMapEntry_getValue(entry);
+            STRCMP_EQUAL("inaetics", value);
         }
         printf("End: %s\n", __func__);
     }
@@ -471,38 +470,37 @@ extern "C" {
     /// \TEST_CASE_DESC Invalid input file, two partly matching filters with same key name
     /*
     static void testScope4(void) {
-    	int nr_exported;
-    	int nr_imported;
-    	array_list_pt epList;
-    	printf("\nBegin: %s\n", __func__);
+        int nr_exported;
+        int nr_imported;
+        array_list_pt epList;
+        printf("\nBegin: %s\n", __func__);
         scopeInit("scope4.json", &nr_exported, &nr_imported);
         CHECK_EQUAL(2, nr_exported);
         discMock->getEPDescriptors(discMock->handle, &epList);
         // We export two services: Calculator and Calculator2, but only 1 has DFI bundle
info
         CHECK_EQUAL(1, arrayList_size(epList));
         for (unsigned int i = 0; i < arrayList_size(epList); i++) {
-        	endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList, i);
-        	properties_pt props = ep->properties;
-        	hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"zone");
-        	char* value = (char*) hashMapEntry_getValue(entry);
-        	STRCMP_EQUAL("inaetics", value);
-        	CHECK_TRUE((entry == NULL));
+            endpoint_description_pt ep = (endpoint_description_pt) arrayList_get(epList,
i);
+            properties_pt props = ep->properties;
+            hash_map_entry_pt entry = hashMap_getEntry(props, (void*)"zone");
+            char* value = (char*) hashMapEntry_getValue(entry);
+            STRCMP_EQUAL("inaetics", value);
+            CHECK_TRUE((entry == NULL));
         }
         printf("End: %s\n", __func__);
     }*/
 
-
     /// \TEST_CASE_ID{6}
     /// \TEST_CASE_TITLE{Test import scope}
     /// \TEST_CASE_REQ{REQ-3}
     /// \TEST_CASE_DESC Checks if import succeeds if there is no import scope defined
     static void testImportScope(void) {
-    	int nr_exported;
-    	int nr_imported;
-    	printf("\nBegin: %s\n", __func__);
+        int nr_exported;
+        int nr_imported;
+        printf("\nBegin: %s\n", __func__);
 
-    	scopeInit("scope.json", &nr_exported, &nr_imported);
-    	CHECK_EQUAL(0, nr_imported);
+        scopeInit("scope.json", &nr_exported, &nr_imported);
+        CHECK_EQUAL(0, nr_imported);
         int rc = 0;
 
         endpoint_description_pt endpoint = NULL;
@@ -575,7 +573,6 @@ extern "C" {
         printf("End: %s\n", __func__);
     }
 
-
     /// \TEST_CASE_ID{8}
     /// \TEST_CASE_TITLE{Test import scope block}
     /// \TEST_CASE_REQ{REQ-3}
@@ -617,7 +614,7 @@ extern "C" {
         printf("End: %s\n", __func__);
     }
 
-    /// \TEST_CASE_ID{8}
+    /// \TEST_CASE_ID{9}
     /// \TEST_CASE_TITLE{Test import scope block}
     /// \TEST_CASE_REQ{REQ-3}
     /// \TEST_CASE_DESC Checks if import fails with non matching import scope defined
@@ -661,73 +658,66 @@ extern "C" {
 }
 
 TEST_GROUP(topology_manager_scoped_export) {
-	void setup(void) {
-		setupFm();
-	}
+    void setup(void) {
+        setupFm();
+    }
 
-	void teardown() {
-		teardownFm();
-	}
+    void teardown() {
+        teardownFm();
+    }
 };
 
 TEST_GROUP(topology_manager_scoped_import) {
-	void setup(void) {
-		setupFmImport();
-	}
+    void setup(void) {
+        setupFmImport();
+    }
 
-	void teardown() {
-		teardownFmImport();
-	}
+    void teardown() {
+        teardownFmImport();
+    }
 };
 
 // Test9
 TEST(topology_manager_scoped_import, scope_import_multiple) {
-	testImportScopeMultiple();
-
+    testImportScopeMultiple();
 }
 
 // Test8
 TEST(topology_manager_scoped_import, scope_import_fail) {
-	testImportScopeFail();
-
+    testImportScopeFail();
 }
 
 // Test7
 TEST(topology_manager_scoped_import, scope_import_match) {
-	testImportScopeMatch();
-
+    testImportScopeMatch();
 }
 
 // Test6
 TEST(topology_manager_scoped_import, scope_import) {
-	testImportScope();
-
+    testImportScope();
 }
 
 // Test5
 /*
 TODO: NYI
 TEST(topology_manager_scoped_export, scope_init4) {
-	testScope4();
+    testScope4();
 }
 */
 
 // Test4
 TEST(topology_manager_scoped_export, scope_init3) {
-	testScope3();
-
+    testScope3();
 }
 
 // Test3
 TEST(topology_manager_scoped_export, scope_init2) {
-	testScope2();
-
+    testScope2();
 }
 
 // Test2
 TEST(topology_manager_scoped_export, scope_init) {
-	testScope();
-
+    testScope();
 }
 
 // Test1


Mime
View raw message