celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [07/51] [partial] celix git commit: CELIX-424: Cleans up the directory structure. Moves all libraries to the libs subdir and all bundles to the bundles subdir
Date Sun, 27 May 2018 18:36:50 GMT
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/private/test/module_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/module_test.cpp b/framework/private/test/module_test.cpp
deleted file mode 100644
index a5af381..0000000
--- a/framework/private/test/module_test.cpp
+++ /dev/null
@@ -1,396 +0,0 @@
-/**
- *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.
- */
-/*
- * module_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 "module.h"
-
-#include "manifest_parser.h"
-}
-
-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(module) {
-	void setup(void) {
-	}
-
-	void teardown() {
-		mock().checkExpectations();
-		mock().clear();
-	}
-};
-
-TEST(module, create){
-	module_pt module = NULL;
-	manifest_pt actual_manifest = (manifest_pt) 0x01;
-	manifest_parser_pt parser = (manifest_parser_pt) 0x02;
-	bundle_pt actual_bundle = (bundle_pt) 0x03;
-	version_pt actual_version = (version_pt) 0x04;
-	linked_list_pt actual_capabilities = NULL;
-	linked_list_pt actual_requirements= NULL;
-	char * actual_name = my_strdup("module");
-	char * actual_id = my_strdup("42");
-
-	linkedList_create(&actual_capabilities);
-	linkedList_create(&actual_requirements);
-	mock().expectOneCall("manifestParser_create")
-			.withParameter("manifest", actual_manifest)
-			.withOutputParameterReturning("manifest_parser", &parser, sizeof(parser))
-			.ignoreOtherParameters();
-	mock().expectOneCall("manifestParser_getSymbolicName")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("symbolicName", &actual_name, sizeof(actual_name) );
-	mock().expectOneCall("manifestParser_getBundleVersion")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("version", &actual_version, sizeof(actual_version) );
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &actual_capabilities, sizeof(actual_capabilities) );
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &actual_requirements, sizeof(actual_requirements) );
-	mock().expectOneCall("manifestParser_destroy")
-			.withParameter("manifest_parser", parser);
-
-	module = module_create(actual_manifest, actual_id, actual_bundle);
-	CHECK(module != NULL);
-
-	mock().expectOneCall("version_destroy")
-			.withParameter("version", actual_version);
-	module_destroy(module);
-
-	free(actual_id);
-}
-
-TEST(module, createFrameworkModule){
-	module_pt module = NULL;
-	bundle_pt actual_bundle = (bundle_pt) 0x01;
-	version_pt actual_version = (version_pt) 0x02;
-
-	mock().expectOneCall("version_createVersion")
-			.withParameter("major", 1)
-			.withParameter("minor", 0)
-			.withParameter("micro", 0)
-			.withParameter("qualifier", "")
-			.withOutputParameterReturning("version", &actual_version, sizeof(actual_version));
-
-	module = module_createFrameworkModule(actual_bundle);
-
-	CHECK(module != NULL);
-
-	mock().expectOneCall("version_destroy")
-			.withParameter("version", actual_version);
-
-	module_destroy(module);
-}
-
-TEST(module, resolved){
-	module_pt module = NULL;
-	manifest_pt actual_manifest = (manifest_pt) 0x01;
-	manifest_parser_pt parser = (manifest_parser_pt) 0x02;
-	bundle_pt actual_bundle = (bundle_pt) 0x03;
-	version_pt actual_version = (version_pt) 0x04;
-	linked_list_pt actual_capabilities = NULL;
-	linked_list_pt actual_requirements= NULL;
-	char * actual_name = my_strdup("module");
-	char * actual_id = my_strdup("42");
-
-	linkedList_create(&actual_capabilities);
-	linkedList_create(&actual_requirements);
-	mock().expectOneCall("manifestParser_create")
-			.withParameter("manifest", actual_manifest)
-			.withOutputParameterReturning("manifest_parser", &parser, sizeof(parser))
-			.ignoreOtherParameters();
-	mock().expectOneCall("manifestParser_getSymbolicName")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("symbolicName", &actual_name, sizeof(actual_name) );
-	mock().expectOneCall("manifestParser_getBundleVersion")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("version", &actual_version, sizeof(actual_version) );
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &actual_capabilities, sizeof(actual_capabilities) );
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &actual_requirements, sizeof(actual_requirements) );
-	mock().expectOneCall("manifestParser_destroy")
-			.withParameter("manifest_parser", parser);
-	module = module_create(actual_manifest, actual_id, actual_bundle);
-
-	CHECK_FALSE(module_isResolved(module));
-	module_setResolved(module);
-	CHECK(module_isResolved(module));
-
-	mock().expectOneCall("version_destroy")
-			.withParameter("version", actual_version);
-	module_destroy(module);
-
-	free(actual_id);
-}
-
-TEST(module, wires){
-	manifest_pt manifest = (manifest_pt) 0x01;
-	manifest_parser_pt parser = (manifest_parser_pt) 0x02;
-	bundle_pt bundle = (bundle_pt) 0x03;
-	version_pt version = (version_pt) 0x04;
-	wire_pt wire = (wire_pt) 0x05;
-	wire_pt wire_new = (wire_pt) 0x06;
-	capability_pt cap = (capability_pt) 0x07;
-	requirement_pt req = (requirement_pt) 0x08;
-	char * service_name = my_strdup("foobar");
-
-	//test var declarations
-	array_list_pt get_list = NULL;
-
-	//module related declares
-	module_pt module = NULL;
-	char * name = my_strdup("module_1");
-	char * id = my_strdup("42");
-	linked_list_pt capabilities = NULL;
-	linked_list_pt requirements = NULL;
-	linked_list_pt wires = NULL;
-	linked_list_pt wires_new = NULL;
-
-	//module2 related declares
-	module_pt module2 = NULL;
-	char * name2 = my_strdup("module_2");
-	char * id2 = my_strdup("43");
-	linked_list_pt capabilities2 = NULL;
-	linked_list_pt requirements2 = NULL;
-
-	//create module
-	linkedList_create(&capabilities);
-	linkedList_create(&requirements);
-	linkedList_create(&wires);
-	linkedList_addElement(capabilities, cap);
-	linkedList_addElement(requirements, req);
-	linkedList_addElement(wires, wire);
-
-	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) );
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &capabilities, sizeof(capabilities) );
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &requirements, sizeof(requirements) );
-	mock().expectOneCall("manifestParser_destroy")
-			.withParameter("manifest_parser", parser);
-	module = module_create(manifest, id, bundle);
-
-	//create module2
-	linkedList_create(&capabilities2);
-	linkedList_create(&requirements2);
-	linkedList_create(&wires_new);
-	linkedList_addElement(wires_new, wire_new);
-
-	mock().expectOneCall("manifestParser_create")
-			.withParameter("manifest", manifest)
-			.withOutputParameterReturning("manifest_parser", &parser, sizeof(parser))
-			.ignoreOtherParameters();
-	mock().expectOneCall("manifestParser_getSymbolicName")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("symbolicName", &name2, sizeof(name2) );
-	mock().expectOneCall("manifestParser_getBundleVersion")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("version", &version, sizeof(version) );
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &capabilities2, sizeof(capabilities2) );
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &requirements2, sizeof(requirements2) );
-	mock().expectOneCall("manifestParser_destroy")
-			.withParameter("manifest_parser", parser);
-	module2 = module_create(manifest, id2, bundle);
-
-	//test empty wires handling
-	POINTERS_EQUAL(NULL, module_getWire(module, service_name));
-
-	//expect the adding of wire
-	mock().expectOneCall("wire_getExporter")
-					.withParameter("wire", wire)
-					.withOutputParameterReturning("exporter", &module2, sizeof(module2));
-
-	//set modules->wires = actual_wires, and register module dependent at module2
-	module_setWires(module, wires);
-
-	//expect getting of wire vars
-	mock().expectOneCall("wire_getCapability")
-			.withParameter("wire", wire)
-			.withOutputParameterReturning("capability", &cap, sizeof(cap));
-
-	mock().expectOneCall("capability_getServiceName")
-			.withParameter("capability", cap)
-			.withOutputParameterReturning("serviceName", &service_name, sizeof(service_name));
-
-	//test for added wire
-	POINTERS_EQUAL(wire, module_getWire(module, service_name));
-
-	//test added dependent module (method 1 of 2)
-	get_list = module_getDependents(module2);
-	CHECK(arrayList_contains(get_list, module));
-
-	//expect the re-adding of wire
-	//expect the adding of wire
-	mock().expectOneCall("wire_getExporter")
-					.withParameter("wire", wire)
-					.withOutputParameterReturning("exporter", &module2, sizeof(module2));
-
-	mock().expectOneCall("wire_destroy")
-			.withParameter("wire", wire);
-
-	mock().expectOneCall("wire_getExporter")
-					.withParameter("wire", wire_new)
-					.withOutputParameterReturning("exporter", &module2, sizeof(module2));
-
-	//test clearing of the wires before adding back wire
-	module_setWires(module, wires_new);
-
-	//test added dependent module (method 2 of 2)
-	CHECK(arrayList_contains(module_getDependentImporters(module2),module));
-
-	//check getwires
-	POINTERS_EQUAL(wires_new, module_getWires(module));
-
-	//TODO make tests for possible implementations of the following functions
-	module_addDependentRequirer(module, module2);
-	module_getDependentRequirers(module);
-	module_removeDependentRequirer(module, module2);
-
-	//clean up
-	mock().expectNCalls(2, "version_destroy")
-			.withParameter("version", version);
-
-	mock().expectOneCall("wire_destroy")
-			.withParameter("wire", wire_new);
-
-	mock().expectOneCall("capability_destroy")
-			.withParameter("capability", cap);
-
-	mock().expectOneCall("requirement_destroy")
-			.withParameter("requirement", req);
-	module_destroy(module);
-	module_destroy(module2);
-
-	arrayList_destroy(get_list);
-	free(id);
-	free(id2);
-	free(service_name);
-}
-
-TEST(module, get){
-	module_pt module = NULL;
-	manifest_pt actual_manifest = (manifest_pt) 0x01;
-	manifest_parser_pt parser = (manifest_parser_pt) 0x02;
-	bundle_pt actual_bundle = (bundle_pt) 0x03;
-	version_pt actual_version = (version_pt) 0x04;
-	linked_list_pt actual_capabilities = NULL;
-	linked_list_pt actual_requirements= NULL;
-	char * actual_name = my_strdup("module");
-	char * actual_id = my_strdup("42");
-	char * get = NULL;
-
-	linkedList_create(&actual_capabilities);
-	linkedList_create(&actual_requirements);
-
-	mock().expectOneCall("manifestParser_create")
-			.withParameter("manifest", actual_manifest)
-			.withOutputParameterReturning("manifest_parser", &parser, sizeof(parser))
-			.ignoreOtherParameters();
-	mock().expectOneCall("manifestParser_getSymbolicName")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("symbolicName", &actual_name, sizeof(actual_name) );
-	mock().expectOneCall("manifestParser_getBundleVersion")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("version", &actual_version, sizeof(actual_version) );
-	mock().expectOneCall("manifestParser_getCapabilities")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("capabilities", &actual_capabilities, sizeof(actual_capabilities) );
-	mock().expectOneCall("manifestParser_getCurrentRequirements")
-			.withParameter("parser", parser)
-			.withOutputParameterReturning("requirements", &actual_requirements, sizeof(actual_requirements) );
-	mock().expectOneCall("manifestParser_destroy")
-			.withParameter("manifest_parser", parser);
-
-
-	module = module_create(actual_manifest, actual_id, actual_bundle);
-
-	CHECK(module != NULL);
-
-	POINTERS_EQUAL(actual_bundle, module_getBundle(module));
-	POINTERS_EQUAL(actual_requirements, module_getRequirements(module));
-	POINTERS_EQUAL(actual_capabilities, module_getCapabilities(module));
-	POINTERS_EQUAL(actual_version, module_getVersion(module));
-
-	STRCMP_EQUAL(actual_id, module_getId(module));
-
-	LONGS_EQUAL(CELIX_SUCCESS, module_getSymbolicName(module, &get));
-	STRCMP_EQUAL(actual_name, get);
-
-	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, module_getSymbolicName(NULL, &get));
-
-	mock().expectOneCall("version_destroy")
-			.withParameter("version", actual_version);
-
-	module_destroy(module);
-
-	free(actual_id);
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/private/test/requirement_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/requirement_test.cpp b/framework/private/test/requirement_test.cpp
deleted file mode 100644
index d04bf2f..0000000
--- a/framework/private/test/requirement_test.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- *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.
- */
-/*
- * requirement_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 "CppUTest/TestHarness.h"
-#include "CppUTest/TestHarness_c.h"
-#include "CppUTest/CommandLineTestRunner.h"
-#include "CppUTestExt/MockSupport.h"
-
-extern "C" {
-#include "requirement_private.h"
-#include "attribute.h"
-#include "version_range.h"
-#include "celix_log.h"
-#include "utils.h"
-
-framework_logger_pt logger = (framework_logger_pt) 0x42;
-}
-
-int main(int argc, char** argv) {
-	return RUN_ALL_TESTS(argc, argv);
-}
-
-TEST_GROUP(requirement) {
-	void setup(void) {
-	}
-
-	void teardown() {
-		mock().checkExpectations();
-		mock().clear();
-	}
-};
-
-TEST(requirement, create) {
-	requirement_pt requirement = NULL;
-	hash_map_pt directives;
-	hash_map_pt attributes;
-
-	attribute_pt serviceAttribute = (attribute_pt) 0x01;
-	attribute_pt versionAttribute = (attribute_pt) 0x02;
-
-	version_range_pt infiniteRange = (version_range_pt) 0x10;
-	version_range_pt parsedRange = (version_range_pt) 0x11;
-
-	char *value1 = (char *) "target";
-	char *value2 = (char *) "1.0.0";
-
-	//create with infinite version range
-	directives = hashMap_create(NULL, NULL, NULL, NULL);
-	attributes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-	hashMap_put(attributes, (void*) "service", serviceAttribute);
-
-	mock().expectOneCall("attribute_getValue")
-        .withParameter("attribute", serviceAttribute)
-        .withOutputParameterReturning("value", &value1, sizeof(value1))
-        .andReturnValue(CELIX_SUCCESS);
-	mock().expectOneCall("versionRange_createInfiniteVersionRange")
-	    .withOutputParameterReturning("range", &infiniteRange, sizeof(infiniteRange))
-        .andReturnValue(CELIX_SUCCESS);
-
-	requirement_create(directives, attributes, &requirement);
-
-	//clean up
-	mock().expectOneCall("attribute_destroy")
-			.withParameter("attribute", serviceAttribute);
-
-	mock().expectOneCall("versionRange_destroy")
-			.withParameter("range",	infiniteRange);
-
-	requirement_destroy(requirement);
-	requirement = NULL;
-
-	//create with version range
-	directives = hashMap_create(NULL, NULL, NULL, NULL);
-	attributes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
-	hashMap_put(attributes, (void*) "service", serviceAttribute);
-	hashMap_put(attributes, (void*) "version", versionAttribute);
-
-	mock().expectOneCall("attribute_getValue")
-        .withParameter("attribute", serviceAttribute)
-        .withOutputParameterReturning("value", &value1, sizeof(value1))
-        .andReturnValue(CELIX_SUCCESS);
-	mock().expectOneCall("attribute_getValue")
-        .withParameter("attribute", versionAttribute)
-        .withOutputParameterReturning("value", &value2, sizeof(value2))
-        .andReturnValue(CELIX_SUCCESS);
-	mock().expectOneCall("versionRange_parse")
-        .withParameter("rangeStr", (char *) "1.0.0")
-        .withOutputParameterReturning("range", &parsedRange, sizeof(parsedRange))
-        .andReturnValue(CELIX_SUCCESS);
-
-
-	requirement_create(directives, attributes, &requirement);
-
-	//clean up
-	mock().expectOneCall("attribute_destroy")
-			.withParameter("attribute", versionAttribute);
-
-	mock().expectOneCall("attribute_destroy")
-			.withParameter("attribute", serviceAttribute);
-
-	mock().expectOneCall("versionRange_destroy")
-			.withParameter("range", parsedRange);
-
-	requirement_destroy(requirement);
-}
-
-TEST(requirement, getVersionRange) {
-	requirement_pt requirement = (requirement_pt) malloc(sizeof(*requirement));
-	version_range_pt versionRange = (version_range_pt) 0x10;
-	requirement->versionRange = versionRange;
-
-	version_range_pt actual = NULL;
-	requirement_getVersionRange(requirement, &actual);
-	POINTERS_EQUAL(versionRange, actual);
-
-	free(requirement);
-}
-
-TEST(requirement, getTargetName) {
-	requirement_pt requirement = (requirement_pt) malloc(sizeof(*requirement));
-	char targetName[] = "target";
-	requirement->targetName = targetName;
-
-	const char *actual = NULL;
-	requirement_getTargetName(requirement, &actual);
-	STRCMP_EQUAL(targetName, actual);
-
-	free(requirement);
-}
-
-TEST(requirement, isSatisfied) {
-	requirement_pt requirement = (requirement_pt) malloc(sizeof(*requirement));
-	version_range_pt versionRange = (version_range_pt) 0x10;
-	requirement->versionRange = versionRange;
-
-	capability_pt capability = (capability_pt) 0x20;
-	version_pt version = (version_pt) 0x30;
-
-	mock().expectOneCall("capability_getVersion")
-			.withParameter("capability", capability)
-			.withOutputParameterReturning("version", &version, sizeof(version));
-	bool inRange1 = true;
-	mock().expectOneCall("versionRange_isInRange")
-		.withParameter("versionRange", versionRange)
-		.withParameter("version", version)
-		.withOutputParameterReturning("inRange", &inRange1, sizeof(inRange1));
-
-	bool inRange2 = false;
-	requirement_isSatisfied(requirement, capability, &inRange2);
-	CHECK(inRange2);
-
-	free(requirement);
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/private/test/resolver_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/resolver_test.cpp b/framework/private/test/resolver_test.cpp
deleted file mode 100644
index f80c900..0000000
--- a/framework/private/test/resolver_test.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- *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.
- */
-/*
- * resolver_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 "resolver.h"
-#include "celix_log.h"
-#include "manifest_parser.h"
-#include "requirement_private.h"
-#include "capability_private.h"
-#include "version_private.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(resolver) {
-	void setup(void){
-	}
-
-	void teardown(){
-		mock().checkExpectations();
-		mock().clear();
-	}
-};
-
-TEST(resolver, resolve){
-	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");
-	char * service_name2 = my_strdup("test_service_bar");
-	requirement_pt req = (requirement_pt) 0x06;
-	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_list;
-	linked_list_pt get_wire_list2;
-
-	//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);
-
-	mock().expectOneCall("capability_getServiceName")
-			.withParameter("capability", cap)
-			.withOutputParameterReturning("serviceName", &service_name, sizeof(service_name));
-
-	mock().expectOneCall("capability_getServiceName")
-			.withParameter("capability", cap2)
-			.withOutputParameterReturning("serviceName", &service_name2, sizeof(service_name2));
-
-	resolver_addModule(module2);
-
-	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));
-
-
-	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_list);
-	if ( get_importer_wires->importer == module ) {
-		module_setWires(module, get_importer_wires->wires);
-		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);
-		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);
-
-	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
-	POINTERS_EQUAL(NULL, resolver_resolve(module));
-
-	//CLEAN UP
-	mock().expectOneCall("capability_getServiceName")
-			.withParameter("capability", cap)
-			.withOutputParameterReturning("serviceName", &service_name, sizeof(service_name));
-
-	mock().expectOneCall("capability_getServiceName")
-			.withParameter("capability", cap2)
-			.withOutputParameterReturning("serviceName", &service_name2, sizeof(service_name2));
-
-	resolver_removeModule(module2);
-
-	mock().expectOneCall("requirement_destroy")
-			.withParameter("requirement", req);
-
-	mock().expectOneCall("requirement_destroy")
-			.withParameter("requirement", req2);
-
-	mock().expectOneCall("capability_destroy")
-			.withParameter("capability", cap);
-
-	mock().expectOneCall("capability_destroy")
-			.withParameter("capability", cap2);
-
-	mock().expectNCalls(2, "version_destroy")
-			.withParameter("version", version);
-
-	module_destroy(module);
-	module_destroy(module2);
-
-	linkedList_destroy(get_wire_list);
-	free(id);
-	free(id2);
-	free(service_name);
-	free(service_name2);
-	free(version);
-}
-
-TEST(resolver, resolve_fail){
-	module_pt module;
-	manifest_pt manifest = (manifest_pt) 0x01;
-	manifest_parser_pt parser = (manifest_parser_pt) 0x03;
-	bundle_pt bundle = (bundle_pt) 0x05;
-	version_pt version = (version_pt) malloc(sizeof(*version));
-	linked_list_pt requirements = NULL;
-	linked_list_pt empty_capabilities = NULL;
-	char * name = my_strdup("module_one");
-	char * id = my_strdup("42");
-	char * service_name = my_strdup("test_service_foo");
-	requirement_pt req = (requirement_pt) 0x06;
-	requirement_pt req2= (requirement_pt) 0x07;
-	linked_list_pt get_wire_map;
-
-	//creating modules
-	linkedList_create(&empty_capabilities);
-	linkedList_create(&requirements);
-
-	linkedList_addElement(requirements, req);
-	linkedList_addElement(requirements, req2);
-
-
-	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);
-
-	module = module_create(manifest, id, bundle);
-
-	resolver_addModule(module);
-
-	mock().expectOneCall( "requirement_getTargetName")
-			.withParameter("requirement", req)
-			.withOutputParameterReturning("targetName", &service_name, sizeof(service_name));
-
-	mock().expectOneCall("framework_log");
-
-	get_wire_map = resolver_resolve(module);
-	POINTERS_EQUAL(NULL, get_wire_map);
-
-	//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);
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/private/test/service_reference_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/service_reference_test.cpp b/framework/private/test/service_reference_test.cpp
deleted file mode 100644
index 8d2bad4..0000000
--- a/framework/private/test/service_reference_test.cpp
+++ /dev/null
@@ -1,796 +0,0 @@
-/**
- *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.
- */
-/*
- * service_reference_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 "service_reference_private.h"
-#include "service_reference.h"
-#include "constants.h"
-#include "celix_log.h"
-#include "CppUTestExt/MockSupport_c.h"
-
-framework_logger_pt logger = (framework_logger_pt) 0x42;
-
-celix_status_t serviceReferenceTest_getUsingBundles(void * registry, service_registration_pt registration, array_list_pt *bundles){
-	mock_c()->actualCall("serviceReferenceTest_getUsingBundles")
-			->withPointerParameters("registry", (service_registry_pt)registry)
-			->withPointerParameters("registration", registration)
-			->withOutputParameter("bundles", bundles);
-
-	return mock_c()->returnValue().value.intValue;
-}
-}
-
-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(service_reference) {
-	void setup(void) {
-	}
-
-	void teardown() {
-		mock().clear();
-	}
-};
-
-TEST(service_reference, create) {
-	registry_callback_t callback;
-	bundle_pt owner = (bundle_pt) 0x10;
-	bundle_pt bundle = (bundle_pt) 0x20;
-	service_registration_pt registration = (service_registration_pt) 0x30;
-
-	mock().expectOneCall("serviceRegistration_retain")
-			.withParameter("registration", registration);
-
-	mock().expectOneCall("serviceRegistration_getBundle")
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("bundle", &bundle, sizeof(bundle));
-
-	service_reference_pt reference = NULL;
-	serviceReference_create(callback, owner, registration, &reference);
-
-	POINTERS_EQUAL(owner, reference->referenceOwner);
-	POINTERS_EQUAL(registration, reference->registration);
-
-	mock().expectOneCall("serviceRegistration_release")
-			.withParameter("registration", registration);
-
-	bool destroyed;
-	serviceReference_release(reference, &destroyed);
-
-	CHECK(destroyed);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, retain){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	reference->refCount = 1;
-
-    celix_status_t status = serviceReference_retain(reference);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	LONGS_EQUAL(2, reference->refCount);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, release){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	service_registration_pt registration = (service_registration_pt) 0x20;
-	reference->registration = registration;
-	reference->refCount = 2;
-
-	bool destroyed;
-	celix_status_t status = serviceReference_release(reference, &destroyed);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK_FALSE(destroyed);
-	LONGS_EQUAL(1, reference->refCount);
-	
-	mock().expectOneCall("serviceRegistration_release")
-			.withParameter("registration", registration);
-	
-	status = serviceReference_release(reference, &destroyed);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(destroyed);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, increaseUsage){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	reference->usageCount = 1;
-
-	size_t get_count;
-	celix_status_t status = serviceReference_increaseUsage(reference, &get_count);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(2 == get_count);
-	CHECK(2 == reference->usageCount);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, decreaseUsage){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	reference->usageCount = 2;
-
-	//test decreasing usage
-	size_t get_count;
-	celix_status_t status = serviceReference_decreaseUsage(reference, &get_count);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(1 == get_count);
-	CHECK(1 == reference->usageCount);
-
-
-	status = serviceReference_decreaseUsage(reference, &get_count);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(0 == get_count);
-	CHECK(0 == reference->usageCount);
-
-	//test attempting to decrease usage below 0
-	mock().expectOneCall("framework_log");
-
-	status = serviceReference_decreaseUsage(reference, &get_count);
-	LONGS_EQUAL(CELIX_BUNDLE_EXCEPTION, status);
-	CHECK(0 == get_count);
-	CHECK(0 == reference->usageCount);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getUsageCount){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	reference->usageCount = 5;
-
-	size_t get_count;
-	celix_status_t status = serviceReference_getUsageCount(reference, &get_count);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(5 == get_count);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getReferenceCount){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	reference->refCount = 5;
-
-	size_t get_count;
-	celix_status_t status = serviceReference_getReferenceCount(reference, &get_count);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(5 == get_count);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getService){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	void * service = (void*) 0x01;
-	reference->service = service;
-
-	void * get_service;
-	celix_status_t status = serviceReference_getService(reference, &get_service);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(service, get_service);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, setService){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	void * service = (void*) 0x01;
-
-	celix_status_t status = serviceReference_setService(reference, service);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(service, reference->service);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getBundle) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	bundle_pt bundle = (bundle_pt) 0x10;
-	reference->registrationBundle = bundle;
-	reference->registration = (service_registration_pt) 0x20;
-
-	bundle_pt actual = NULL;
-	celix_status_t status = serviceReference_getBundle(reference, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(bundle, actual);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getOwner){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	celixThreadRwlock_create(&reference->lock, NULL);
-	bundle_pt bundle = (bundle_pt) 0x10;
-	reference->registrationBundle = bundle;
-	bundle_pt owner = (bundle_pt) 0x20;
-	reference->referenceOwner = owner;
-	reference->registration = (service_registration_pt) 0x30;
-
-	bundle_pt actual = NULL;
-	celix_status_t status = serviceReference_getOwner(reference, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(owner, actual);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getServiceRegistration) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	service_registration_pt actual = NULL;
-	celix_status_t status = serviceReference_getServiceRegistration(reference, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(registration, actual);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getProperty){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	celixThreadRwlock_create(&reference->lock, NULL);
-	properties_pt props = (properties_pt) 0x20;
-	char * key = my_strdup("key");
-	char * value = my_strdup("value");
-	const char * get_value = (char*) NULL;
-
-	//test getting a property
-	mock().expectOneCall("serviceRegistration_getProperties")
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("properties", &props, sizeof(props));
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", key)
-			.withParameter("properties", props)
-			.ignoreOtherParameters()
-			.andReturnValue(value);
-
-	celix_status_t status = serviceReference_getProperty(reference, key, &get_value);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	STRCMP_EQUAL(value, get_value);
-
-	//check invalid registration
-	reference->registration = (service_registration_pt) NULL;
-
-	status = serviceReference_getProperty(reference, key, &get_value);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(NULL, get_value);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-	free(key);
-	free(value);
-
-	mock().checkExpectations();
-}
-
-static void mock_register_str(char * str){
-	mock().actualCall("mock_register_str")
-			.withStringParameter("str", str);
-}
-
-TEST(service_reference, getPropertyKeys){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	celixThreadRwlock_create(&reference->lock, NULL);
-	properties_pt props = hashMap_create(NULL, NULL, NULL, NULL);
-	char * key = my_strdup("key");
-	char * key2 = my_strdup("key2");
-	char * key3 = my_strdup("key3");
-	hashMap_put(props, key, (void*) 0x01);
-	hashMap_put(props, key2, (void*) 0x02);
-	hashMap_put(props, key3, (void*) 0x03);
-
-	char **keys;
-	unsigned int size;
-	mock().expectOneCall("serviceRegistration_getProperties")
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("properties", &props, sizeof(props));
-
-	serviceReference_getPropertyKeys(reference, &keys, &size);
-
-	UNSIGNED_LONGS_EQUAL(3, size);
-	//check for all 3 keys, in no specific order
-	mock().expectOneCall("mock_register_str")
-			.withParameter("str", key);
-	mock().expectOneCall("mock_register_str")
-			.withParameter("str", key2);
-	mock().expectOneCall("mock_register_str")
-			.withParameter("str", key3);
-
-	mock_register_str(keys[0]);
-	mock_register_str(keys[1]);
-	mock_register_str(keys[2]);
-
-	hashMap_destroy(props, true, false);
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-	free(keys);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, invalidate) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	mock().expectOneCall("serviceRegistration_release")
-			.withParameter("registration", registration);
-
-	celix_status_t status = serviceReference_invalidate(reference);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(NULL, reference->registration);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, isValid){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	reference->registration = (service_registration_pt) 0x10;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	mock().checkExpectations();
-	celix_status_t status;
-	bool result = false;
-
-	//test valid
-	status = serviceReference_isValid(reference, &result);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK(result);
-
-	//test invalid
-	reference->registration = NULL;
-	status = serviceReference_isValid(reference, &result);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	CHECK_FALSE(result);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, isAssignableTo){
-	bool result = false;
-	result = serviceReference_isAssignableTo(NULL, NULL, NULL);
-	CHECK(result);
-}
-
-TEST(service_reference, equals) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	reference->registration = (service_registration_pt) 0x10;
-	bundle_pt bundle = (bundle_pt) 0x20;
-	reference->registrationBundle = bundle;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	service_reference_pt toCompare = (service_reference_pt) malloc(sizeof(*reference));
-	toCompare->registration = (service_registration_pt) 0x10;
-	bundle = (bundle_pt) 0x30;
-	toCompare->registrationBundle = bundle;
-	celixThreadRwlock_create(&toCompare->lock, NULL);
-
-	bool equal = false;
-	celix_status_t status = serviceReference_equals(reference, toCompare, &equal);
-	LONGS_EQUAL(CELIX_SUCCESS, status)
-	LONGS_EQUAL(true, equal);
-
-	toCompare->registration = (service_registration_pt) 0x11;
-
-	equal = true;
-	status = serviceReference_equals(reference, toCompare, &equal);
-	LONGS_EQUAL(CELIX_SUCCESS, status)
-	LONGS_EQUAL(false, equal);
-
-	status = serviceReference_equals(NULL, toCompare, &equal);
-	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
-	LONGS_EQUAL(false, equal);
-
-	celixThreadRwlock_destroy(&toCompare->lock);
-	celixThreadRwlock_destroy(&reference->lock);
-	free(toCompare);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, equals2) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	bundle_pt bundle = (bundle_pt) 0x20;
-	reference->registrationBundle = bundle;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	service_reference_pt toCompare = (service_reference_pt) malloc(sizeof(*reference));
-	registration = (service_registration_pt) 0x10;
-	toCompare->registration = registration;
-	bundle = (bundle_pt) 0x30;
-	toCompare->registrationBundle = bundle;
-	celixThreadRwlock_create(&toCompare->lock, NULL);
-
-	bool equal = serviceReference_equals2(reference, toCompare);
-	LONGS_EQUAL(true, equal);
-
-	celixThreadRwlock_destroy(&toCompare->lock);
-	free(toCompare);
-
-	toCompare = (service_reference_pt) malloc(sizeof(*reference));
-	registration = (service_registration_pt) 0x11;
-	toCompare->registration = registration;
-	bundle = (bundle_pt) 0x30;
-	toCompare->registrationBundle = bundle;
-	celixThreadRwlock_create(&toCompare->lock, NULL);
-
-	equal = serviceReference_equals2(reference, toCompare);
-	LONGS_EQUAL(false, equal);
-
-	celixThreadRwlock_destroy(&toCompare->lock);
-	celixThreadRwlock_destroy(&reference->lock);
-	free(toCompare);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, compareTo){
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	bundle_pt bundle = (bundle_pt) 0x20;
-	reference->registrationBundle = bundle;
-	properties_pt props = (properties_pt) 0x30;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	service_reference_pt reference2 = (service_reference_pt) malloc(sizeof(*reference2));
-	service_registration_pt registration2 = (service_registration_pt) 0x40;
-	reference2->registration = registration2;
-	bundle_pt bundle2 = (bundle_pt) 0x50;
-	reference2->registrationBundle = bundle2;
-	properties_pt props2 = (properties_pt) 0x60;
-	celixThreadRwlock_create(&reference2->lock, NULL);
-
-	int compare;
-
-	mock().expectNCalls(12, "serviceRegistration_getProperties")
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("properties", &props, sizeof(props));
-	mock().expectNCalls(12, "serviceRegistration_getProperties")
-			.withParameter("registration", registration2)
-			.withOutputParameterReturning("properties", &props2, sizeof(props2));
-
-	//service 1 is higher ranked and has a irrelevant ID
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.withParameter("properties", props)
-			.ignoreOtherParameters()
-			.andReturnValue("2");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.withParameter("properties", props2)
-			.ignoreOtherParameters()
-			.andReturnValue("1");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.withParameter("properties", props)
-			.ignoreOtherParameters()
-			.andReturnValue("2");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.withParameter("properties", props2)
-			.ignoreOtherParameters()
-			.andReturnValue("1");
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(1, compare);
-
-	//service 1 is equally ranked and has a lower ID
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.withParameter("properties", props)
-			.ignoreOtherParameters()
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.withParameter("properties", props2)
-			.ignoreOtherParameters()
-			.andReturnValue("2");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.withParameter("properties", props)
-			.ignoreOtherParameters()
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("1");
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(1, compare);
-
-	//service 1 is equally ranked and has a higher ID
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("2");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.withParameter("properties", props2)
-			.ignoreOtherParameters()
-			.andReturnValue("1");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("1");
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(-1, compare);
-
-	//service 1 is lower ranked and has a irrelevant ID
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("2");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("2");
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(-1, compare);
-
-	//service 1 is equal in ID and irrelevantly ranked
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("1);");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("1");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("1");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("1");
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(0, compare);
-
-	//services have no rank and service 1 has a higher ID
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue("2");
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_ID)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue("1");
-
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props)
-			.andReturnValue((void*)NULL);
-	mock().expectOneCall("properties_get")
-			.withParameter("key", OSGI_FRAMEWORK_SERVICE_RANKING)
-			.ignoreOtherParameters()
-			.withParameter("properties", props2)
-			.andReturnValue((void*)NULL);
-
-	serviceReference_compareTo(reference, reference2, &compare);
-	LONGS_EQUAL(-1, compare);
-
-	free(reference);
-	free(reference2);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, hashCode) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	bundle_pt bundle = (bundle_pt) 0x20;
-	reference->registrationBundle = bundle;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	unsigned int hash = serviceReference_hashCode(reference);
-	LONGS_EQUAL(79, hash);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	free(reference);
-
-	mock().checkExpectations();
-}
-
-TEST(service_reference, getUsingBundle) {
-	service_reference_pt reference = (service_reference_pt) malloc(sizeof(*reference));
-	service_registration_pt registration = (service_registration_pt) 0x10;
-	reference->registration = registration;
-	service_registry_pt registry = (service_registry_pt) 0x20;
-	registry_callback_t callback;
-	memset(&callback,0,sizeof(registry_callback_t));
-	callback.getUsingBundles = serviceReferenceTest_getUsingBundles;
-	callback.handle = registry;
-	reference->callback = callback;
-	celixThreadRwlock_create(&reference->lock, NULL);
-
-	//test correct functionality
-	array_list_pt bundles = NULL;
-	arrayList_create(&bundles);
-	bundle_pt bundle = (bundle_pt) 0x30;
-	arrayList_add(bundles, bundle);
-
-	mock().expectOneCall("serviceRegistration_retain")
-			.withParameter("registration", registration);
-
-	mock().expectOneCall("serviceReferenceTest_getUsingBundles")
-			.withParameter("registry", registry)
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("bundles", &bundles, sizeof(bundles));
-
-	mock().expectOneCall("serviceRegistration_release")
-			.withParameter("registration", registration);
-
-	array_list_pt actual = NULL;
-	celix_status_t status = serviceReference_getUsingBundles(reference, &actual);
-	LONGS_EQUAL(status,CELIX_SUCCESS);
-	POINTERS_EQUAL(bundles, actual);
-	LONGS_EQUAL(1, arrayList_size(actual));
-	POINTERS_EQUAL(bundle, arrayList_get(actual, 0));
-
-	//test getusingbundles = null
-	callback.getUsingBundles = NULL;
-	reference->callback = callback;
-	actual = NULL;
-
-	mock().expectOneCall("serviceRegistration_retain")
-			.withParameter("registration", registration);
-	mock().expectOneCall("framework_log");
-	mock().expectOneCall("serviceRegistration_release")
-			.withParameter("registration", registration);
-
-	status = serviceReference_getUsingBundles(reference, &actual);
-	LONGS_EQUAL(status,CELIX_BUNDLE_EXCEPTION);
-	POINTERS_EQUAL(NULL, actual);
-
-	celixThreadRwlock_destroy(&reference->lock);
-	arrayList_destroy(bundles);
-	free(reference);
-
-	mock().checkExpectations();
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/private/test/service_registration_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/service_registration_test.cpp b/framework/private/test/service_registration_test.cpp
deleted file mode 100644
index 68986bf..0000000
--- a/framework/private/test/service_registration_test.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/**
- *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.
- */
-/*
- * service_registration_test.cpp
- *
- *  \date       Feb 8, 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 "CppUTestExt/MockSupport_c.h"
-#include "service_registration_private.h"
-#include "celix_log.h"
-
-framework_logger_pt logger = (framework_logger_pt) 0x42;
-
-typedef celix_status_t (*callback_unregister_signature)(void*, bundle_pt, service_registration_pt);
-typedef celix_status_t (*callback_modified_signature)(void*, service_registration_pt, properties_pt);
-
-celix_status_t serviceRegistrationTest_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service) {
-	mock_c()->actualCall("serviceRegistrationTest_getService")
-			->withPointerParameters("factory", factory)
-			->withPointerParameters("bundle", bundle)
-			->withPointerParameters("registration", registration)
-			->withOutputParameter("service", service);
-	return mock_c()->returnValue().value.intValue;
-}
-
-celix_status_t serviceRegistrationTest_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service) {
-	mock_c()->actualCall("serviceRegistrationTest_ungetService")
-				->withPointerParameters("factory", factory)
-				->withPointerParameters("bundle", bundle)
-				->withPointerParameters("registration", registration)
-				->withOutputParameter("service", service);
-		return mock_c()->returnValue().value.intValue;
-}
-
-}
-
-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(service_registration) {
-	void setup(void) {
-	}
-
-	void teardown() {
-		mock().checkExpectations();
-		mock().clear();
-	}
-};
-
-TEST(service_registration, create) {
-	registry_callback_t callback;
-	service_registry_pt registry = (service_registry_pt) 0x10;
-	callback.handle = registry;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x20;
-	unsigned long serviceId = 1UL;
-	void *service = (void *) 0x30;
-
-	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, serviceId, service, NULL);
-
-	STRCMP_EQUAL(name, registration->className);
-	POINTERS_EQUAL(bundle, registration->bundle);
-	POINTERS_EQUAL(service, registration->svcObj);
-	UNSIGNED_LONGS_EQUAL(serviceId, registration->serviceId);
-
-	LONGS_EQUAL(0, registration->isUnregistering);
-	LONGS_EQUAL(CELIX_PLAIN_SERVICE, registration->svcType);
-	POINTERS_EQUAL(NULL, registration->deprecatedFactory);
-	POINTERS_EQUAL(NULL, registration->factory);
-	POINTERS_EQUAL(NULL, registration->services);
-	LONGS_EQUAL(0, registration->nrOfServices);
-
-	const char* get;
-	get = properties_get(registration->properties, (char*)"service.id");
-	STRCMP_EQUAL("1", get);
-
-	get = properties_get(registration->properties, (char*)"objectClass");
-	STRCMP_EQUAL(name, get);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, createServiceFactory) {
-	registry_callback_t callback;
-	service_registry_pt registry = (service_registry_pt) 0x10;
-	callback.handle = registry;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x20;
-	unsigned long serviceId = 1UL;
-	void *service = (void *) 0x30;
-
-	service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, serviceId, service, NULL);
-
-	STRCMP_EQUAL(name, registration->className);
-	POINTERS_EQUAL(bundle, registration->bundle);
-	POINTERS_EQUAL(service, registration->svcObj);
-	UNSIGNED_LONGS_EQUAL(serviceId, registration->serviceId);
-	LONGS_EQUAL(0, registration->isUnregistering);
-	LONGS_EQUAL(CELIX_DEPRECATED_FACTORY_SERVICE, registration->svcType);
-	POINTERS_EQUAL(service, registration->deprecatedFactory);
-	POINTERS_EQUAL(NULL, registration->services);
-	LONGS_EQUAL(0, registration->nrOfServices);
-
-	const char* get;
-	get = properties_get(registration->properties, (char*)"service.id");
-	STRCMP_EQUAL("1", get);
-
-	get = properties_get(registration->properties, (char*)"objectClass");
-	STRCMP_EQUAL(name, get);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, retain_release){
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-
-	LONGS_EQUAL(1, registration->refCount);
-	serviceRegistration_retain(registration);
-	LONGS_EQUAL(2, registration->refCount);
-	serviceRegistration_release(registration);
-	LONGS_EQUAL(1, registration->refCount);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, isValidTrue) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	void *service = (void *) 0x30;
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, service, NULL);
-
-	bool valid = serviceRegistration_isValid(registration);
-
-	LONGS_EQUAL(1, valid);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, isValidFalse) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-
-	bool valid = serviceRegistration_isValid(registration);
-	LONGS_EQUAL(0, valid);
-
-	valid = serviceRegistration_isValid(NULL);
-	LONGS_EQUAL(0, valid);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, invalidate) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	void *service = (void *) 0x30;
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, service, NULL);
-
-
-	serviceRegistration_invalidate(registration);
-
-	POINTERS_EQUAL(NULL, registration->svcObj);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, unregisterValid) {
-	registry_callback_t callback;
-	callback.unregister = ( (callback_unregister_signature)serviceRegistry_unregisterService );
-	service_registry_pt registry = (service_registry_pt) 0x10;
-	callback.handle = registry;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x20;
-	void *service = (void *) 0x30;
-	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, 0, service, NULL);
-
-	mock().expectOneCall("serviceRegistry_unregisterService")
-		.withParameter("registry", registry)
-		.withParameter("bundle", bundle)
-		.withParameter("registration", registration);
-
-	celix_status_t status = serviceRegistration_unregister(registration);
-
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	LONGS_EQUAL(1, registration->isUnregistering);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, unregisterInvalid) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, 0, NULL, NULL);
-
-	mock().expectOneCall("framework_logCode")
-				.withParameter("code", CELIX_ILLEGAL_STATE);
-
-	celix_status_t status = serviceRegistration_unregister(registration);
-	LONGS_EQUAL(CELIX_ILLEGAL_STATE, status);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, getService) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x10;
-	void *service = (void *) 0x20;
-	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, 0, service, NULL);
-
-	const void *actual = NULL;
-	celix_status_t status = serviceRegistration_getService(registration, bundle, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(service, actual);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, getServiceFromFactory) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x10;
-	void *service = (void *) 0x30;
-	service_factory_pt factory = (service_factory_pt) malloc(sizeof(*factory));
-	factory->getService = serviceRegistrationTest_getService;
-	factory->handle = (void*) 0x40;
-	service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, 0, factory, NULL);
-
-	mock().expectOneCall("serviceRegistrationTest_getService")
-			.withParameter("factory", factory->handle)
-			.withParameter("bundle", bundle)
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("service", &service, sizeof(service));
-
-	const void *actual = NULL;
-	celix_status_t status = serviceRegistration_getService(registration, bundle, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(service, actual);
-
-	serviceRegistration_release(registration);
-	free(name);
-	free(factory);
-}
-
-TEST(service_registration, ungetServiceFromFactory) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x10;
-	void *service = (void *) 0x30;
-	service_factory_pt factory = (service_factory_pt) malloc(sizeof(*factory));
-	factory->ungetService = serviceRegistrationTest_ungetService;
-	factory->handle = (void*) 0x40;
-	service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, 0, factory, NULL);
-
-
-	mock().expectOneCall("serviceRegistrationTest_ungetService")
-			.withParameter("factory", factory->handle)
-			.withParameter("bundle", bundle)
-			.withParameter("registration", registration)
-			.withOutputParameterReturning("service", &service, sizeof(service));
-
-	const void *actual = NULL;
-	celix_status_t status = serviceRegistration_ungetService(registration, bundle, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(service, actual);
-
-	serviceRegistration_release(registration);
-	free(name);
-	free(factory);
-}
-
-
-TEST(service_registration, getProperties) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 5, NULL, NULL);
-
-	properties_pt actual = NULL;
-	celix_status_t status = serviceRegistration_getProperties(registration, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-
-	const char* get;
-	get = properties_get(registration->properties, (char*)"service.id");
-	STRCMP_EQUAL("5", get);
-
-	get = properties_get(registration->properties, (char*)"objectClass");
-	STRCMP_EQUAL(name, get);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, setProperties){
-	registry_callback_t callback;
-	callback.modified = (callback_modified_signature) serviceRegistry_servicePropertiesModified;
-	service_registry_pt registry = (service_registry_pt) 0x10;
-	callback.handle = registry;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-
-	properties_pt properties = properties_create();
-	properties_pt old_properties = registration->properties;
-
-	mock().expectOneCall("serviceRegistry_servicePropertiesModified")
-			.withParameter("registry", registry)
-			.withParameter("registration", registration)
-			.withParameter("oldprops", old_properties);
-
-	serviceRegistration_setProperties(registration, properties);
-
-	POINTERS_EQUAL(properties, registration->properties);
-
-	properties_destroy(old_properties);
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, getServiceName) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-
-	const char *actual = NULL;
-	celix_status_t status = serviceRegistration_getServiceName(registration, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	STRCMP_EQUAL(name, actual);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, getBundle) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	bundle_pt bundle = (bundle_pt) 0x10;
-	service_registration_pt registration = serviceRegistration_create(callback, bundle, name, 0, NULL, NULL);
-
-	bundle_pt actual = NULL;
-	celix_status_t status = serviceRegistration_getBundle(registration, &actual);
-	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(bundle, actual);
-
-	serviceRegistration_release(registration);
-	free(name);
-}
-
-TEST(service_registration, getBundleIllegalArgument) {
-	registry_callback_t callback;
-	char * name = my_strdup("sevice_name");
-	service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL);
-	bundle_pt actual = (bundle_pt) 0x01;
-
-	mock().expectOneCall("framework_logCode")
-			.withParameter("code", CELIX_ILLEGAL_ARGUMENT);
-
-	celix_status_t status = serviceRegistration_getBundle(registration, &actual);
-	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
-
-	serviceRegistration_release(registration);
-	free(name);
-}


Mime
View raw message