celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1660330 - in /celix/trunk/framework: ./ private/mock/ private/src/ private/test/
Date Tue, 17 Feb 2015 09:30:15 GMT
Author: abroekhuis
Date: Tue Feb 17 09:30:14 2015
New Revision: 1660330

URL: http://svn.apache.org/r1660330
Log:
Updated tests to compile again.
- Added missing functions to mocks.
- Updated thread reference to use the actual thread instead of the writer.

Modified:
    celix/trunk/framework/CMakeLists.txt
    celix/trunk/framework/private/mock/bundle_cache_mock.c
    celix/trunk/framework/private/mock/capability_mock.c
    celix/trunk/framework/private/mock/requirement_mock.c
    celix/trunk/framework/private/mock/service_reference_mock.c
    celix/trunk/framework/private/mock/service_registration_mock.c
    celix/trunk/framework/private/mock/service_registry_mock.c
    celix/trunk/framework/private/mock/version_range_mock.c
    celix/trunk/framework/private/src/module.c
    celix/trunk/framework/private/test/bundle_test.cpp
    celix/trunk/framework/private/test/filter_test.cpp
    celix/trunk/framework/private/test/service_registration_test.cpp

Modified: celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/framework/CMakeLists.txt?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/CMakeLists.txt (original)
+++ celix/trunk/framework/CMakeLists.txt Tue Feb 17 09:30:14 2015
@@ -152,7 +152,9 @@ if (FRAMEWORK)
         add_executable(filter_test 
             private/test/filter_test.cpp
             private/mock/properties_mock.c
-            private/src/filter.c)
+            private/src/filter.c
+            private/src/celix_errorcodes.c
+            private/src/celix_log.c)
         target_link_libraries(filter_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 	    
         add_executable(framework_test 
@@ -205,6 +207,7 @@ if (FRAMEWORK)
             private/mock/manifest_mock.c
             private/mock/manifest_parser_mock.c
             private/mock/capability_mock.c
+            private/mock/requirement_mock.c
             private/mock/wire_mock.c
             private/src/module.c)
         target_link_libraries(module_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)

Modified: celix/trunk/framework/private/mock/bundle_cache_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/bundle_cache_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/bundle_cache_mock.c (original)
+++ celix/trunk/framework/private/mock/bundle_cache_mock.c Tue Feb 17 09:30:14 2015
@@ -32,6 +32,11 @@ celix_status_t bundleCache_create(proper
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t bundleCache_destroy(bundle_cache_pt *cache) {
+	mock_c()->actualCall("bundleCache_destroy");
+	return mock_c()->returnValue().value.intValue;
+}
+
 celix_status_t bundleCache_getArchives(bundle_cache_pt cache, array_list_pt *archives) {
 	mock_c()->actualCall("bundle_getCurrentModule");
 	return mock_c()->returnValue().value.intValue;

Modified: celix/trunk/framework/private/mock/capability_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/capability_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/capability_mock.c (original)
+++ celix/trunk/framework/private/mock/capability_mock.c Tue Feb 17 09:30:14 2015
@@ -32,6 +32,11 @@ celix_status_t capability_create(module_
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t capability_destroy(capability_pt capability) {
+	mock_c()->actualCall("capability_destroy");
+	return mock_c()->returnValue().value.intValue;
+}
+
 celix_status_t capability_getServiceName(capability_pt capability, char **serviceName) {
 	mock_c()->actualCall("capability_getServiceName");
 	return mock_c()->returnValue().value.intValue;

Modified: celix/trunk/framework/private/mock/requirement_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/requirement_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/requirement_mock.c (original)
+++ celix/trunk/framework/private/mock/requirement_mock.c Tue Feb 17 09:30:14 2015
@@ -36,6 +36,11 @@ celix_status_t requirement_create(hash_m
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t requirement_destroy(requirement_pt requirement) {
+	mock_c()->actualCall("requirement_destroy");
+	return mock_c()->returnValue().value.intValue;
+}
+
 celix_status_t requirement_getVersionRange(requirement_pt requirement, version_range_pt *range)
{
 	mock_c()->actualCall("requirement_create");
 	return mock_c()->returnValue().value.intValue;

Modified: celix/trunk/framework/private/mock/service_reference_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/service_reference_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/service_reference_mock.c (original)
+++ celix/trunk/framework/private/mock/service_reference_mock.c Tue Feb 17 09:30:14 2015
@@ -35,9 +35,9 @@ celix_status_t serviceReference_create(b
 	return mock_c()->returnValue().value.intValue;
 }
 
-celix_status_t serviceReference_destroy(service_reference_pt reference) {
+celix_status_t serviceReference_destroy(service_reference_pt *reference) {
 	mock_c()->actualCall("serviceReference_destroy")
-			->withPointerParameters("reference", reference);
+			->withPointerParameters("reference", *reference);
 	return mock_c()->returnValue().value.intValue;
 }
 

Modified: celix/trunk/framework/private/mock/service_registration_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/service_registration_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/service_registration_mock.c (original)
+++ celix/trunk/framework/private/mock/service_registration_mock.c Tue Feb 17 09:30:14 2015
@@ -80,6 +80,14 @@ celix_status_t serviceRegistration_getSe
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t serviceRegistration_ungetService(service_registration_pt registration, bundle_pt
bundle, void **service) {
+	mock_c()->actualCall("serviceRegistration_ungetService")
+			->withPointerParameters("registration", registration)
+			->withPointerParameters("bundle", bundle)
+			->withPointerParameters("service", *service);
+	return mock_c()->returnValue().value.intValue;
+}
+
 
 celix_status_t serviceRegistration_getProperties(service_registration_pt registration, properties_pt
*properties) {
 	mock_c()->actualCall("serviceRegistration_getProperties")

Modified: celix/trunk/framework/private/mock/service_registry_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/service_registry_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/service_registry_mock.c (original)
+++ celix/trunk/framework/private/mock/service_registry_mock.c Tue Feb 17 09:30:14 2015
@@ -71,7 +71,22 @@ celix_status_t serviceRegistry_unregiste
 }
 
 celix_status_t serviceRegistry_getServiceReferences(service_registry_pt registry, bundle_pt
bundle, const char *serviceName, filter_pt filter, array_list_pt *references) {
-	mock_c()->actualCall("serviceRegistry_getServiceReferences");
+	mock_c()->actualCall("serviceRegistry_getServiceReferences")
+			->withPointerParameters("registry", registry)
+			->withPointerParameters("bundle", bundle)
+			->withStringParameters("serviceName", serviceName)
+			->withPointerParameters("filter", filter)
+			->withOutputParameter("references", references);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_ungetServiceReference(service_registry_pt registry, bundle_pt
bundle, service_reference_pt reference) {
+	mock_c()->actualCall("serviceRegistry_ungetServiceReference");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_ungetServiceReferences(service_registry_pt registry, bundle_pt
bundle) {
+	mock_c()->actualCall("serviceRegistry_ungetServiceReferences");
 	return mock_c()->returnValue().value.intValue;
 }
 
@@ -107,7 +122,10 @@ celix_status_t serviceRegistry_createSer
 }
 
 celix_status_t serviceRegistry_getServiceReferencesForRegistration(service_registry_pt registry,
service_registration_pt registration, array_list_pt *references) {
-	mock_c()->actualCall("serviceRegistry_getServiceReferencesForRegistration");
+	mock_c()->actualCall("serviceRegistry_getServiceReferencesForRegistration")
+			->withPointerParameters("registry", registry)
+			->withPointerParameters("registration", registration)
+			->withOutputParameter("references", references);
 	return mock_c()->returnValue().value.intValue;
 }
 

Modified: celix/trunk/framework/private/mock/version_range_mock.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/mock/version_range_mock.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/mock/version_range_mock.c (original)
+++ celix/trunk/framework/private/mock/version_range_mock.c Tue Feb 17 09:30:14 2015
@@ -32,6 +32,11 @@ celix_status_t versionRange_createVersio
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t versionRange_destroy(version_range_pt range) {
+	mock_c()->actualCall("versionRange_destroy");
+	return mock_c()->returnValue().value.intValue;
+}
+
 celix_status_t versionRange_createInfiniteVersionRange(version_range_pt *range) {
 	mock_c()->actualCall("versionRange_createInfiniteVersionRange")
 	        ->withOutputParameter("range", (void **) range);

Modified: celix/trunk/framework/private/src/module.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/module.c?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/src/module.c (original)
+++ celix/trunk/framework/private/src/module.c Tue Feb 17 09:30:14 2015
@@ -31,6 +31,7 @@
 #include "manifest_parser.h"
 #include "linked_list_iterator.h"
 #include "capability.h"
+#include "requirement.h"
 #include "wire.h"
 #include "bundle.h"
 

Modified: celix/trunk/framework/private/test/bundle_test.cpp
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/test/bundle_test.cpp?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/test/bundle_test.cpp (original)
+++ celix/trunk/framework/private/test/bundle_test.cpp Tue Feb 17 09:30:14 2015
@@ -83,7 +83,7 @@ TEST(bundle, create) {
 	POINTERS_EQUAL(NULL, actual->manifest);
 //	CHECK(actual->lock)
 	LONGS_EQUAL(0, actual->lockCount);
-	POINTERS_EQUAL(NULL, actual->lockThread);
+	POINTERS_EQUAL(NULL, actual->lockThread.thread);
 	POINTERS_EQUAL(NULL, actual->framework);
 }
 
@@ -153,7 +153,7 @@ TEST(bundle, createFromArchive) {
 	POINTERS_EQUAL(NULL, actual->manifest);
 //	CHECK(actual->lock)
 	LONGS_EQUAL(0, actual->lockCount);
-	POINTERS_EQUAL(NULL, actual->lockThread);
+	POINTERS_EQUAL(NULL, actual->lockThread.thread);
 	POINTERS_EQUAL(framework, actual->framework);
 }
 

Modified: celix/trunk/framework/private/test/filter_test.cpp
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/test/filter_test.cpp?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/test/filter_test.cpp (original)
+++ celix/trunk/framework/private/test/filter_test.cpp Tue Feb 17 09:30:14 2015
@@ -33,6 +33,9 @@
 
 extern "C" {
 #include "filter_private.h"
+#include "celix_log.h"
+
+framework_logger_pt logger;
 }
 
 int main(int argc, char** argv) {
@@ -41,6 +44,8 @@ int main(int argc, char** argv) {
 
 TEST_GROUP(filter) {
 	void setup(void) {
+		logger = (framework_logger_pt) malloc(sizeof(*logger));
+		logger->logFunction = frameworkLogger_log;
 	}
 
 	void teardown() {

Modified: celix/trunk/framework/private/test/service_registration_test.cpp
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/test/service_registration_test.cpp?rev=1660330&r1=1660329&r2=1660330&view=diff
==============================================================================
--- celix/trunk/framework/private/test/service_registration_test.cpp (original)
+++ celix/trunk/framework/private/test/service_registration_test.cpp Tue Feb 17 09:30:14 2015
@@ -269,13 +269,17 @@ TEST(service_registration, getRegistryIl
  
 TEST(service_registration, getServiceReferences) {
 	service_registration_pt registration = (service_registration_pt) malloc(sizeof(*registration));
-	array_list_pt references = (array_list_pt) 0x10;
-	registration->references = references;
+	array_list_pt references = NULL;
+	service_registry_pt registry = (service_registry_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
 
-	array_list_pt actual = NULL;
-	celix_status_t status = serviceRegistration_getServiceReferences(registration, &actual);
+	mock().expectOneCall("serviceRegistry_getServiceReferencesForRegistration")
+			.withParameter("registry", registry)
+			.withParameter("registration", registration)
+			.withOutputParameterReturning("references", &references, sizeof(references));
+
+	celix_status_t status = serviceRegistration_getServiceReferences(registration, &references);
 	LONGS_EQUAL(CELIX_SUCCESS, status);
-	POINTERS_EQUAL(references, actual);
 }
 
 TEST(service_registration, getServiceReferencesIllegalArgument) {



Mime
View raw message