Author: abroekhuis
Date: Thu Dec  9 11:57:29 2010
New Revision: 1043911

URL: http://svn.apache.org/viewvc?rev=1043911&view=rev
Log:
CELIX-1 initial code import

Added:
    incubator/celix/trunk/celix_test/
    incubator/celix/trunk/celix_test/CMakeLists.txt
    incubator/celix/trunk/celix_test/array_list_test.c
    incubator/celix/trunk/celix_test/hash_map_test.c
    incubator/celix/trunk/celix_test/hash_map_test_hash.c
    incubator/celix/trunk/celix_test/test.c
    incubator/celix/trunk/receiver/
    incubator/celix/trunk/receiver-2.0/
    incubator/celix/trunk/receiver-2.0/CMakeLists.txt
    incubator/celix/trunk/receiver-2.0/MANIFEST/
    incubator/celix/trunk/receiver-2.0/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/receiver-2.0/activator.c
    incubator/celix/trunk/receiver-2.0/serviceTest.c
    incubator/celix/trunk/receiver-2.0/serviceTest.h
    incubator/celix/trunk/receiver-2.0/serviceTest_private.h
    incubator/celix/trunk/receiver/CMakeLists.txt
    incubator/celix/trunk/receiver/MANIFEST/
    incubator/celix/trunk/receiver/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/receiver/activator.c
    incubator/celix/trunk/receiver/serviceTest.c
    incubator/celix/trunk/receiver/serviceTest.h
    incubator/celix/trunk/receiver/serviceTest_private.h

Added: incubator/celix/trunk/celix_test/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/CMakeLists.txt?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/celix_test/CMakeLists.txt (added)
+++ incubator/celix/trunk/celix_test/CMakeLists.txt Thu Dec  9 11:57:29 2010
@@ -0,0 +1,18 @@
+include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("/opt/local/include")
+link_directories("/opt/local/lib")
+
+add_executable(hash_map_test hash_map_test.c)
+target_link_libraries(hash_map_test framework cunit ncurses)
+
+add_executable(hash_map_test_hash hash_map_test_hash.c)
+target_link_libraries(hash_map_test_hash framework cunit ncurses)
+
+add_executable(array_list_test array_list_test.c)
+target_link_libraries(array_list_test framework cunit ncurses)
+
+enable_testing()
+#add_test (tester ${EXECUTABLE_OUTPUT_PATH}/tester)
+add_test (hash_map_test ${EXECUTABLE_OUTPUT_PATH}/hash_map_test)
+add_test (hash_map_test_hash ${EXECUTABLE_OUTPUT_PATH}/hash_map_test_hash)
+add_test (array_list_test ${EXECUTABLE_OUTPUT_PATH}/array_list_test)
\ No newline at end of file

