Repository: celix
Updated Branches:
  refs/heads/develop a79524b3d -> b56c47d14


CELIX-322: Memory leaks in resolver and framework tests


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/b56c47d1
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/b56c47d1
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/b56c47d1

Branch: refs/heads/develop
Commit: b56c47d14a66c0bba3937973898fb86c27687877
Parents: a79524b
Author: Bjoern Petri <[email protected]>
Authored: Thu Dec 10 15:55:28 2015 +0100
Committer: Bjoern Petri <[email protected]>
Committed: Thu Dec 10 15:55:28 2015 +0100

----------------------------------------------------------------------
 framework/private/src/resolver.c               | 610 ++++++++++----------
 framework/private/test/bundle_cache_test.cpp   |   8 +
 framework/private/test/bundle_context_test.cpp |  40 ++
 framework/private/test/resolver_test.cpp       | 116 ++--
 4 files changed, 388 insertions(+), 386 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/b56c47d1/framework/private/src/resolver.c
----------------------------------------------------------------------
diff --git a/framework/private/src/resolver.c b/framework/private/src/resolver.c
index 4d242da..aaded68 100644
--- a/framework/private/src/resolver.c
+++ b/framework/private/src/resolver.c
@@ -33,16 +33,16 @@
 #include "celix_log.h"
 
 struct capabilityList {
-       char * serviceName;
-       linked_list_pt capabilities;
+    char * serviceName;
+    linked_list_pt capabilities;
 };
 
 typedef struct capabilityList * capability_list_pt;
 
 struct candidateSet {
-       module_pt module;
-       requirement_pt requirement;
-       linked_list_pt candidates;
+    module_pt module;
+    requirement_pt requirement;
+    linked_list_pt candidates;
 };
 
 typedef struct candidateSet * candidate_set_pt;
@@ -60,204 +60,208 @@ void resolver_removeInvalidCandidate(module_pt module, 
hash_map_pt candidates, l
 linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt 
importer, linked_list_pt wireMap);
 
 linked_list_pt resolver_resolve(module_pt root) {
-       hash_map_pt candidatesMap = NULL;
-       linked_list_pt wireMap = NULL;
-       linked_list_pt resolved = NULL;
-       hash_map_iterator_pt iter = NULL;
-
-       if (module_isResolved(root)) {
-               return NULL;
-       }
-
-       candidatesMap = hashMap_create(NULL, NULL, NULL, NULL);
-
-       if (resolver_populateCandidatesMap(candidatesMap, root) != 0) {
-               hash_map_iterator_pt iter = 
hashMapIterator_create(candidatesMap);
-               while (hashMapIterator_hasNext(iter)) {
-                       hash_map_entry_pt entry = 
hashMapIterator_nextEntry(iter);
-                       linked_list_pt value = hashMapEntry_getValue(entry);
-                       hashMapIterator_remove(iter);
-                       if (value != NULL) {
-                               linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
-                               while (linkedListIterator_hasNext(candSetIter)) 
{
-                                       candidate_set_pt set = 
linkedListIterator_next(candSetIter);
-                                       linkedList_destroy(set->candidates);
-                                       free(set);
-                                       linkedListIterator_remove(candSetIter);
-                               }
-                               linkedListIterator_destroy(candSetIter);
-                               linkedList_destroy(value);
-                       }
-               }
-               hashMapIterator_destroy(iter);
-               hashMap_destroy(candidatesMap, false, false);
-               return NULL;
-       }
-
-       linkedList_create(&wireMap);
-       resolved = resolver_populateWireMap(candidatesMap, root, wireMap);
-       iter = hashMapIterator_create(candidatesMap);
-       while (hashMapIterator_hasNext(iter)) {
-               hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-               linked_list_pt value = hashMapEntry_getValue(entry);
-               hashMapIterator_remove(iter);
-               if (value != NULL) {
-                       linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
-                       while (linkedListIterator_hasNext(candSetIter)) {
-                               candidate_set_pt set = 
linkedListIterator_next(candSetIter);
-                               linkedList_destroy(set->candidates);
-                               free(set);
-                               linkedListIterator_remove(candSetIter);
-                       }
-                       linkedListIterator_destroy(candSetIter);
-                       linkedList_destroy(value);
-               }
-       }
-       hashMapIterator_destroy(iter);
-       hashMap_destroy(candidatesMap, false, false);
-       return resolved;
+    hash_map_pt candidatesMap = NULL;
+    linked_list_pt wireMap = NULL;
+    linked_list_pt resolved = NULL;
+    hash_map_iterator_pt iter = NULL;
+
+    if (module_isResolved(root)) {
+        return NULL;
+    }
+
+    candidatesMap = hashMap_create(NULL, NULL, NULL, NULL);
+
+    if (resolver_populateCandidatesMap(candidatesMap, root) != 0) {
+        hash_map_iterator_pt iter = hashMapIterator_create(candidatesMap);
+        while (hashMapIterator_hasNext(iter)) {
+            hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+            linked_list_pt value = hashMapEntry_getValue(entry);
+            hashMapIterator_remove(iter);
+            if (value != NULL) {
+                linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
+                while (linkedListIterator_hasNext(candSetIter)) {
+                    candidate_set_pt set = 
linkedListIterator_next(candSetIter);
+                    linkedList_destroy(set->candidates);
+                    free(set);
+                    linkedListIterator_remove(candSetIter);
+                }
+                linkedListIterator_destroy(candSetIter);
+                linkedList_destroy(value);
+            }
+        }
+        hashMapIterator_destroy(iter);
+        hashMap_destroy(candidatesMap, false, false);
+        return NULL;
+    }
+
+    linkedList_create(&wireMap);
+    resolved = resolver_populateWireMap(candidatesMap, root, wireMap);
+    iter = hashMapIterator_create(candidatesMap);
+    while (hashMapIterator_hasNext(iter)) {
+        hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+        linked_list_pt value = hashMapEntry_getValue(entry);
+        hashMapIterator_remove(iter);
+        if (value != NULL) {
+            linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
+            while (linkedListIterator_hasNext(candSetIter)) {
+                candidate_set_pt set = linkedListIterator_next(candSetIter);
+                linkedList_destroy(set->candidates);
+                free(set);
+                linkedListIterator_remove(candSetIter);
+            }
+            linkedListIterator_destroy(candSetIter);
+            linkedList_destroy(value);
+        }
+    }
+    hashMapIterator_destroy(iter);
+    hashMap_destroy(candidatesMap, false, false);
+    return resolved;
 }
 
 int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt 
