celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: Revert "CELIX-296: Framework unit tests improvement"
Date Wed, 18 Nov 2015 09:48:09 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 4d1568d34 -> 6d3565039


Revert "CELIX-296: Framework unit tests improvement"

This reverts commit 4d1568d34f62c39c014c14b1f64bf0acfef3d6cf.


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

Branch: refs/heads/develop
Commit: 6d3565039f21350907aaf029fe1b3eb61574bcb6
Parents: 4d1568d
Author: Bjoern Petri <bpetri@apache.org>
Authored: Wed Nov 18 10:45:50 2015 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Wed Nov 18 10:45:50 2015 +0100

----------------------------------------------------------------------
 framework/CMakeLists.txt                        |   5 +-
 framework/private/mock/manifest_mock.c          |   3 +-
 .../resources-test/manifest_sections.txt        |   2 -
 framework/private/src/manifest.c                |   2 +-
 framework/private/src/resolver.c                |   3 +-
 framework/private/test/attribute_test.cpp       | 120 +++++++++++
 framework/private/test/framework_test.cpp       |   3 +-
 framework/private/test/manifest_parser_test.cpp | 210 +------------------
 framework/private/test/manifest_test.cpp        |  12 +-
 framework/private/test/resolver_test.cpp        | 145 +------------
 10 files changed, 143 insertions(+), 362 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index 2bc98e1..2f1e608 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -206,10 +206,9 @@ if (FRAMEWORK)
             private/test/manifest_parser_test.cpp
             private/mock/attribute_mock.c
             private/mock/manifest_mock.c
+            private/mock/capability_mock.c
+            private/mock/requirement_mock.c
             private/mock/version_mock.c