Added: incubator/celix/trunk/celix_test/array_list_test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/array_list_test.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/celix_test/array_list_test.c (added)
+++ incubator/celix/trunk/celix_test/array_list_test.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,286 @@
+/*
+ * array_list_test.c
+ *
+ *  Created on: Aug 4, 2010
+ *      Author: alexanderb
+ */
+#include <stdio.h>
+#include <stdbool.h>
+
+#include "CUnit/Basic.h"
+
+#include "array_list.h"
+#include "array_list_private.h"
+
+ARRAY_LIST list;
+
+int setup(void) {
+       list = arrayList_create();
+       if (list == NULL) {
+               return 1;
+       }
+       return 0;
+}
+
+void test_arrayList_create(void) {
+       CU_ASSERT_PTR_NOT_NULL_FATAL(list);
+       CU_ASSERT_EQUAL(list->size, 0);
+}
+
+void test_arrayList_trimToSize(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       CU_ASSERT_EQUAL(list->size, 1);
+       CU_ASSERT_EQUAL(list->capacity, 10);
+
+       arrayList_trimToSize(list);
+       CU_ASSERT_EQUAL(list->size, 1);
+       CU_ASSERT_EQUAL(list->capacity, 1);
+}
+
+void test_arrayList_ensureCapacity(void) {
+       list = arrayList_create();
+       arrayList_clear(list);
+       CU_ASSERT_EQUAL(list->capacity, 10);
+       CU_ASSERT_EQUAL(list->size, 0);
+       int i;
+       for (i = 0; i < 100; i++) {
+               arrayList_add(list, "entry");
+       }
+       CU_ASSERT_EQUAL(list->capacity, 133);
+       CU_ASSERT_EQUAL(list->size, 100);
+       list = arrayList_create();
+}
+
+void test_arrayList_size(void) {
+       arrayList_clear(list);
+       CU_ASSERT_EQUAL(list->size, 0);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       CU_ASSERT_EQUAL(list->size, 1);
+
+       char * entry2 = "entry";
+       arrayList_add(list, entry2);
+       CU_ASSERT_EQUAL(list->size, 2);
+
+       char * entry3 = "entry";
+       arrayList_add(list, entry3);
+       CU_ASSERT_EQUAL(list->size, 3);
+}
+
+void test_arrayList_isEmpty(void) {
+       arrayList_clear(list);
+       CU_ASSERT_EQUAL(list->size, 0);
+       CU_ASSERT_TRUE(arrayList_isEmpty(list));
+}
+
+void test_arrayList_contains(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       CU_ASSERT_TRUE(arrayList_contains(list, entry));
+       CU_ASSERT_TRUE(arrayList_contains(list, entry2));
+       bool contains = arrayList_contains(list, NULL);
+       CU_ASSERT_FALSE(contains);
+
+       char * entry3 = NULL;
+       arrayList_add(list, entry3);
+
+       CU_ASSERT_TRUE(arrayList_contains(list, entry3));
+}
+
+void test_arrayList_indexOf(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+       arrayList_add(list, entry2);
+       arrayList_add(list, entry2);
+       arrayList_add(list, entry2);
+
+       CU_ASSERT_EQUAL(arrayList_indexOf(list, entry), 0);
+       CU_ASSERT_EQUAL(arrayList_indexOf(list, entry2), 1);
+       CU_ASSERT_EQUAL(arrayList_lastIndexOf(list, entry), 0);
+       CU_ASSERT_EQUAL(arrayList_lastIndexOf(list, entry2), 4);
+}
+
+void test_arrayList_get(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       char * get = arrayList_get(list, 0);
+       CU_ASSERT_EQUAL(entry, get);
+
+       get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       char * entry3 = NULL;
+       arrayList_add(list, entry3);
+
+       get = arrayList_get(list, 2);
+       CU_ASSERT_PTR_NULL(get);
+
+       get = arrayList_get(list, 42);
+       CU_ASSERT_PTR_NULL(get);
+}
+
+void test_arrayList_set(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       char * get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       char * entry3 = "entry3";
+       char * old = arrayList_set(list, 1, entry3);
+       CU_ASSERT_EQUAL(entry2, old);
+       get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry3, get);
+}
+
+void test_arrayList_add(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       char * get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       char * entry3 = "entry3";
+       arrayList_addIndex(list, 1, entry3);
+
+       get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry3, get);
+
+       get = arrayList_get(list, 2);
+       CU_ASSERT_EQUAL(entry2, get);
+}
+
+void test_arrayList_remove(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       char * get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       // Remove first entry
+       char * removed = arrayList_remove(list, 0);
+       CU_ASSERT_EQUAL(entry, removed);
+
+       // Check the new first element
+       get = arrayList_get(list, 0);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       // Add a new element
+       char * entry3 = "entry3";
+       arrayList_add(list, entry3);
+
+       get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry3, get);
+}
+
+void test_arrayList_removeElement(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       // Remove entry
+       CU_ASSERT_TRUE(arrayList_removeElement(list, entry));
+
+       // Check the new first element
+       char * get = arrayList_get(list, 0);
+       CU_ASSERT_EQUAL(entry2, get);
+
+       // Add a new element
+       char * entry3 = "entry3";
+       arrayList_add(list, entry3);
+
+       get = arrayList_get(list, 1);
+       CU_ASSERT_EQUAL(entry3, get);
+}
+
+void test_arrayList_clear(void) {
+       arrayList_clear(list);
+
+       char * entry = "entry";
+       arrayList_add(list, entry);
+       char * entry2 = "entry2";
+       arrayList_add(list, entry2);
+
+       CU_ASSERT_EQUAL(arrayList_size(list), 2);
+       arrayList_clear(list);
+       CU_ASSERT_EQUAL(arrayList_size(list), 0);
+}
+
+
+
+int main (int argc, char** argv) {
+       CU_pSuite pSuite = NULL;
+
+       /* initialize the CUnit test registry */
+       if (CUE_SUCCESS != CU_initialize_registry())
+         return CU_get_error();
+
+       /* add a suite to the registry */
+       pSuite = CU_add_suite("Suite_1", setup, NULL);
+       if (NULL == pSuite) {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* add the tests to the suite */
+       if (NULL == CU_add_test(pSuite, "Array List Creation Test", 
test_arrayList_create)
+               || NULL == CU_add_test(pSuite, "Array List Trim Test", 
test_arrayList_trimToSize)
+               || NULL == CU_add_test(pSuite, "Array List Capacity Test", 
test_arrayList_ensureCapacity)
+               || NULL == CU_add_test(pSuite, "Array List Size Test", 
test_arrayList_size)
+               || NULL == CU_add_test(pSuite, "Array List Is Empty Test", 
test_arrayList_isEmpty)
+               || NULL == CU_add_test(pSuite, "Array List Contains Test", 
test_arrayList_contains)
+               || NULL == CU_add_test(pSuite, "Array List Index Of Test", 
test_arrayList_indexOf)
+               || NULL == CU_add_test(pSuite, "Array List Get Test", 
test_arrayList_get)
+               || NULL == CU_add_test(pSuite, "Array List Set Test", 
test_arrayList_set)
+               || NULL == CU_add_test(pSuite, "Array List Add Test", 
test_arrayList_add)
+               || NULL == CU_add_test(pSuite, "Array List Remove Test", 
test_arrayList_remove)
+               || NULL == CU_add_test(pSuite, "Array List Remove Element 
Test", test_arrayList_removeElement)
+               || NULL == CU_add_test(pSuite, "Array List Clear Test", 
test_arrayList_clear)
+       )
+       {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* Run all tests using the CUnit Basic interface */
+       CU_basic_set_mode(CU_BRM_VERBOSE);
+       CU_basic_run_tests();
+       CU_cleanup_registry();
+       return CU_get_error();
+}
+

Added: incubator/celix/trunk/celix_test/hash_map_test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/hash_map_test.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/celix_test/hash_map_test.c (added)
+++ incubator/celix/trunk/celix_test/hash_map_test.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,408 @@
+/*
+ * hash_map_test.c
+ *
+ *  Created on: Jul 25, 2010
+ *      Author: alexanderb
+ */
+#include <stdio.h>
+
+#include "CUnit/Basic.h"
+
+#include "hash_map.h"
+#include "hash_map_private.h"
+
+HASH_MAP map;
+
+int setup(void) {
+       printf("test\n");
+       map = hashMap_create(NULL, NULL, NULL, NULL);
+       if(map == NULL) {
+               return 1;
+       }
+       return 0;
+}
+
+void test_hashMap_create(void) {
+       CU_ASSERT_PTR_NOT_NULL_FATAL(map);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_EQUAL(map->equalsKey, hashMap_equals);
+       CU_ASSERT_EQUAL(map->equalsValue, hashMap_equals);
+       CU_ASSERT_EQUAL(map->hashKey, hashMap_hashCode);
+       CU_ASSERT_EQUAL(map->hashValue, hashMap_hashCode);
+}
+
+void test_hashMap_size(void) {
+       CU_ASSERT_EQUAL(map->size, 0);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+       CU_ASSERT_EQUAL(map->size, 1);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+       CU_ASSERT_EQUAL(map->size, 2);
+
+       // Overwrite existing entry
+       char * key3 = "key2";
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+       CU_ASSERT_EQUAL(map->size, 2);
+
+       // Clear map
+       hashMap_clear(map);
+       CU_ASSERT_EQUAL(map->size, 0);
+}
+
+void test_hashMap_isEmpty(void) {
+       hashMap_clear(map);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+       CU_ASSERT_EQUAL(map->size, 1);
+       CU_ASSERT_FALSE(hashMap_isEmpty(map));
+
+       // Remove entry
+       hashMap_remove(map, key);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+}
+
+void test_hashMap_get(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       char * get = hashMap_get(map, key);
+       CU_ASSERT_STRING_EQUAL(get, value);
+
+       get = hashMap_get(map, key2);
+       CU_ASSERT_STRING_EQUAL(get, value2);
+
+       char * neKey = "notExisting";
+       get = hashMap_get(map, neKey);
+       CU_ASSERT_EQUAL(get, NULL);
+
+       get = hashMap_get(map, NULL);
+       CU_ASSERT_EQUAL(get, NULL);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       get = hashMap_get(map, NULL);
+       CU_ASSERT_STRING_EQUAL(get, value3);
+}
+
+void test_hashMap_containsKey(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       CU_ASSERT_TRUE(hashMap_containsKey(map, key));
+       CU_ASSERT_TRUE(hashMap_containsKey(map, key2));
+       char * neKey = "notExisting";
+       CU_ASSERT_FALSE(hashMap_containsKey(map, neKey));
+       CU_ASSERT_FALSE(hashMap_containsKey(map, NULL));
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       CU_ASSERT_TRUE(hashMap_containsKey(map, key3));
+}
+
+void test_hashMap_getEntry(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       HASH_MAP_ENTRY entry = hashMap_getEntry(map, key);
+       CU_ASSERT_STRING_EQUAL(entry->key, key);
+       CU_ASSERT_STRING_EQUAL(entry->value, value);
+
+       entry = hashMap_getEntry(map, key2);
+       CU_ASSERT_STRING_EQUAL(entry->key, key2);
+       CU_ASSERT_STRING_EQUAL(entry->value, value2);
+
+       char * neKey = "notExisting";
+       entry = hashMap_getEntry(map, neKey);
+       CU_ASSERT_EQUAL(entry, NULL);
+
+       entry = hashMap_getEntry(map, NULL);
+       CU_ASSERT_EQUAL(entry, NULL);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       entry = hashMap_getEntry(map, key3);
+       CU_ASSERT_EQUAL(entry->key, key3);
+       CU_ASSERT_STRING_EQUAL(entry->value, value3);
+}
+
+void test_hashMap_put(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       char * get = hashMap_get(map, key);
+       CU_ASSERT_STRING_EQUAL(get, value);
+
+       get = hashMap_get(map, key2);
+       CU_ASSERT_STRING_EQUAL(get, value2);
+
+       // Overwrite existing entry
+       char * nkey2 = "key2";
+       char * nvalue2 = "value3";
+       char * old = (char *) hashMap_put(map, nkey2, nvalue2);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(old);
+       CU_ASSERT_STRING_EQUAL(old, value2)
+
+       get = hashMap_get(map, key2);
+       CU_ASSERT_STRING_EQUAL(get, nvalue2);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       get = hashMap_get(map, key3);
+       CU_ASSERT_STRING_EQUAL(get, value3);
+
+       // Add fourth entry with NULL value
+       char * key4 = "key4";
+       char * value4 = NULL;
+       hashMap_put(map, key4, value4);
+
+       get = hashMap_get(map, key4);
+       CU_ASSERT_EQUAL(get, value4);
+}
+
+void test_hashMap_resize(void) {
+       hashMap_clear(map);
+
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_EQUAL(map->tablelength, 16);
+       CU_ASSERT_EQUAL(map->treshold, 12);
+       int i;
+       for (i = 0; i < 12; i++) {
+               char key[6];
+               sprintf(key, "key%d", i);
+               char * k = strdup(key);
+               hashMap_put(map, k, k);
+       }
+       CU_ASSERT_EQUAL(map->size, 12);
+       CU_ASSERT_EQUAL(map->tablelength, 16);
+       CU_ASSERT_EQUAL(map->treshold, 12);
+
+       char key[6];
+       sprintf(key, "key%d", i);
+       hashMap_put(map, strdup(key), strdup(key));
+       CU_ASSERT_EQUAL(map->size, 13);
+       CU_ASSERT_EQUAL(map->tablelength, 32);
+       CU_ASSERT_EQUAL(map->treshold, 24);
+}
+
+void test_hashMap_remove(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry with null key
+       char * key2 = NULL;
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Remove unexisting entry for map
+       char * removeKey = "unexisting";
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 2);
+       CU_ASSERT_FALSE(hashMap_isEmpty(map));
+
+       hashMap_remove(map, key);
+       CU_ASSERT_EQUAL(map->size, 1);
+
+       hashMap_remove(map, key2);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+
+       // Remove unexisting entry for empty map
+       removeKey = "unexisting";
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+}
+
+void test_hashMap_removeMapping(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry with null key
+       char * key2 = NULL;
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       HASH_MAP_ENTRY entry1 = hashMap_getEntry(map, key);
+       HASH_MAP_ENTRY entry2 = hashMap_getEntry(map, key2);
+
+       CU_ASSERT_PTR_NOT_NULL_FATAL(entry1);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(entry2);
+
+       HASH_MAP_ENTRY removed = hashMap_removeMapping(map, entry1);
+       CU_ASSERT_PTR_EQUAL(entry1, removed);
+       CU_ASSERT_EQUAL(map->size, 1);
+
+       removed = hashMap_removeMapping(map, entry2);
+       CU_ASSERT_PTR_EQUAL(entry2, removed);
+       CU_ASSERT_EQUAL(map->size, 0);
+
+       // Remove unexisting entry for empty map
+       hashMap_removeMapping(map, NULL);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+}
+
+void test_hashMap_clear(void) {
+       hashMap_clear(map);
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       // Add fourth entry with NULL value
+       char * key4 = "key4";
+       char * value4 = NULL;
+       hashMap_put(map, key4, value4);
+
+       hashMap_clear(map);
+       CU_ASSERT_EQUAL(map->size, 0);
+}
+
+void test_hashMap_containsValue(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       CU_ASSERT_TRUE(hashMap_containsValue(map, value));
+       CU_ASSERT_TRUE(hashMap_containsValue(map, value2));
+       char * neValue = "notExisting";
+       CU_ASSERT_FALSE(hashMap_containsValue(map, neValue));
+       CU_ASSERT_FALSE(hashMap_containsValue(map, NULL));
+
+       // Add third entry with NULL value
+       char * key3 = "key3";
+       char * value3 = NULL;
+       hashMap_put(map, key3, value3);
+
+       CU_ASSERT_TRUE(hashMap_containsValue(map, value3));
+}
+
+int main (int argc, char** argv) {
+       CU_pSuite pSuite = NULL;
+
+       /* initialize the CUnit test registry */
+       if (CUE_SUCCESS != CU_initialize_registry())
+         return CU_get_error();
+
+       /* add a suite to the registry */
+       pSuite = CU_add_suite("Suite_1", setup, NULL);
+       if (NULL == pSuite) {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* add the tests to the suite */
+       if (NULL == CU_add_test(pSuite, "Map Creation Test", 
test_hashMap_create)
+               || NULL == CU_add_test(pSuite, "Map Size Test", 
test_hashMap_size)
+               || NULL == CU_add_test(pSuite, "Map Is Empty Test", 
test_hashMap_isEmpty)
+               || NULL == CU_add_test(pSuite, "Map Get Test", test_hashMap_get)
+               || NULL == CU_add_test(pSuite, "Map Contains Key Test", 
test_hashMap_containsKey)
+               || NULL == CU_add_test(pSuite, "Map Get Entry Test", 
test_hashMap_getEntry)
+               || NULL == CU_add_test(pSuite, "Map Put Test", test_hashMap_put)
+               || NULL == CU_add_test(pSuite, "Map Resize Test", 
test_hashMap_resize)
+               || NULL == CU_add_test(pSuite, "Map Remove Test", 
test_hashMap_remove)
+               || NULL == CU_add_test(pSuite, "Map Remove Mapping Test", 
test_hashMap_removeMapping)
+               || NULL == CU_add_test(pSuite, "Map Clear Test", 
test_hashMap_clear)
+               || NULL == CU_add_test(pSuite, "Map Contains Value Test", 
test_hashMap_containsValue)
+
+
+       )
+       {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* Run all tests using the CUnit Basic interface */
+       CU_basic_set_mode(CU_BRM_VERBOSE);
+       CU_basic_run_tests();
+       CU_cleanup_registry();
+       return CU_get_error();
+}

Added: incubator/celix/trunk/celix_test/hash_map_test_hash.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/hash_map_test_hash.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/celix_test/hash_map_test_hash.c (added)
+++ incubator/celix/trunk/celix_test/hash_map_test_hash.c Thu Dec  9 11:57:29 
2010
@@ -0,0 +1,322 @@
+/*
+ * hash_map_test.c
+ *
+ *  Created on: Jul 25, 2010
+ *      Author: alexanderb
+ */
+#include <stdio.h>
+#include <string.h>
+
+#include "CUnit/Basic.h"
+
+#include "hash_map.h"
+#include "hash_map_private.h"
+
+HASH_MAP map;
+
+unsigned int test_hashKeyChar(void * k) {
+       char * str = (char *) k;
+
+       unsigned int hash = 1315423911;
+       unsigned int i    = 0;
+       int len = strlen(str);
+
+       for(i = 0; i < len; str++, i++)
+       {
+         hash ^= ((hash << 5) + (*str) + (hash >> 2));
+       }
+
+       return hash;
+}
+
+unsigned int test_hashValueChar(void * v) {
+
+}
+
+int test_equalsKeyChar(void * k, void * o) {
+       return strcmp((char *)k, (char *) o) == 0;
+}
+
+int test_equalsValueChar(void * v, void * o) {
+       return strcmp((char *)v, (char *) o) == 0;
+}
+
+int setup(void) {
+       printf("test\n");
+       map = hashMap_create(test_hashKeyChar, test_hashValueChar, 
test_equalsKeyChar, test_equalsValueChar);
+       if(map == NULL) {
+               return 1;
+       }
+       return 0;
+}
+
+void test_hashMap_get(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Get with new created key
+       char * getKey = strdup("key");
+       char * get = hashMap_get(map, getKey);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(get);
+       CU_ASSERT_STRING_EQUAL(get, value);
+
+       getKey = strdup("key2");
+       get = hashMap_get(map, getKey);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(get);
+       CU_ASSERT_STRING_EQUAL(get, value2);
+
+       char * neKey = strdup("notExisting");
+       get = hashMap_get(map, neKey);
+       CU_ASSERT_EQUAL(get, NULL);
+
+       get = hashMap_get(map, NULL);
+       CU_ASSERT_EQUAL(get, NULL);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       get = hashMap_get(map, NULL);
+       CU_ASSERT_STRING_EQUAL(get, value3);
+}
+
+void test_hashMap_containsKey(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       char * containsKey = strdup("key");
+       CU_ASSERT_TRUE(hashMap_containsKey(map, containsKey));
+       containsKey = strdup("key2");
+       CU_ASSERT_TRUE(hashMap_containsKey(map, containsKey));
+       containsKey = strdup("notExisting");
+       CU_ASSERT_FALSE(hashMap_containsKey(map, containsKey));
+       containsKey = NULL;
+       CU_ASSERT_FALSE(hashMap_containsKey(map, containsKey));
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       containsKey = NULL;
+       CU_ASSERT_TRUE(hashMap_containsKey(map, containsKey));
+}
+
+void test_hashMap_getEntry(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Get with new created key
+       char * getEntryKey = strdup("key");
+       HASH_MAP_ENTRY entry = hashMap_getEntry(map, getEntryKey);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(entry);
+       CU_ASSERT_STRING_EQUAL(entry->key, key);
+       CU_ASSERT_STRING_EQUAL(entry->value, value);
+
+       getEntryKey = strdup("key2");
+       entry = hashMap_getEntry(map, getEntryKey);
+       CU_ASSERT_PTR_NOT_NULL(entry);
+       CU_ASSERT_STRING_EQUAL(entry->key, key2);
+       CU_ASSERT_STRING_EQUAL(entry->value, value2);
+
+       getEntryKey = strdup("notExisting");
+       entry = hashMap_getEntry(map, getEntryKey);
+       CU_ASSERT_EQUAL(entry, NULL);
+
+       getEntryKey = NULL;
+       entry = hashMap_getEntry(map, getEntryKey);
+       CU_ASSERT_EQUAL(entry, NULL);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       getEntryKey = NULL;
+       entry = hashMap_getEntry(map, getEntryKey);
+       CU_ASSERT_EQUAL(entry->key, key3);
+       CU_ASSERT_STRING_EQUAL(entry->value, value3);
+}
+
+void test_hashMap_put(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Get with new key
+       char * getKey = strdup("key");
+       char * get = hashMap_get(map, getKey);
+       CU_ASSERT_STRING_EQUAL(get, value);
+
+       getKey = strdup("key2");
+       get = hashMap_get(map, getKey);
+       CU_ASSERT_STRING_EQUAL(get, value2);
+
+       // Overwrite existing entry
+       char * nkey2 = strdup("key2");
+       char * nvalue2 = "value3";
+       char * old = (char *) hashMap_put(map, nkey2, nvalue2);
+       CU_ASSERT_PTR_NOT_NULL_FATAL(old);
+       CU_ASSERT_STRING_EQUAL(old, value2)
+
+       getKey = strdup("key2");
+       get = hashMap_get(map, key2);
+       CU_ASSERT_STRING_EQUAL(get, nvalue2);
+
+       // Add third entry with NULL key
+       char * key3 = NULL;
+       char * value3 = "value3";
+       hashMap_put(map, key3, value3);
+
+       getKey = NULL;
+       get = hashMap_get(map, key3);
+       CU_ASSERT_STRING_EQUAL(get, value3);
+
+       // Add fourth entry with NULL value
+       char * key4 = "key4";
+       char * value4 = NULL;
+       hashMap_put(map, key4, value4);
+
+       getKey = strdup("key4");
+       get = hashMap_get(map, key4);
+       CU_ASSERT_EQUAL(get, value4);
+}
+
+void test_hashMap_remove(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry with null key
+       char * key2 = NULL;
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       // Remove unexisting entry for map
+       char * removeKey = strdup("unexisting");
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 2);
+       CU_ASSERT_FALSE(hashMap_isEmpty(map));
+
+       // Remove entry with new key
+       removeKey = strdup("key");
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 1);
+
+       removeKey = NULL;
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+
+       // Remove unexisting entry for empty map
+       removeKey = strdup("unexisting");
+       hashMap_remove(map, removeKey);
+       CU_ASSERT_EQUAL(map->size, 0);
+       CU_ASSERT_TRUE(hashMap_isEmpty(map));
+}
+
+void test_hashMap_containsValue(void) {
+       hashMap_clear(map);
+
+       // Add one entry
+       char * key = "key";
+       char * value = "value";
+       hashMap_put(map, key, value);
+
+       // Add second entry
+       char * key2 = "key2";
+       char * value2 = "value2";
+       hashMap_put(map, key2, value2);
+
+       char * containsValue = strdup("value");
+       CU_ASSERT_TRUE(hashMap_containsValue(map, containsValue));
+       containsValue = strdup("value2");
+       CU_ASSERT_TRUE(hashMap_containsValue(map, containsValue));
+       containsValue = strdup("notExisting");
+       CU_ASSERT_FALSE(hashMap_containsValue(map, containsValue));
+       containsValue = NULL;
+       CU_ASSERT_FALSE(hashMap_containsValue(map, containsValue));
+
+       // Add third entry with NULL value
+       char * key3 = "key3";
+       char * value3 = NULL;
+       hashMap_put(map, key3, value3);
+
+       containsValue = NULL;
+       CU_ASSERT_TRUE(hashMap_containsValue(map, containsValue));
+}
+
+int main (int argc, char** argv) {
+       CU_pSuite pSuite = NULL;
+
+       /* initialize the CUnit test registry */
+       if (CUE_SUCCESS != CU_initialize_registry())
+         return CU_get_error();
+
+       /* add a suite to the registry */
+       pSuite = CU_add_suite("Suite_1", setup, NULL);
+       if (NULL == pSuite) {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* add the tests to the suite */
+       if (NULL == CU_add_test(pSuite, "Map Get Test", test_hashMap_get)
+               || NULL == CU_add_test(pSuite, "Map Contains Key Test", 
test_hashMap_containsKey)
+               || NULL == CU_add_test(pSuite, "Map Get Entry Test", 
test_hashMap_getEntry)
+               || NULL == CU_add_test(pSuite, "Map Put Test", test_hashMap_put)
+               || NULL == CU_add_test(pSuite, "Map Remove Test", 
test_hashMap_remove)
+               || NULL == CU_add_test(pSuite, "Map Contains Value Test", 
test_hashMap_containsValue)
+
+
+       )
+       {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* Run all tests using the CUnit Basic interface */
+       CU_basic_set_mode(CU_BRM_VERBOSE);
+       CU_basic_run_tests();
+       CU_cleanup_registry();
+       return CU_get_error();
+}

Added: incubator/celix/trunk/celix_test/test.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/test.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/celix_test/test.c (added)
+++ incubator/celix/trunk/celix_test/test.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,52 @@
+/*
+ * test.c
+ *
+ *  Created on: Jul 16, 2010
+ *      Author: alexanderb
+ */
+#include <stdio.h>
+
+#include "CUnit/Basic.h"
+#include "linkedlist.h"
+
+void test_linkedList_create(void) {
+       LINKED_LIST list = linkedList_create();
+       CU_ASSERT(list != NULL);
+}
+
+void test_linkedList_add(void) {
+       LINKED_LIST list = linkedList_create();
+       linkedList_addElement(list, "element");
+
+       CU_ASSERT_EQUAL(linkedList_size(list), 2);
+}
+
+int main (int argc, char** argv) {
+       CU_pSuite pSuite = NULL;
+
+       /* initialize the CUnit test registry */
+       if (CUE_SUCCESS != CU_initialize_registry())
+         return CU_get_error();
+
+       /* add a suite to the registry */
+       pSuite = CU_add_suite("Suite_1", NULL, NULL);
+       if (NULL == pSuite) {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* add the tests to the suite */
+       if (NULL == CU_add_test(pSuite, "List Creation Test", 
test_linkedList_create) ||
+               NULL == CU_add_test(pSuite, "List Add Test", 
test_linkedList_add))
+       {
+         CU_cleanup_registry();
+         return CU_get_error();
+       }
+
+       /* Run all tests using the CUnit Basic interface */
+       CU_basic_set_mode(CU_BRM_VERBOSE);
+       CU_basic_run_tests();
+       CU_cleanup_registry();
+       //return CU_get_error();
+       return -1;
+}

Added: incubator/celix/trunk/receiver-2.0/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/CMakeLists.txt?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/CMakeLists.txt (added)
+++ incubator/celix/trunk/receiver-2.0/CMakeLists.txt Thu Dec  9 11:57:29 2010
@@ -0,0 +1,6 @@
+add_library(receiver-2.0 SHARED activator serviceTest)
+include_directories("${PROJECT_SOURCE_DIR}/celix" 
"${PROJECT_SOURCE_DIR}/dependency_manager") 
+target_link_libraries(receiver-2.0 dependency_manager framework)
+
+bundle(receiver-2.0)
+package(receiver-2.0 FILES serviceTest.h)
\ No newline at end of file

Added: incubator/celix/trunk/receiver-2.0/MANIFEST/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/MANIFEST/MANIFEST.MF?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/receiver-2.0/MANIFEST/MANIFEST.MF Thu Dec  9 11:57:29 
2010
@@ -0,0 +1,5 @@
+Bundle-SymbolicName: receiver
+Bundle-Version: 2.0.0.test
+library: receiver-2.0
+Export-Service: serviceTest;version="2.0.0"
+Import-Service: serviceTest;version="2.0.0"

Added: incubator/celix/trunk/receiver-2.0/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/activator.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/activator.c (added)
+++ incubator/celix/trunk/receiver-2.0/activator.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,80 @@
+/*
+ * activator.c
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+#include <stdlib.h>
+
+#include "dependency_manager.h"
+#include "dependency_activator_base.h"
+#include "service.h"
+
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "serviceTest.h"
+#include "serviceTest_private.h"
+#include "service_component.h"
+#include "service_component_private.h"
+
+SERVICE_REGISTRATION reg;
+SERVICE_REGISTRATION reg2;
+
+SERVICE_TEST m_test;
+
+SERVICE m_service;
+
+void * dm_create() {
+       return NULL;
+}
+
+void dm_init(void * userData, BUNDLE_CONTEXT context, DEPENDENCY_MANAGER 
manager) {
+       m_test = (SERVICE_TEST) malloc(sizeof(*m_test));
+
+       HASHTABLE props = createProperties();
+       setProperty(props, "test", "test");
+       //setProperty(props, "a", "b");
+       m_test->handle = serviceTest_construct();
+       m_test->doo = doo;
+
+       m_service = dependencyActivatorBase_createService(manager);
+       serviceComponent_setInterface(m_service, SERVICE_TEST_NAME, props);
+       serviceComponent_setImplementation(m_service, m_test);
+
+       dependencyManager_add(manager, m_service);
+}
+
+void dm_destroy(void * userData, BUNDLE_CONTEXT context, DEPENDENCY_MANAGER 
manager) {
+       dependencyManager_remove(manager, m_service);
+}
+
+void service_init(void * userData) {
+
+}
+void service_start(void * userData) {
+
+}
+void service_stop(void * userData) {
+
+}
+void service_destroy(void * userData) {
+
+}
+
+//void bundleActivator_start(BUNDLE_CONTEXT context) {
+//     m_test = (SERVICE_TEST) malloc(sizeof(*m_test));
+//     HASHTABLE props = createProperties();
+//     setProperty(props, "test", "test");
+//     //setProperty(props, "a", "b");
+//     m_test->handle = serviceTest_construct();
+//     m_test->doo = doo;
+//
+//     reg = register_service(context, SERVICE_TEST_NAME, m_test, props);
+//     //reg2 = register_service(context, SERVICE_TEST_NAME, test, NULL);
+//}
+
+//void bundleActivator_stop(BUNDLE_CONTEXT context) {
+//     serviceRegistration_unregister(reg);
+//     serviceTest_destruct(m_test->handle);
+//     free(m_test);
+//}

Added: incubator/celix/trunk/receiver-2.0/serviceTest.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/serviceTest.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/serviceTest.c (added)
+++ incubator/celix/trunk/receiver-2.0/serviceTest.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,30 @@
+/*
+ * listenerTest.c
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+#include "serviceTest.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "serviceTest_private.h"
+
+struct serviceDataType {
+       char * test;
+};
+
+SERVICE_DATA_TYPE serviceTest_construct(void) {
+       SERVICE_DATA_TYPE data = (SERVICE_DATA_TYPE) malloc(sizeof(*data));
+       data->test = strdup("hallo 2.0");
+       return data;
+}
+
+void serviceTest_destruct(SERVICE_DATA_TYPE data) {
+       free(data->test);
+       free(data);
+}
+
+void doo(SERVICE_DATA_TYPE handle) {
+       printf("Data: %s\n", handle->test);
+}

Added: incubator/celix/trunk/receiver-2.0/serviceTest.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/serviceTest.h?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/serviceTest.h (added)
+++ incubator/celix/trunk/receiver-2.0/serviceTest.h Thu Dec  9 11:57:29 2010
@@ -0,0 +1,22 @@
+/*
+ * listenerTest.h
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+
+#ifndef SERVICETEST_H_
+#define SERVICETEST_H_
+
+#define SERVICE_TEST_NAME "serviceTest"
+
+typedef struct serviceDataType * SERVICE_DATA_TYPE;
+
+struct serviceTest {
+       SERVICE_DATA_TYPE handle;
+       void (*doo)(SERVICE_DATA_TYPE handle);
+};
+
+typedef struct serviceTest * SERVICE_TEST;
+
+#endif /* SERVICETEST_H_ */

Added: incubator/celix/trunk/receiver-2.0/serviceTest_private.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/serviceTest_private.h?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver-2.0/serviceTest_private.h (added)
+++ incubator/celix/trunk/receiver-2.0/serviceTest_private.h Thu Dec  9 
11:57:29 2010
@@ -0,0 +1,19 @@
+/*
+ * serviceTest_private.h
+ *
+ *  Created on: Apr 22, 2010
+ *      Author: dk489
+ */
+
+#ifndef SERVICETEST_PRIVATE_H_
+#define SERVICETEST_PRIVATE_H_
+
+#include "serviceTest.h"
+
+SERVICE_DATA_TYPE serviceTest_construct(void);
+void serviceTest_destruct(SERVICE_DATA_TYPE);
+
+void doo(SERVICE_DATA_TYPE handle);
+
+
+#endif /* SERVICETEST_PRIVATE_H_ */

Added: incubator/celix/trunk/receiver/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/CMakeLists.txt?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/CMakeLists.txt (added)
+++ incubator/celix/trunk/receiver/CMakeLists.txt Thu Dec  9 11:57:29 2010
@@ -0,0 +1,6 @@
+add_library(receiver SHARED activator serviceTest)
+include_directories("${PROJECT_SOURCE_DIR}/celix")
+target_link_libraries(receiver framework)
+
+bundle(receiver)
+package(receiver FILES serviceTest.h)
\ No newline at end of file

Added: incubator/celix/trunk/receiver/MANIFEST/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/MANIFEST/MANIFEST.MF?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/receiver/MANIFEST/MANIFEST.MF Thu Dec  9 11:57:29 2010
@@ -0,0 +1,5 @@
+Bundle-SymbolicName: receiver
+Bundle-Version: 1.0.0.test
+library: receiver
+Export-Service: serviceTest;version="1.0.0"
+Import-Service: serviceTest;version="1.0.0"

Added: incubator/celix/trunk/receiver/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/activator.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/activator.c (added)
+++ incubator/celix/trunk/receiver/activator.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,38 @@
+/*
+ * activator.c
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+#include <stdlib.h>
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "serviceTest.h"
+#include "serviceTest_private.h"
+
+SERVICE_REGISTRATION reg;
+SERVICE_REGISTRATION reg2;
+
+SERVICE_TEST m_test;
+
+void bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
+       m_test = (SERVICE_TEST) malloc(sizeof(*m_test));
+       HASHTABLE props = createProperties();
+       setProperty(props, "test", "test");
+       //setProperty(props, "a", "b");
+       m_test->handle = serviceTest_construct();
+       m_test->doo = doo;
+
+       reg = bundleContext_registerService(context, SERVICE_TEST_NAME, m_test, 
props);
+       //reg2 = register_service(context, SERVICE_TEST_NAME, test, NULL);
+}
+
+void bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+       serviceRegistration_unregister(reg);
+       serviceTest_destruct(m_test->handle);
+       free(m_test);
+}
+
+void bundleActivator_destroy(void * userData) {
+
+}

Added: incubator/celix/trunk/receiver/serviceTest.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/serviceTest.c?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/serviceTest.c (added)
+++ incubator/celix/trunk/receiver/serviceTest.c Thu Dec  9 11:57:29 2010
@@ -0,0 +1,30 @@
+/*
+ * listenerTest.c
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+#include "serviceTest.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "serviceTest_private.h"
+
+struct serviceDataType {
+       char * test;
+};
+
+SERVICE_DATA_TYPE serviceTest_construct(void) {
+       SERVICE_DATA_TYPE data = (SERVICE_DATA_TYPE) malloc(sizeof(*data));
+       data->test = strdup("hallo");
+       return data;
+}
+
+void serviceTest_destruct(SERVICE_DATA_TYPE data) {
+       free(data->test);
+       free(data);
+}
+
+void doo(SERVICE_DATA_TYPE handle) {
+       printf("Data: %s\n", handle->test);
+}

Added: incubator/celix/trunk/receiver/serviceTest.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/serviceTest.h?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/serviceTest.h (added)
+++ incubator/celix/trunk/receiver/serviceTest.h Thu Dec  9 11:57:29 2010
@@ -0,0 +1,22 @@
+/*
+ * listenerTest.h
+ *
+ *  Created on: Apr 20, 2010
+ *      Author: dk489
+ */
+
+#ifndef SERVICETEST_H_
+#define SERVICETEST_H_
+
+#define SERVICE_TEST_NAME "serviceTest"
+
+typedef struct serviceDataType * SERVICE_DATA_TYPE;
+
+struct serviceTest {
+       SERVICE_DATA_TYPE handle;
+       void (*doo)(SERVICE_DATA_TYPE handle);
+};
+
+typedef struct serviceTest * SERVICE_TEST;
+
+#endif /* SERVICETEST_H_ */

Added: incubator/celix/trunk/receiver/serviceTest_private.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/serviceTest_private.h?rev=1043911&view=auto
==============================================================================
--- incubator/celix/trunk/receiver/serviceTest_private.h (added)
+++ incubator/celix/trunk/receiver/serviceTest_private.h Thu Dec  9 11:57:29 
2010
@@ -0,0 +1,19 @@
+/*
+ * serviceTest_private.h
+ *
+ *  Created on: Apr 22, 2010
+ *      Author: dk489
+ */
+
+#ifndef SERVICETEST_PRIVATE_H_
+#define SERVICETEST_PRIVATE_H_
+
+#include "serviceTest.h"
+
+SERVICE_DATA_TYPE serviceTest_construct(void);
+void serviceTest_destruct(SERVICE_DATA_TYPE);
+
+void doo(SERVICE_DATA_TYPE handle);
+
+
+#endif /* SERVICETEST_PRIVATE_H_ */


Reply via email to