targetModule) {
     linked_list_pt candSetList;
     linked_list_pt candidates;
     linked_list_pt invalid;
-    int i;
-    int c;
-    requirement_pt req;
-    capability_list_pt capList;
-
-       if (hashMap_containsKey(candidatesMap, targetModule)) {
-               return 0;
-       }
-
-       hashMap_put(candidatesMap, targetModule, NULL);
-
-           if (linkedList_create(&candSetList) == CELIX_SUCCESS) {
-            for (i = 0; i < 
linkedList_size(module_getRequirements(targetModule)); i++) {
-               char *targetName = NULL;
-                req = (requirement_pt) 
linkedList_get(module_getRequirements(targetModule), i);
-                requirement_getTargetName(req, &targetName);
-                capList = resolver_getCapabilityList(m_resolvedServices, 
targetName);
-
-                    if (linkedList_create(&candidates) == CELIX_SUCCESS) {
-                        for (c = 0; (capList != NULL) && (c < 
linkedList_size(capList->capabilities)); c++) {
-                            capability_pt cap = (capability_pt) 
linkedList_get(capList->capabilities, c);
-                            bool satisfied = false;
-                            requirement_isSatisfied(req, cap, &satisfied);
-                            if (satisfied) {
-                                linkedList_addElement(candidates, cap);
-                            }
-                        }
-                        capList = 
resolver_getCapabilityList(m_unresolvedServices, targetName);
-                        for (c = 0; (capList != NULL) && (c < 
linkedList_size(capList->capabilities)); c++) {
-                            capability_pt cap = (capability_pt) 
linkedList_get(capList->capabilities, c);
-                            bool satisfied = false;
-                            requirement_isSatisfied(req, cap, &satisfied);
-                            if (satisfied) {
-                                linkedList_addElement(candidates, cap);
-                            }
-                        }
 
-                        if (linkedList_size(candidates) > 0) {
-                            linked_list_iterator_pt iterator = NULL;
-                            for (iterator = 
linkedListIterator_create(candidates, 0); linkedListIterator_hasNext(iterator); 
) {
-                                capability_pt candidate = (capability_pt) 
linkedListIterator_next(iterator);
-                               module_pt module = NULL;
-                               capability_getModule(candidate, &module);
-                                if (!module_isResolved(module)) {
-                                    if 
(resolver_populateCandidatesMap(candidatesMap, module) != 0) {
-                                        linkedListIterator_remove(iterator);
-                                    }
-                                }
-                            }
-                            linkedListIterator_destroy(iterator);
-                        }
-
-                        if (linkedList_size(candidates) == 0) {
-                            if (linkedList_create(&invalid) == CELIX_SUCCESS) {
-                                char *name = NULL;
-                                resolver_removeInvalidCandidate(targetModule, 
candidatesMap, invalid);
+    if (hashMap_containsKey(candidatesMap, targetModule)) {
+        return 0;
+    }
 
-                                module_getSymbolicName(targetModule, &name);
+    hashMap_put(candidatesMap, targetModule, NULL);
+
+    if (linkedList_create(&candSetList) == CELIX_SUCCESS) {
+        int i;
+        for (i = 0; i < linkedList_size(module_getRequirements(targetModule)); 
i++) {
+            capability_list_pt capList;
+            requirement_pt req;
+            char *targetName = NULL;
+            req = (requirement_pt) 
linkedList_get(module_getRequirements(targetModule), i);
+            requirement_getTargetName(req, &targetName);
+            capList = resolver_getCapabilityList(m_resolvedServices, 
targetName);
+
+            if (linkedList_create(&candidates) == CELIX_SUCCESS) {
+                int c;
+                for (c = 0; (capList != NULL) && (c < 
linkedList_size(capList->capabilities)); c++) {
+                    capability_pt cap = (capability_pt) 
linkedList_get(capList->capabilities, c);
+                    bool satisfied = false;
+                    requirement_isSatisfied(req, cap, &satisfied);
+                    if (satisfied) {
+                        linkedList_addElement(candidates, cap);
+                    }
+                }
+                capList = resolver_getCapabilityList(m_unresolvedServices, 
targetName);
+                for (c = 0; (capList != NULL) && (c < 
linkedList_size(capList->capabilities)); c++) {
+                    capability_pt cap = (capability_pt) 
linkedList_get(capList->capabilities, c);
+                    bool satisfied = false;
+                    requirement_isSatisfied(req, cap, &satisfied);
+                    if (satisfied) {
+                        linkedList_addElement(candidates, cap);
+                    }
+                }
 
-                                fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, 
"Unable to resolve: %s, %s\n", name, targetName);
+                if (linkedList_size(candidates) > 0) {
+                    linked_list_iterator_pt iterator = NULL;
+                    for (iterator = linkedListIterator_create(candidates, 0); 
linkedListIterator_hasNext(iterator);) {
+                        capability_pt candidate = (capability_pt) 
linkedListIterator_next(iterator);
+                        module_pt module = NULL;
+                        capability_getModule(candidate, &module);
+                        if (!module_isResolved(module)) {
+                            if (resolver_populateCandidatesMap(candidatesMap, 
module) != 0) {
+                                linkedListIterator_remove(iterator);
                             }
-                            linkedList_destroy(candidates);
-                            return -1;
-                        } else if (linkedList_size(candidates) > 0) {
-                            candidate_set_pt cs = (candidate_set_pt) 
malloc(sizeof(*cs));
-                            cs->candidates = candidates;
-                            cs->module = targetModule;
-                            cs->requirement = req;
-                            linkedList_addElement(candSetList, cs);
                         }
+                    }
+                    linkedListIterator_destroy(iterator);
+                }
+
+                if (linkedList_size(candidates) == 0) {
+                    if (linkedList_create(&invalid) == CELIX_SUCCESS) {
+                        char *name = NULL;
+                        resolver_removeInvalidCandidate(targetModule, 
candidatesMap, invalid);
+
+                        module_getSymbolicName(targetModule, &name);
 
+                        linkedList_destroy(invalid);
+                        fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Unable to 
resolve: %s, %s\n", name, targetName);
+                    }
+                    linkedList_destroy(candidates);
+                    linkedList_destroy(candSetList);
+                    return -1;
+                } else if (linkedList_size(candidates) > 0) {
+                    candidate_set_pt cs = (candidate_set_pt) 
malloc(sizeof(*cs));
+                    cs->candidates = candidates;
+                    cs->module = targetModule;
+                    cs->requirement = req;
+                    linkedList_addElement(candSetList, cs);
                 }
+
             }
-            hashMap_put(candidatesMap, targetModule, candSetList);
-           }
-       return 0;
+        }
+        hashMap_put(candidatesMap, targetModule, candSetList);
+    }
+    return 0;
 }
 
 void resolver_removeInvalidCandidate(module_pt invalidModule, hash_map_pt 
candidates, linked_list_pt invalid) {
-       hash_map_iterator_pt iterator;
-       hashMap_remove(candidates, invalidModule);
-       
-       for (iterator = hashMapIterator_create(candidates); 
hashMapIterator_hasNext(iterator); ) {
-               hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
-               linked_list_pt candSetList = (linked_list_pt) 
hashMapEntry_getValue(entry);
-               if (candSetList != NULL) {
-                       linked_list_iterator_pt itCandSetList;
-                       for (itCandSetList = 
linkedListIterator_create(candSetList, 0); 
linkedListIterator_hasNext(itCandSetList); ) {
-                               candidate_set_pt set = (candidate_set_pt) 
linkedListIterator_next(itCandSetList);
-                               linked_list_iterator_pt candIter;
-                               for (candIter = 
linkedListIterator_create(set->candidates, 0); 
linkedListIterator_hasNext(candIter); ) {
-                                       capability_pt candCap = (capability_pt) 
linkedListIterator_next(candIter);
-                                       module_pt module = NULL;
-                                       capability_getModule(candCap, &module);
-                                       if (module == invalidModule) {
-                                               
linkedListIterator_remove(candIter);
-                                               if 
(linkedList_size(set->candidates) == 0) {
-                                                       
linkedListIterator_remove(itCandSetList);
-                                                       if (module != 
invalidModule && linkedList_contains(invalid, module)) {
-                                                               
linkedList_addElement(invalid, module);
-                                                       }
-                                               }
-                                               break;
-                                       }
-                               }
-                               linkedListIterator_destroy(candIter);
-                       }
-                       linkedListIterator_destroy(itCandSetList);
-               }
-       }
-       hashMapIterator_destroy(iterator);
-
-       if (linkedList_size(invalid) > 0) {
-               while (!linkedList_isEmpty(invalid)) {
-                       module_pt m = (module_pt) 
linkedList_removeIndex(invalid, 0);
-                       resolver_removeInvalidCandidate(m, candidates, invalid);
-               }
-       }
+    hash_map_iterator_pt iterator;
+    hashMap_remove(candidates, invalidModule);
+
+    for (iterator = hashMapIterator_create(candidates); 
hashMapIterator_hasNext(iterator);) {
+        hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+        linked_list_pt candSetList = (linked_list_pt) 
hashMapEntry_getValue(entry);
+        if (candSetList != NULL) {
+            linked_list_iterator_pt itCandSetList;
+            for (itCandSetList = linkedListIterator_create(candSetList, 0); 
linkedListIterator_hasNext(itCandSetList);) {
+                candidate_set_pt set = (candidate_set_pt) 
linkedListIterator_next(itCandSetList);
+                linked_list_iterator_pt candIter;
+                for (candIter = linkedListIterator_create(set->candidates, 0); 
linkedListIterator_hasNext(candIter);) {
+                    capability_pt candCap = (capability_pt) 
linkedListIterator_next(candIter);
+                    module_pt module = NULL;
+                    capability_getModule(candCap, &module);
+                    if (module == invalidModule) {
+                        linkedListIterator_remove(candIter);
+                        if (linkedList_size(set->candidates) == 0) {
+                            linkedListIterator_remove(itCandSetList);
+                            if (module != invalidModule && 
linkedList_contains(invalid, module)) {
+                                linkedList_addElement(invalid, module);
+                            }
+                        }
+                        break;
+                    }
+                }
+                linkedListIterator_destroy(candIter);
+            }
+            linkedListIterator_destroy(itCandSetList);
+        }
+    }
+    hashMapIterator_destroy(iterator);
+
+    if (linkedList_size(invalid) > 0) {
+        while (!linkedList_isEmpty(invalid)) {
+            module_pt m = (module_pt) linkedList_removeIndex(invalid, 0);
+            resolver_removeInvalidCandidate(m, candidates, invalid);
+        }
+    }
 }
 
 void resolver_addModule(module_pt module) {
-    int i;
-    capability_pt cap;
-    capability_list_pt list;
 
-       if (m_modules == NULL) {
-                       linkedList_create(&m_modules);
-                       linkedList_create(&m_unresolvedServices);
-                       linkedList_create(&m_resolvedServices);
-       }
+    if (m_modules == NULL) {
+        linkedList_create(&m_modules);
+        linkedList_create(&m_unresolvedServices);
+        linkedList_create(&m_resolvedServices);
+    }
+
+    if (m_modules != NULL && m_unresolvedServices != NULL) {
+        int i;
 
-       if (m_modules != NULL && m_unresolvedServices != NULL) {
         linkedList_addElement(m_modules, module);
 
         for (i = 0; i < linkedList_size(module_getCapabilities(module)); i++) {
-                       char *serviceName = NULL;
+            char *serviceName = NULL;
+            capability_list_pt list;
+            capability_pt cap;
+
             cap = (capability_pt) 
linkedList_get(module_getCapabilities(module), i);
             capability_getServiceName(cap, &serviceName);
             list = resolver_getCapabilityList(m_unresolvedServices, 
serviceName);
@@ -272,154 +276,155 @@ void resolver_addModule(module_pt module) {
             }
             linkedList_addElement(list->capabilities, cap);
         }
-       }
+    }
 }
 
 void resolver_removeModule(module_pt module) {
     linked_list_pt caps = NULL;
-       linkedList_removeElement(m_modules, module);
+    linkedList_removeElement(m_modules, module);
     caps = module_getCapabilities(module);
-    if (caps != NULL)
-    {
+    if (caps != NULL) {
         int i = 0;
         for (i = 0; i < linkedList_size(caps); i++) {
             capability_pt cap = (capability_pt) linkedList_get(caps, i);
             char *serviceName = NULL;
-                       capability_list_pt list;
-                       capability_getServiceName(cap, &serviceName);
+            capability_list_pt list;
+            capability_getServiceName(cap, &serviceName);
             list = resolver_getCapabilityList(m_unresolvedServices, 
serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
 
                 if (linkedList_isEmpty(list->capabilities)) {
-                                       
linkedList_removeElement(m_unresolvedServices, list);
-                                       linkedList_destroy(list->capabilities);
-                                       free(list->serviceName);
-                                       free(list);
-                               }
+                    linkedList_removeElement(m_unresolvedServices, list);
+                    linkedList_destroy(list->capabilities);
+                    free(list->serviceName);
+                    free(list);
+                }
             }
             list = resolver_getCapabilityList(m_resolvedServices, serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
 
                 if (linkedList_isEmpty(list->capabilities)) {
-                                       
linkedList_removeElement(m_resolvedServices, list);
-                                       linkedList_destroy(list->capabilities);
-                                       free(list->serviceName);
-                                       free(list);
-                               }
+                    linkedList_removeElement(m_resolvedServices, list);
+                    linkedList_destroy(list->capabilities);
+                    free(list->serviceName);
+                    free(list);
+                }
             }
         }
     }
     if (linkedList_isEmpty(m_modules)) {
-       linkedList_destroy(m_modules);
-       m_modules = NULL;
-
-       if (!linkedList_isEmpty(m_unresolvedServices)) {
-               // #TODO: Something is wrong, not all modules have been removed 
from the resolver
-               fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in 
unresolved module list");
-       }
-       linkedList_destroy(m_unresolvedServices);
-       m_unresolvedServices = NULL;
-       if (!linkedList_isEmpty(m_resolvedServices)) {
-                       // #TODO: Something is wrong, not all modules have been 
removed from the resolver
-               fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in 
resolved module list");
-               }
-       linkedList_destroy(m_resolvedServices);
-       m_resolvedServices = NULL;
+        linkedList_destroy(m_modules);
+        m_modules = NULL;
+
+        if (!linkedList_isEmpty(m_unresolvedServices)) {
+            // #TODO: Something is wrong, not all modules have been removed 
from the resolver
+            fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in 
unresolved module list");
+        }
+        linkedList_destroy(m_unresolvedServices);
+        m_unresolvedServices = NULL;
+        if (!linkedList_isEmpty(m_resolvedServices)) {
+            // #TODO: Something is wrong, not all modules have been removed 
from the resolver
+            fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unexpected entries in 
resolved module list");
+        }
+        linkedList_destroy(m_resolvedServices);
+        m_resolvedServices = NULL;
     }
 }
 
 void resolver_moduleResolved(module_pt module) {
-    int capIdx;
-    linked_list_pt capsCopy;
 
-       if (module_isResolved(module)) {
-               if (linkedList_create(&capsCopy) == CELIX_SUCCESS) {
-                linked_list_pt wires = NULL;
+    if (module_isResolved(module)) {
+        linked_list_pt capsCopy = NULL;
 
-                               for (capIdx = 0; 
(module_getCapabilities(module) != NULL) && (capIdx < 
linkedList_size(module_getCapabilities(module))); capIdx++) {
-                    capability_pt cap = (capability_pt) 
linkedList_get(module_getCapabilities(module), capIdx);
-                    char *serviceName = NULL;
-                                       capability_list_pt list;
-                                       capability_getServiceName(cap, 
&serviceName);
-                    list = resolver_getCapabilityList(m_unresolvedServices, 
serviceName);
-                    linkedList_removeElement(list->capabilities, cap);
+        if (linkedList_create(&capsCopy) == CELIX_SUCCESS) {
+            linked_list_pt wires = NULL;
+            int capIdx;
 
-                    linkedList_addElement(capsCopy, cap);
-                }
+            for (capIdx = 0; (module_getCapabilities(module) != NULL) && 
(capIdx < linkedList_size(module_getCapabilities(module))); capIdx++) {
+                capability_pt cap = (capability_pt) 
linkedList_get(module_getCapabilities(module), capIdx);
+                char *serviceName = NULL;
+                capability_list_pt list;
+                capability_getServiceName(cap, &serviceName);
+                list = resolver_getCapabilityList(m_unresolvedServices, 
serviceName);
+                linkedList_removeElement(list->capabilities, cap);
 
-                wires = module_getWires(module);
-                for (capIdx = 0; (capsCopy != NULL) && (capIdx < 
linkedList_size(capsCopy)); capIdx++) {
-                    capability_pt cap = linkedList_get(capsCopy, capIdx);
-
-                    int wireIdx = 0;
-                    for (wireIdx = 0; (wires != NULL) && (wireIdx < 
linkedList_size(wires)); wireIdx++) {
-                        wire_pt wire = (wire_pt) linkedList_get(wires, 
wireIdx);
-                        requirement_pt req = NULL;
-                        bool satisfied = false;
-                        wire_getRequirement(wire, &req);
-                                               requirement_isSatisfied(req, 
cap, &satisfied);
-                        if (satisfied) {
-                            linkedList_set(capsCopy, capIdx, NULL);
-                            break;
-                        }
+                linkedList_addElement(capsCopy, cap);
+            }
+
+            wires = module_getWires(module);
+            for (capIdx = 0; (capsCopy != NULL) && (capIdx < 
linkedList_size(capsCopy)); capIdx++) {
+                capability_pt cap = linkedList_get(capsCopy, capIdx);
+
+                int wireIdx = 0;
+                for (wireIdx = 0; (wires != NULL) && (wireIdx < 
linkedList_size(wires)); wireIdx++) {
+                    wire_pt wire = (wire_pt) linkedList_get(wires, wireIdx);
+                    requirement_pt req = NULL;
+                    bool satisfied = false;
+                    wire_getRequirement(wire, &req);
+                    requirement_isSatisfied(req, cap, &satisfied);
+                    if (satisfied) {
+                        linkedList_set(capsCopy, capIdx, NULL);
+                        break;
                     }
                 }
+            }
+
+            for (capIdx = 0; (capsCopy != NULL) && (capIdx < 
linkedList_size(capsCopy)); capIdx++) {
+                capability_pt cap = linkedList_get(capsCopy, capIdx);
 
-                for (capIdx = 0; (capsCopy != NULL) && (capIdx < 
linkedList_size(capsCopy)); capIdx++) {
-                    capability_pt cap = linkedList_get(capsCopy, capIdx);
-
-                    if (cap != NULL) {
-                       char *serviceName = NULL;
-                                               capability_list_pt list;
-                                               capability_getServiceName(cap, 
&serviceName);
-
-                        list = resolver_getCapabilityList(m_resolvedServices, 
serviceName);
-                        if (list == NULL) {
-                                list = (capability_list_pt) 
malloc(sizeof(*list));
-                                if (list != NULL) {
-                                    list->serviceName = strdup(serviceName);
-                                    if (linkedList_create(&list->capabilities) 
== CELIX_SUCCESS) {
-                                        
linkedList_addElement(m_resolvedServices, list);
-                                    }
-                                }
+                if (cap != NULL) {
+                    char *serviceName = NULL;
+                    capability_list_pt list;
+                    capability_getServiceName(cap, &serviceName);
+
+                    list = resolver_getCapabilityList(m_resolvedServices, 
serviceName);
+                    if (list == NULL) {
+                        list = (capability_list_pt) malloc(sizeof(*list));
+                        if (list != NULL) {
+                            list->serviceName = strdup(serviceName);
+                            if (linkedList_create(&list->capabilities) == 
CELIX_SUCCESS) {
+                                linkedList_addElement(m_resolvedServices, 
list);
+                            }
                         }
-                        linkedList_addElement(list->capabilities, cap);
                     }
+                    linkedList_addElement(list->capabilities, cap);
                 }
+            }
 
-                linkedList_destroy(capsCopy);
-           }
-       }
+            linkedList_destroy(capsCopy);
+        }
+    }
 }
 
 capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * 
name) {
-       capability_list_pt capabilityList = NULL;
-       linked_list_iterator_pt iterator = linkedListIterator_create(list, 0);
-       while (linkedListIterator_hasNext(iterator)) {
-               capability_list_pt services = (capability_list_pt) 
linkedListIterator_next(iterator);
-               if (strcmp(services->serviceName, name) == 0) {
-                       capabilityList = services;
-                       break;
-               }
-       }
-       linkedListIterator_destroy(iterator);
-       return capabilityList;
+    capability_list_pt capabilityList = NULL;
+    linked_list_iterator_pt iterator = linkedListIterator_create(list, 0);
+    while (linkedListIterator_hasNext(iterator)) {
+        capability_list_pt services = (capability_list_pt) 
linkedListIterator_next(iterator);
+        if (strcmp(services->serviceName, name) == 0) {
+            capabilityList = services;
+            break;
+        }
+    }
+    linkedListIterator_destroy(iterator);
+    return capabilityList;
 }
 
 linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt 
importer, linked_list_pt wireMap) {
     linked_list_pt serviceWires;
-       bool resolved = false;
 
     if (candidates && importer && wireMap) {
         linked_list_pt candSetList = NULL;
-               if (module_isResolved(importer)) {
-                   // already resolved
-                   resolved = true;
+        bool resolved = false;
+
+        if (module_isResolved(importer)) {
+            // already resolved
+            resolved = true;
         }
-               if (!resolved) {
-                   bool self = false;
+        if (!resolved) {
+            bool self = false;
             linked_list_iterator_pt wit = linkedListIterator_create(wireMap, 
0);
             while (linkedListIterator_hasNext(wit)) {
                 importer_wires_pt iw = linkedListIterator_next(wit);
@@ -436,39 +441,38 @@ linked_list_pt resolver_populateWireMap(hash_map_pt 
candidates, module_pt import
 
                 if (linkedList_create(&serviceWires) == CELIX_SUCCESS) {
 //                    if (linkedList_create(&emptyWires) == CELIX_SUCCESS) {
-                        int candSetIdx = 0;
-
-                        // hashMap_put(wireMap, importer, emptyWires);
-
-                        char *mname = NULL;
-                        module_getSymbolicName(importer, &mname);
-
-                        importer_wires_pt importerWires = 
malloc(sizeof(*importerWires));
-                        importerWires->importer = importer;
-                        importerWires->wires = NULL;
-                        linkedList_addElement(wireMap, importerWires);
-                        
-                        for (candSetIdx = 0; candSetIdx < 
linkedList_size(candSetList); candSetIdx++) {
-                            candidate_set_pt cs = (candidate_set_pt) 
linkedList_get(candSetList, candSetIdx);
-
-                            module_pt module = NULL;
-                            capability_getModule(((capability_pt) 
linkedList_get(cs->candidates, 0)), &module);
-                            if (importer != module) {
-                                wire_pt wire = NULL;
-                                wire_create(importer, cs->requirement, module,
-                                        ((capability_pt) 
linkedList_get(cs->candidates, 0)), &wire);
-                                linkedList_addElement(serviceWires, wire);
-                            }
+                    int candSetIdx = 0;
+
+                    // hashMap_put(wireMap, importer, emptyWires);
+
+                    char *mname = NULL;
+                    module_getSymbolicName(importer, &mname);
+
+                    importer_wires_pt importerWires = 
malloc(sizeof(*importerWires));
+                    importerWires->importer = importer;
+                    importerWires->wires = NULL;
+                    linkedList_addElement(wireMap, importerWires);
 
-                            wireMap = 
resolver_populateWireMap(candidates,module,wireMap);
+                    for (candSetIdx = 0; candSetIdx < 
linkedList_size(candSetList); candSetIdx++) {
+                        candidate_set_pt cs = (candidate_set_pt) 
linkedList_get(candSetList, candSetIdx);
+
+                        module_pt module = NULL;
+                        capability_getModule(((capability_pt) 
linkedList_get(cs->candidates, 0)), &module);
+                        if (importer != module) {
+                            wire_pt wire = NULL;
+                            wire_create(importer, cs->requirement, module, 
((capability_pt) linkedList_get(cs->candidates, 0)), &wire);
+                            linkedList_addElement(serviceWires, wire);
                         }
 
-                        importerWires->wires = serviceWires;
-                        // hashMap_put(wireMap, importer, serviceWires);
+                        wireMap = resolver_populateWireMap(candidates, module, 
wireMap);
+                    }
+
+                    importerWires->wires = serviceWires;
+                    // hashMap_put(wireMap, importer, serviceWires);
 //                    }
                 }
             }
-               }
+        }
     }
 
     return wireMap;

http://git-wip-us.apache.org/repos/asf/celix/blob/b56c47d1/framework/private/test/bundle_cache_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/bundle_cache_test.cpp 
b/framework/private/test/bundle_cache_test.cpp
index 5c63c5b..1d543d0 100644
--- a/framework/private/test/bundle_cache_test.cpp
+++ b/framework/private/test/bundle_cache_test.cpp
@@ -83,6 +83,8 @@ TEST(bundle_cache, deleteTree) {
 
 
        LONGS_EQUAL(CELIX_SUCCESS, bundleCache_delete(cache));
+
+       free(cache);
 }
 
 TEST(bundle_cache, getArchive) {
@@ -112,9 +114,13 @@ TEST(bundle_cache, getArchive) {
        rmdir(bundle0);
        rmdir(bundle1);
        rmdir(cacheDir);
+       arrayList_destroy(archives);
 
        LONGS_EQUAL(CELIX_SUCCESS, bundleCache_getArchives(cache, &archives));
+
+       arrayList_destroy(archives);
        rmdir(cacheDir);
+       free(cache);
 }
 
 TEST(bundle_cache, createArchive) {
@@ -137,4 +143,6 @@ TEST(bundle_cache, createArchive) {
        bundle_archive_pt actual;
        bundleCache_createArchive(cache, 1l, location, NULL, &actual);
        POINTERS_EQUAL(archive, actual);
+
+       free(cache);
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/b56c47d1/framework/private/test/bundle_context_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/bundle_context_test.cpp 
b/framework/private/test/bundle_context_test.cpp
index fc011df..a83bdfb 100644
--- a/framework/private/test/bundle_context_test.cpp
+++ b/framework/private/test/bundle_context_test.cpp
@@ -64,6 +64,8 @@ TEST(bundle_context, create) {
        POINTERS_EQUAL(bundle, context->bundle)
 
        bundleContext_create(NULL, logger, NULL, &context);
+
+       free(context);
 }
 
 TEST(bundle_context, destroy) {
@@ -108,6 +110,8 @@ TEST(bundle_context, getBundle) {
        actualFramework = NULL;
        status = bundleContext_getFramework(NULL, &actualFramework);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, installBundle) {
@@ -130,6 +134,8 @@ TEST(bundle_context, installBundle) {
        celix_status_t status = bundleContext_installBundle(context, location, 
&actualInstalledBundle);
        LONGS_EQUAL(CELIX_SUCCESS, status);
        POINTERS_EQUAL(installedBundle, actualInstalledBundle);
+
+       free(context);
 }
 
 TEST(bundle_context, installBundle2) {
@@ -159,6 +165,8 @@ TEST(bundle_context, installBundle2) {
        actualInstalledBundle = NULL;
        status = bundleContext_installBundle2(NULL, location, inputFile, 
&actualInstalledBundle);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, registerService) {
@@ -192,6 +200,8 @@ TEST(bundle_context, registerService) {
        actualRegistration = NULL;
        status = bundleContext_registerService(NULL, serviceName, service, 
properties, &actualRegistration);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, registerServiceFactory) {
@@ -225,6 +235,8 @@ TEST(bundle_context, registerServiceFactory) {
        actualRegistration = NULL;
        status = bundleContext_registerServiceFactory(NULL, serviceName, 
serviceFactory, properties, &actualRegistration);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, getServiceReferences) {
@@ -256,6 +268,8 @@ TEST(bundle_context, getServiceReferences) {
        actualReferences = NULL;
        status = bundleContext_getServiceReferences(NULL, serviceName, filter, 
&actualReferences);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, getServiceReference) {
@@ -288,6 +302,8 @@ TEST(bundle_context, getServiceReference) {
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, 
bundleContext_getServiceReference(NULL, serviceName, &actualReference));
        actualReference = NULL;
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, 
bundleContext_getServiceReference(context, NULL, &actualReference));
+
+       free(context);
 }
 
 TEST(bundle_context, ungetServiceReference) {
@@ -308,6 +324,8 @@ TEST(bundle_context, ungetServiceReference) {
        LONGS_EQUAL(CELIX_SUCCESS, bundleContext_ungetServiceReference(context, 
reference));
 
     LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, 
bundleContext_ungetServiceReference(context, NULL));
+
+    free(context);
 }
 
 TEST(bundle_context, getService) {
@@ -337,6 +355,8 @@ TEST(bundle_context, getService) {
        actualService = NULL;
        status = bundleContext_getService(context, NULL, &actualService);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, ungetService) {
@@ -366,6 +386,8 @@ TEST(bundle_context, ungetService) {
        actualResult = false;
        status = bundleContext_ungetService(context, NULL, &actualResult);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, getBundles) {
@@ -391,6 +413,8 @@ TEST(bundle_context, getBundles) {
        actualBundles = NULL;
        status = bundleContext_getBundles(NULL, &actualBundles);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, getBundleById) {
@@ -418,6 +442,8 @@ TEST(bundle_context, getBundleById) {
        actualBundle = NULL;
        status = bundleContext_getBundleById(NULL, id, &actualBundle);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, addServiceListener) {
@@ -443,6 +469,8 @@ TEST(bundle_context, addServiceListener) {
 
        status = bundleContext_addServiceListener(context, NULL, filter);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, removeServiceListener) {
@@ -466,6 +494,8 @@ TEST(bundle_context, removeServiceListener) {
 
        status = bundleContext_removeServiceListener(context, NULL);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, addBundleListener) {
@@ -489,6 +519,8 @@ TEST(bundle_context, addBundleListener) {
 
        status = bundleContext_addBundleListener(context, NULL);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, removeBundleListener) {
@@ -512,6 +544,8 @@ TEST(bundle_context, removeBundleListener) {
 
        status = bundleContext_removeBundleListener(context, NULL);
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+       free(context);
 }
 
 TEST(bundle_context, addFrameworkListener){
@@ -532,6 +566,8 @@ TEST(bundle_context, addFrameworkListener){
                LONGS_EQUAL(CELIX_SUCCESS, 
bundleContext_addFrameworkListener(context, listener));
 
                LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, 
bundleContext_addFrameworkListener(context, NULL));
+
+               free(context);
 }
 
 TEST(bundle_context, removeFrameworkListener){
@@ -552,6 +588,8 @@ TEST(bundle_context, removeFrameworkListener){
                LONGS_EQUAL(CELIX_SUCCESS, 
bundleContext_removeFrameworkListener(context, listener));
 
                LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, 
bundleContext_removeFrameworkListener(context, NULL));
+
+               free(context);
 }
 
 TEST(bundle_context, getProperty) {
@@ -578,5 +616,7 @@ TEST(bundle_context, getProperty) {
 
        actualValue = NULL;
        status = bundleContext_getProperty(context, NULL, &actualValue);
+
        LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+       free(context);
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/b56c47d1/framework/private/test/resolver_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/resolver_test.cpp 
b/framework/private/test/resolver_test.cpp
index 63301fb..f80c900 100644
--- a/framework/private/test/resolver_test.cpp
+++ b/framework/private/test/resolver_test.cpp
@@ -99,8 +99,8 @@ TEST(resolver, resolve){
        capability_pt cap2= (capability_pt) 0x09;
 
        importer_wires_pt get_importer_wires;
-       linked_list_pt get_wire_map;
-       linked_list_pt get_wire_map2;
+       linked_list_pt get_wire_list;
+       linked_list_pt get_wire_list2;
 
        //creating modules
        linkedList_create(&capabilities);
@@ -194,28 +194,35 @@ TEST(resolver, resolve){
                        .withOutputParameterReturning("module", &module2, 
sizeof(module2));
 
 
-       get_wire_map = resolver_resolve(module);
-//TODO Fix this test
-       //should not call any more functions
-       get_wire_map2 = resolver_resolve(module2);
-       LONGS_EQUAL(1/*0*/, linkedList_size(get_wire_map2));
-       //think should equal 0?
+       get_wire_list = resolver_resolve(module);
+       LONGS_EQUAL(2, linkedList_size(get_wire_list));
+       get_wire_list2 = resolver_resolve(module2);
+       LONGS_EQUAL(1, linkedList_size(get_wire_list2)); //creates one empty 
importer wires struct
+
+       get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_list2);
+       LONGS_EQUAL(0, linkedList_size(get_importer_wires->wires));
+       linkedList_destroy(get_importer_wires->wires);
+       free(get_importer_wires);
+       linkedList_destroy(get_wire_list2);
 
-       get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_map);
+       get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_list);
        if ( get_importer_wires->importer == module ) {
                module_setWires(module, get_importer_wires->wires);
-               get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_map);
+               free(get_importer_wires);
+               get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_list);
                POINTERS_EQUAL(get_importer_wires->importer, module2);
                module_setWires(module2, get_importer_wires->wires);
+               free(get_importer_wires);
        } else {
                POINTERS_EQUAL(get_importer_wires->importer, module2);
                module_setWires(module2, get_importer_wires->wires);
-               get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_map);
+               free(get_importer_wires);
+               get_importer_wires = (importer_wires_pt) 
linkedList_removeLast(get_wire_list);
                POINTERS_EQUAL(get_importer_wires->importer, module);
                module_setWires(module, get_importer_wires->wires);
+               free(get_importer_wires);
        }
 
-
        //register as resolved
        module_setResolved(module);
        module_setResolved(module2);
@@ -262,8 +269,7 @@ TEST(resolver, resolve){
        module_destroy(module);
        module_destroy(module2);
 
-       linkedList_destroy(get_wire_map);
-
+       linkedList_destroy(get_wire_list);
        free(id);
        free(id2);
        free(service_name);
@@ -273,38 +279,25 @@ TEST(resolver, resolve){
 
 TEST(resolver, resolve_fail){
        module_pt module;
-       module_pt module2;
        manifest_pt manifest = (manifest_pt) 0x01;
-       manifest_pt manifest2 = (manifest_pt) 0x02;
        manifest_parser_pt parser = (manifest_parser_pt) 0x03;
-       manifest_parser_pt parser2 = (manifest_parser_pt) 0x04;
        bundle_pt bundle = (bundle_pt) 0x05;
        version_pt version = (version_pt) malloc(sizeof(*version));
-       linked_list_pt capabilities = NULL;
        linked_list_pt requirements = NULL;
        linked_list_pt empty_capabilities = NULL;
-       linked_list_pt empty_requirements = NULL;
        char * name = my_strdup("module_one");
-       char * name2 = my_strdup("module_two");
        char * id = my_strdup("42");
-       char * id2 = my_strdup("43");
        char * service_name = my_strdup("test_service_foo");
        requirement_pt req = (requirement_pt) 0x06;
        requirement_pt req2= (requirement_pt) 0x07;
-       capability_pt cap = (capability_pt) 0x08;
-       capability_pt cap2= (capability_pt) 0x09;
        linked_list_pt get_wire_map;
 
        //creating modules
-       linkedList_create(&capabilities);
        linkedList_create(&empty_capabilities);
        linkedList_create(&requirements);
-       linkedList_create(&empty_requirements);
 
        linkedList_addElement(requirements, req);
        linkedList_addElement(requirements, req2);
-       linkedList_addElement(capabilities, cap);
-       linkedList_addElement(capabilities, cap2);
 
 
        mock().expectOneCall("manifestParser_create")
@@ -326,27 +319,7 @@ TEST(resolver, resolve_fail){
        mock().expectOneCall("manifestParser_destroy")
                        .withParameter("manifest_parser", parser);
 
-       mock().expectOneCall("manifestParser_create")
-                       .withParameter("manifest", manifest2)
-                       .withOutputParameterReturning("manifest_parser", 
&parser2, sizeof(parser2))
-                       .ignoreOtherParameters();
-       mock().expectOneCall("manifestParser_getSymbolicName")
-                       .withParameter("parser", parser2)
-                       .withOutputParameterReturning("symbolicName", &name2, 
sizeof(name2));
-       mock().expectOneCall("manifestParser_getBundleVersion")
-                       .withParameter("parser", parser2)
-                       .withOutputParameterReturning("version", &version, 
sizeof(version_pt));
-       mock().expectOneCall("manifestParser_getCapabilities")
-                       .withParameter("parser", parser2)
-                       .withOutputParameterReturning("capabilities", 
&capabilities, sizeof(linked_list_pt));
-       mock().expectOneCall("manifestParser_getCurrentRequirements")
-                       .withParameter("parser", parser2)
-                       .withOutputParameterReturning("requirements", 
&empty_requirements, sizeof(linked_list_pt));
-       mock().expectOneCall("manifestParser_destroy")
-                       .withParameter("manifest_parser", parser2);
-
        module = module_create(manifest, id, bundle);
-       module2 = module_create(manifest2, id2, bundle);
 
        resolver_addModule(module);
 
@@ -354,49 +327,26 @@ TEST(resolver, resolve_fail){
                        .withParameter("requirement", req)
                        .withOutputParameterReturning("targetName", 
&service_name, sizeof(service_name));
 
-       /*mock().expectOneCall("requirement_getTargetName")
-                       .withParameter("requirement", req2)
-                       .withOutputParameterReturning("targetName", 
&service_name2, sizeof(service_name2));
-
-       bool out = true;
-       mock().expectOneCall("requirement_isSatisfied")
-                       .withParameter("requirement", req)
-                       .withParameter("capability", cap)
-                       .withOutputParameterReturning("inRange", &out, 
sizeof(out));
-
-       mock().expectOneCall("requirement_isSatisfied")
-                       .withParameter("requirement", req2)
-                       .withParameter("capability", cap2)
-                       .withOutputParameterReturning("inRange", &out, 
sizeof(out));
-
-       mock().expectNCalls(2, "capability_getModule")
-                       .withParameter("capability", cap)
-                       .withOutputParameterReturning("module", &module2, 
sizeof(module2));
-
-       mock().expectNCalls(2, "capability_getModule")
-                       .withParameter("capability", cap2)
-                       .withOutputParameterReturning("module", &module2, 
sizeof(module2));*/
-
        mock().expectOneCall("framework_log");
 
        get_wire_map = resolver_resolve(module);
        POINTERS_EQUAL(NULL, get_wire_map);
-}
-
-TEST(resolver, moduleResolved){
-       //resolver_moduleResolved(module);
-}
-
-/*
-TEST(resolver, removeModule){
-       module_pt module ;
-
-       module = module_create(actual_manifest, actual_id, actual_bundle);
 
+       //cleanup
        resolver_removeModule(module);
-}
-*/
 
+       mock().expectOneCall("requirement_destroy")
+                       .withParameter("requirement", req);
 
+       mock().expectOneCall("requirement_destroy")
+                       .withParameter("requirement", req2);
 
+       mock().expectOneCall("version_destroy")
+                       .withParameter("version", version);
+
+       module_destroy(module);
 
+       free(service_name);
+       free(version);
+       free(id);
+}

Reply via email to