-            private/mock/version_range_mock.c
-            private/src/capability.c
-            private/src/requirement.c
             private/src/utils.c
             private/src/manifest_parser.c
             private/src/celix_errorcodes.c

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/mock/manifest_mock.c
----------------------------------------------------------------------
diff --git a/framework/private/mock/manifest_mock.c b/framework/private/mock/manifest_mock.c
index b5d1fc7..53e688c 100644
--- a/framework/private/mock/manifest_mock.c
+++ b/framework/private/mock/manifest_mock.c
@@ -71,8 +71,7 @@ void manifest_write(manifest_pt manifest, char * filename) {
 }
 
 char * manifest_getValue(manifest_pt manifest, const char * name) {
-	mock_c()->actualCall("manifest_getValue")
-			->withStringParameters("name", name);
+	mock_c()->actualCall("manifest_getValue");
 	return (char *) mock_c()->returnValue().value.stringValue;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/resources-test/manifest_sections.txt
----------------------------------------------------------------------
diff --git a/framework/private/resources-test/manifest_sections.txt b/framework/private/resources-test/manifest_sections.txt
index 2ae2e23..ac513c2 100644
--- a/framework/private/resources-test/manifest_sections.txt
+++ b/framework/private/resources-test/manifest_sections.txt
@@ -8,5 +8,3 @@ a: 1
 
 Name: b
 b: 1
-
-this_line_is_longer_than_allowed_randomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufsjdnaiucbeawncuebfihrandomdatafromhereonoutfnkjdsnfaluebfiaubeiufs

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/src/manifest.c
----------------------------------------------------------------------
diff --git a/framework/private/src/manifest.c b/framework/private/src/manifest.c
index c98f39e..7d41344 100644
--- a/framework/private/src/manifest.c
+++ b/framework/private/src/manifest.c
@@ -108,7 +108,7 @@ celix_status_t manifest_read(manifest_pt manifest, char *filename) {
 
 			len = strlen(lbuf);
 			if (lbuf[--len] != '\n') {
-				framework_logIfError(logger, status, NULL, "Manifest '%s' line too long", filename);
+				printf("MANIFEST: Line too long\n");
 				return CELIX_FILE_IO_EXCEPTION;
 			}
 			if (len > 0 && lbuf[len - 1] == '\r') {

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/src/resolver.c
----------------------------------------------------------------------
diff --git a/framework/private/src/resolver.c b/framework/private/src/resolver.c
index 4d242da..69d2557 100644
--- a/framework/private/src/resolver.c
+++ b/framework/private/src/resolver.c
@@ -30,7 +30,6 @@
 #include "resolver.h"
 #include "linked_list_iterator.h"
 #include "bundle.h"
-#include "celix_log.h"
 
 struct capabilityList {
 	char * serviceName;
@@ -181,7 +180,7 @@ int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt
targetMo
 
                                 module_getSymbolicName(targetModule, &name);
 
-                                fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Unable to resolve:
%s, %s\n", name, targetName);
+                                printf("Unable to resolve: %s, %s\n", name, targetName);
                             }
                             linkedList_destroy(candidates);
                             return -1;

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/test/attribute_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/attribute_test.cpp b/framework/private/test/attribute_test.cpp
new file mode 100644
index 0000000..feba87c
--- /dev/null
+++ b/framework/private/test/attribute_test.cpp
@@ -0,0 +1,120 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * attribute_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "CppUTest/TestHarness.h"
+#include "CppUTest/TestHarness_c.h"
+#include "CppUTest/CommandLineTestRunner.h"
+#include "CppUTestExt/MockSupport.h"
+
+extern "C" {
+#include "attribute_private.h"
+#include "celix_log.h"
+
+framework_logger_pt logger = (framework_logger_pt) 0x42;
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+static char* my_strdup(const char* s){
+	if(s==NULL){
+		return NULL;
+	}
+
+	size_t len = strlen(s);
+
+	char *d = (char*) calloc (len + 1,sizeof(char));
+
+	if (d == NULL){
+		return NULL;
+	}
+
+	strncpy (d,s,len);
+	return d;
+}
+
+TEST_GROUP(attribute) {
+	void setup(void) {
+	}
+
+	void teardown() {
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(attribute, create) {
+	char * key = (char*) my_strdup("key");
+	char * value = (char*) my_strdup("value");
+
+	attribute_pt attribute = NULL;
+	celix_status_t status = attribute_create(key, value, &attribute);
+	STRCMP_EQUAL(key, attribute->key);
+	STRCMP_EQUAL(value, attribute->value);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	mock().expectOneCall("framework_logCode")
+			.withParameter("code", CELIX_ILLEGAL_ARGUMENT);
+
+	status = attribute_create(NULL, NULL, NULL);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+	attribute_destroy(attribute);
+}
+
+TEST(attribute, getKey) {
+	char key[] = "key";
+	char value[] = "value";
+
+	attribute_pt attribute = (attribute_pt) malloc(sizeof(*attribute));
+	attribute->key = key;
+	attribute->value = value;
+
+	char *actual = NULL;
+	attribute_getKey(attribute, &actual);
+	STRCMP_EQUAL(key, actual);
+
+	free(attribute);
+}
+
+TEST(attribute, getValue) {
+	char key[] = "key";
+	char value[] = "value";
+
+	attribute_pt attribute = (attribute_pt) malloc(sizeof(*attribute));
+	attribute->key = key;
+	attribute->value = value;
+
+	char *actual = NULL;
+	attribute_getValue(attribute, &actual);
+	STRCMP_EQUAL(value, actual);
+
+	free(attribute);
+}

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/test/framework_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/framework_test.cpp b/framework/private/test/framework_test.cpp
index b0c5cf8..586b400 100644
--- a/framework/private/test/framework_test.cpp
+++ b/framework/private/test/framework_test.cpp
@@ -56,13 +56,12 @@ TEST(framework, create){
 	framework_pt framework = NULL;
 
 	mock().expectOneCall("bundle_create").ignoreOtherParameters();
-	mock().ignoreOtherCalls();
 
 	framework_create(&framework, properties);
 
 
 	CHECK(framework != NULL);
-	POINTERS_EQUAL(properties, framework->configurationMap);
+	POINTERS_EQUAL(&properties, framework->configurationMap);
 
 	mock().checkExpectations();
 	mock().clear();

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/test/manifest_parser_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/manifest_parser_test.cpp b/framework/private/test/manifest_parser_test.cpp
index b395469..035d0ae 100644
--- a/framework/private/test/manifest_parser_test.cpp
+++ b/framework/private/test/manifest_parser_test.cpp
@@ -25,7 +25,6 @@
  */
 #include <stdlib.h>
 #include <stdio.h>
-#include <string.h>
 
 #include "CppUTest/TestHarness.h"
 #include "CppUTest/TestHarness_c.h"
@@ -33,227 +32,28 @@
 #include "CppUTestExt/MockSupport.h"
 
 extern "C" {
-#include "constants.h"
 #include "manifest_parser.h"
-#include "attribute.h"
 #include "celix_log.h"
 
-framework_logger_pt logger = (framework_logger_pt) 0x42;
+framework_logger_pt logger;
 }
 
 int main(int argc, char** argv) {
 	return RUN_ALL_TESTS(argc, argv);
 }
 
-static char* my_strdup(const char* s) {
-	if (s == NULL) {
-		return NULL;
-	}
-
-	size_t len = strlen(s);
-
-	char *d = (char*) calloc(len + 1, sizeof(char));
-
-	if (d == NULL) {
-		return NULL;
-	}
-
-	strncpy(d, s, len);
-	return d;
-}
-
 TEST_GROUP(manifest_parser) {
 	void setup(void) {
+		logger = (framework_logger_pt) malloc(sizeof(*logger));
+        logger->logFunction = frameworkLogger_log;
 	}
 
 	void teardown() {
+		mock().checkExpectations();
+		mock().clear();
 	}
 };
 
-TEST(manifest_parser, create){
-	module_pt owner = (module_pt) 0x01;
-	manifest_pt manifest = (manifest_pt) 0x02;
-	manifest_parser_pt parser;
-	char * service_name_key = my_strdup("service");
-	char * service_version_key = my_strdup("version");
-
-	//get generic bundle data
-	char * version_str = my_strdup("1.2.3");
-	char * bundle_name = my_strdup("Test_Bundle");
-	version_pt version = (version_pt) 0x03;
-
-	mock().expectOneCall("manifest_getValue")
-			.withParameter("name", OSGI_FRAMEWORK_BUNDLE_VERSION)
-			.andReturnValue(version_str);
-
-	mock().expectOneCall("version_createVersionFromString")
-			.withParameter("versionStr", version_str)
-			.withOutputParameterReturning("version", &version, sizeof(version));
-
-	mock().expectOneCall("manifest_getValue")
-			.withParameter("name", OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME)
-			.andReturnValue(bundle_name);
-
-	//create capabilities
-	char * export_header = my_strdup("export_service_name;version=\"[4.5,6)\",export_service_name2;version=\"[6.5,4)\"");
-	char * cap_name	= my_strdup("export_service_name");
-	char * cap_name2	= my_strdup("export_service_name2");
-	capability_pt cap = (capability_pt) 0x04;
-	capability_pt cap2 = (capability_pt) 0x05;
-	attribute_pt attribute_cap_name = (attribute_pt) 0x06;
-	attribute_pt attribute_cap_version = (attribute_pt) 0x07;
-	attribute_pt attribute_cap_name2 = (attribute_pt) 0x08;
-	attribute_pt attribute_cap_version2 = (attribute_pt) 0x09;
-
-	mock().expectOneCall("manifest_getValue")
-			.withParameter("name", OSGI_FRAMEWORK_EXPORT_LIBRARY)
-			.andReturnValue(export_header);
-
-	//make cap 1
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_name_key)
-			.withParameter("value", cap_name)
-			.withOutputParameterReturning("attribute", &attribute_cap_name, sizeof(attribute_cap_name));
-
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_version_key)
-			.withParameter("value", "[4.5,6)")
-			.withOutputParameterReturning("attribute", &attribute_cap_version, sizeof(attribute_cap_version));
-
-	mock().expectOneCall("attribute_getKey")
-			.withParameter("attribute", attribute_cap_name)
-			.withOutputParameterReturning("key", &service_name_key, sizeof(service_name_key));
-
-	//make cap2
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_name_key)
-			.withParameter("value", cap_name2)
-			.withOutputParameterReturning("attribute", &attribute_cap_name2, sizeof(attribute_cap_name2));
-
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_version_key)
-			.withParameter("value", "[6.5,4)")
-			.withOutputParameterReturning("attribute", &attribute_cap_version2, sizeof(attribute_cap_version2));
-
-	mock().expectOneCall("attribute_getKey")
-			.withParameter("attribute", attribute_cap_name2)
-			.withOutputParameterReturning("key", &service_name_key, sizeof(service_name_key));
-
-	//create requirements
-	char * import_header = my_strdup("import_service_name;version=\"[7.8,9)\",import_service_name2;version=\"[9.8,7)\"");
-	char * req_name	= my_strdup("import_service_name");
-	char * req_name2 = my_strdup("import_service_name2");
-	requirement_pt req = (requirement_pt) 0x0A;
-	requirement_pt req2 = (requirement_pt) 0x0B;
-	attribute_pt attribute_req_name = (attribute_pt) 0x0C;
-	attribute_pt attribute_req_name2 = (attribute_pt) 0x0D;
-	attribute_pt attribute_req_version = (attribute_pt) 0x0E;
-	attribute_pt attribute_req_version2 = (attribute_pt) 0x0F;
-
-	mock().expectOneCall("manifest_getValue")
-			.withParameter("name", OSGI_FRAMEWORK_IMPORT_LIBRARY)
-			.andReturnValue(import_header);
-
-	//make req 1
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_name_key)
-			.withParameter("value", req_name)
-			.withOutputParameterReturning("attribute", &attribute_req_name, sizeof(attribute_req_name));
-
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_version_key)
-			.withParameter("value", "[7.8,9)")
-			.withOutputParameterReturning("attribute", &attribute_req_version, sizeof(attribute_req_version));
 
-	mock().expectOneCall("attribute_getKey")
-			.withParameter("attribute", attribute_req_name)
-			.withOutputParameterReturning("key", &service_name_key, sizeof(service_name_key));
 
-	//make req 2
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_name_key)
-			.withParameter("value", req_name2)
-			.withOutputParameterReturning("attribute", &attribute_req_name2, sizeof(attribute_req_name2));
-
-	mock().expectOneCall("attribute_create")
-			.withParameter("key", service_version_key)
-			.withParameter("value", "[9.8,7)")
-			.withOutputParameterReturning("attribute", &attribute_req_version2, sizeof(attribute_req_version2));
-
-	mock().expectOneCall("attribute_getKey")
-			.withParameter("attribute", attribute_req_name2)
-			.withOutputParameterReturning("key", &service_name_key, sizeof(service_name_key));
-
-
-	//actual call to create
-	manifestParser_create(owner, manifest, &parser);
-
-	//test getters
-	version_pt version_clone = (version_pt) 0x06;
-	version_pt get_version;
-	linked_list_pt get_caps;
-	linked_list_pt get_reqs;
-	char * get_bundle_name;
-	celix_status_t status;
-
-	mock().expectOneCall("version_clone")
-			.withParameter("version", version)
-			.withOutputParameterReturning("clone", &version_clone, sizeof(version_clone));
-
-	status = manifestParser_getBundleVersion(parser, &get_version);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(version_clone, get_version);
-
-	status = manifestParser_getCapabilities(parser, &get_caps);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(linkedList_contains(get_caps, cap));
-	CHECK(linkedList_contains(get_caps, cap2));
-	LONGS_EQUAL(2, linkedList_size(get_caps));
-
-	status = manifestParser_getRequirements(parser, &get_reqs);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(linkedList_contains(get_reqs, req));
-	CHECK(linkedList_contains(get_reqs, req2));
-	LONGS_EQUAL(2, linkedList_size(get_reqs));
-
-	status = manifestParser_getSymbolicName(parser, &get_bundle_name);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	STRCMP_EQUAL(bundle_name, get_bundle_name);
-
-
-	//cleanup
-	mock().expectOneCall("version_destroy")
-			.withParameter("version", version);
-
-	manifestParser_destroy(parser);
-
-	capability_destroy((capability_pt) linkedList_get(get_caps, 0));
-	capability_destroy((capability_pt) linkedList_get(get_caps, 1));
-
-	requirement_destroy((requirement_pt) linkedList_get(get_reqs, 0));
-	requirement_destroy((requirement_pt) linkedList_get(get_reqs, 1));
-
-	linkedList_destroy(get_caps);
-	linkedList_clear(get_reqs);
-	linkedList_destroy(get_reqs);
-
-	free(service_name_key);
-	free(service_version_key);
-
-	free(version_str);
-	free(bundle_name);
-
-	free(export_header);
-	free(cap_name);
-	free(cap_name2);
-
-	free(import_header);
-	free(req_name);
-	free(req_name2);
-
-	free(get_bundle_name);
-
-	mock().checkExpectations();
-	mock().clear();
-}
 

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/test/manifest_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/manifest_test.cpp b/framework/private/test/manifest_test.cpp
index ccd068e..02422aa 100644
--- a/framework/private/test/manifest_test.cpp
+++ b/framework/private/test/manifest_test.cpp
@@ -36,7 +36,7 @@ extern "C" {
 #include "hash_map.h"
 #include "celix_log.h"
 
-framework_logger_pt logger = (framework_logger_pt) 0x42;
+framework_logger_pt logger;
 }
 
 int main(int argc, char** argv) {
@@ -45,6 +45,8 @@ int main(int argc, char** argv) {
 
 TEST_GROUP(manifest) {
 	void setup(void) {
+		logger = (framework_logger_pt) malloc(sizeof(*logger));
+        logger->logFunction = frameworkLogger_log;
 	}
 
 	void teardown() {
@@ -53,12 +55,6 @@ TEST_GROUP(manifest) {
 	}
 };
 
-TEST(manifest, dead_code){
-	manifest_pt empty = NULL;
-	manifest_clear(empty);
-	manifest_write(empty, (char*)"filename");
-}
-
 TEST(manifest, createFromFile) {
     char manifestFile[] = "resources-test/manifest.txt";
     manifest_pt manifest = NULL;
@@ -104,7 +100,7 @@ TEST(manifest, createFromFile) {
 TEST(manifest, createFromFileWithSections) {
     char manifestFile[] = "resources-test/manifest_sections.txt";
     manifest_pt manifest = NULL;
-    //properties_pt properties = properties_create();
+//    properties_pt properties = properties_create();
     properties_pt properties = (properties_pt) 0x40;
     properties_pt properties2 = (properties_pt) 0x41;
     properties_pt properties3 = (properties_pt) 0x42;

http://git-wip-us.apache.org/repos/asf/celix/blob/6d356503/framework/private/test/resolver_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/resolver_test.cpp b/framework/private/test/resolver_test.cpp
index 63301fb..d27178d 100644
--- a/framework/private/test/resolver_test.cpp
+++ b/framework/private/test/resolver_test.cpp
@@ -97,12 +97,10 @@ TEST(resolver, resolve){
 	requirement_pt req2= (requirement_pt) 0x07;
 	capability_pt cap = (capability_pt) 0x08;
 	capability_pt cap2= (capability_pt) 0x09;
-
 	importer_wires_pt get_importer_wires;
 	linked_list_pt get_wire_map;
-	linked_list_pt get_wire_map2;
 
-	//creating modules
+	//creating module
 	linkedList_create(&capabilities);
 	linkedList_create(&empty_capabilities);
 	linkedList_create(&requirements);
@@ -193,13 +191,7 @@ TEST(resolver, resolve){
 			.withParameter("capability", cap2)
 			.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_importer_wires = (importer_wires_pt) linkedList_removeLast(get_wire_map);
 	if ( get_importer_wires->importer == module ) {
@@ -215,22 +207,8 @@ TEST(resolver, resolve){
 		module_setWires(module, get_importer_wires->wires);
 	}
 
-
-	//register as resolved
-	module_setResolved(module);
-	module_setResolved(module2);
-
-	mock().expectNCalls(2, "capability_getServiceName")
-			.withParameter("capability", cap)
-			.withOutputParameterReturning("serviceName", &service_name, sizeof(service_name));
-
-	mock().expectNCalls(2, "capability_getServiceName")
-			.withParameter("capability", cap2)
-			.withOutputParameterReturning("serviceName", &service_name2, sizeof(service_name2));
-
-	resolver_moduleResolved(module2);
-
 	//test resolved module checking
+	module_setResolved(module);
 	POINTERS_EQUAL(NULL, resolver_resolve(module));
 
 	//CLEAN UP
@@ -270,124 +248,17 @@ TEST(resolver, resolve){
 	free(service_name2);
 	free(version);
 }
-
-TEST(resolver, resolve_fail){
+/*
+TEST(resolver, moduleResolved){
 	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")
-			.withParameter("manifest", manifest)
-			.withOutputParameterReturning("manifest_parser", &parser, sizeof(parser))
-			.ignoreOtherParameters();
-	mock().expectOneCall("manifestParser_getSymbolicName")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("symbolicName", &name, sizeof(name));
-	mock().expectOneCall("manifestParser_getBundleVersion")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("version", &version, sizeof(version_pt));
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &empty_capabilities, sizeof(empty_capabilities));
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &requirements, sizeof(requirements));
-	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);
-
-	mock().expectOneCall( "requirement_getTargetName")
-			.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);
+  resolver_moduleResolved(module);
 }
 
-TEST(resolver, moduleResolved){
-	//resolver_moduleResolved(module);
+TEST(resolver, addModule){
+	module_pt module;
+	resolver_addModule(module);
 }
 
-/*
 TEST(resolver, removeModule){
 	module_pt module ;
 


Mime
View raw message