incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1528394 [2/4] - in /incubator/celix/trunk: cmake/ framework/ framework/private/mock/ framework/private/resources-test/ framework/private/test/ framework/public/include/
Date Wed, 02 Oct 2013 09:16:55 GMT
Added: incubator/celix/trunk/framework/private/mock/requirement_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/requirement_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/requirement_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/requirement_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,53 @@
+/**
+ *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_mock.c
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "requirement.h"
+
+celix_status_t requirement_create(apr_pool_t *pool, hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement) {
+	mock_c()->actualCall("requirement_create")
+			->withPointerParameters("pool", pool)
+			->withPointerParameters("directives", directives)
+			->withPointerParameters("attributes", attributes)
+			->_andPointerOutputParameters("requirement", requirement);
+	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;
+}
+
+celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+

Copied: incubator/celix/trunk/framework/private/mock/resolver_mock.c (from r1528390, incubator/celix/trunk/framework/public/include/service_event.h)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/resolver_mock.c?p2=incubator/celix/trunk/framework/private/mock/resolver_mock.c&p1=incubator/celix/trunk/framework/public/include/service_event.h&r1=1528390&r2=1528394&rev=1528394&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/service_event.h (original)
+++ incubator/celix/trunk/framework/private/mock/resolver_mock.c Wed Oct  2 09:16:54 2013
@@ -1,4 +1,4 @@
-/*
+/**
  *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
@@ -16,41 +16,35 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/**
- *
- * @defgroup ServiceListener Service Listener
- * @ingroup framework
- * @{
+/*
+ * resolver_mock.c
  *
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \date      	January 11, 2012
- *  \copyright	Apache License, Version 2.0
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
  */
-#ifndef SERVICE_EVENT_H_
-#define SERVICE_EVENT_H_
+#include "CppUTestExt/MockSupport_c.h"
 
-typedef enum serviceEventType service_event_type_e;
-typedef struct serviceEvent *service_event_pt;
+#include "resolver.h"
 
-#include "service_reference.h"
+hash_map_pt resolver_resolve(module_pt root) {
+	mock_c()->actualCall("resolver_resolve")
+			->withPointerParameters("module", root);
+	return mock_c()->returnValue().value.pointerValue;
+}
+
+void resolver_moduleResolved(module_pt module) {
+	mock_c()->actualCall("resolver_moduleResolved")
+		->withPointerParameters("module", module);
+}
+
+void resolver_addModule(module_pt module) {
+	mock_c()->actualCall("resolver_addModule")
+		->withPointerParameters("module", module);
+}
+
+void resolver_removeModule(module_pt module) {
+	mock_c()->actualCall("resolver_removeModule")
+		->withPointerParameters("module", module);
+}
 
-enum serviceEventType
-{
-	SERVICE_EVENT_REGISTERED = 0x00000001,
-	SERVICE_EVENT_MODIFIED = 0x00000002,
-	SERVICE_EVENT_UNREGISTERING = 0x00000004,
-	SERVICE_EVENT_MODIFIED_ENDMATCH = 0x00000008,
-};
-
-#include "service_reference.h"
-
-struct serviceEvent {
-	service_reference_pt reference;
-	service_event_type_e type;
-};
-
-#endif /* SERVICE_EVENT_H_ */
-
-/**
- * @}
- */

Added: incubator/celix/trunk/framework/private/mock/service_reference_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/service_reference_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/service_reference_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/service_reference_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,85 @@
+/**
+ *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_mock.c
+ *
+ *  \date       Feb 6, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "service_reference_private.h"
+
+celix_status_t serviceReference_create(apr_pool_t *pool, bundle_pt bundle, service_registration_pt registration, service_reference_pt *reference) {
+	mock_c()->actualCall("serviceReference_create")
+			->withPointerParameters("pool", pool)
+			->withPointerParameters("bundle", bundle)
+			->withPointerParameters("registration", registration)
+			->_andPointerOutputParameters("reference", (void **) reference);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceReference_invalidate(service_reference_pt reference) {
+	mock_c()->actualCall("serviceReference_invalidate")
+			->withPointerParameters("reference", reference);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceReference_getServiceRegistration(service_reference_pt reference, service_registration_pt *registration) {
+	mock_c()->actualCall("serviceReference_getServiceRegistration")
+			->withPointerParameters("reference", reference)
+			->_andPointerOutputParameters("registration", (void **) registration);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceReference_getBundle(service_reference_pt reference, bundle_pt *bundle) {
+	mock_c()->actualCall("serviceReference_getBundle");
+	return mock_c()->returnValue().value.intValue;
+}
+
+bool serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, char * serviceName) {
+	mock_c()->actualCall("serviceReference_isAssignableTo");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceReference_getUsingBundles(service_reference_pt reference, apr_pool_t *pool, array_list_pt *bundles) {
+	mock_c()->actualCall("serviceReference_getUsingBundles");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceReference_equals(service_reference_pt reference, service_reference_pt compareTo, bool *equal) {
+	mock_c()->actualCall("serviceReference_equals")
+		->withPointerParameters("reference", reference)
+		->withPointerParameters("compareTo", compareTo)
+		->_andIntOutputParameters("equal", (int *) equal);
+	return mock_c()->returnValue().value.intValue;
+}
+
+unsigned int serviceReference_hashCode(void *referenceP) {
+	mock_c()->actualCall("serviceReference_hashCode");
+	return mock_c()->returnValue().value.intValue;
+}
+
+int serviceReference_equals2(void *reference1, void *reference2) {
+	mock_c()->actualCall("serviceReference_equals2");
+	return mock_c()->returnValue().value.intValue;
+}
+
+

Added: incubator/celix/trunk/framework/private/mock/service_registration_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/service_registration_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/service_registration_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/service_registration_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,121 @@
+/**
+ *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_mock.c
+ *
+ *  \date       Feb 7, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "service_registration.h"
+
+service_registration_pt serviceRegistration_create(apr_pool_t *pool, service_registry_pt registry, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+	mock_c()->actualCall("serviceRegistration_create")
+		->withPointerParameters("pool", pool)
+		->withPointerParameters("registry", registry)
+		->withPointerParameters("bundle", bundle)
+		->withStringParameters("serviceName", serviceName)
+		->withIntParameters("serviceId", serviceId)
+		->withPointerParameters("serviceObject", serviceObject)
+		->withPointerParameters("dictionary", dictionary);
+	return mock_c()->returnValue().value.pointerValue;
+}
+
+service_registration_pt serviceRegistration_createServiceFactory(apr_pool_t *pool, service_registry_pt registry, bundle_pt bundle, char * serviceName, long serviceId, void * serviceObject, properties_pt dictionary) {
+	mock_c()->actualCall("serviceRegistration_createServiceFactory")
+		->withPointerParameters("pool", pool)
+		->withPointerParameters("registry", registry)
+		->withPointerParameters("bundle", bundle)
+		->withStringParameters("serviceName", serviceName)
+		->withIntParameters("serviceId", serviceId)
+		->withPointerParameters("serviceObject", serviceObject)
+		->withPointerParameters("dictionary", dictionary);
+	return mock_c()->returnValue().value.pointerValue;
+}
+
+void serviceRegistration_destroy(service_registration_pt registration) {
+}
+
+
+bool serviceRegistration_isValid(service_registration_pt registration) {
+	mock_c()->actualCall("serviceRegistration_isValid")
+			->withPointerParameters("registration", registration);
+	return mock_c()->returnValue().value.intValue;
+}
+
+void serviceRegistration_invalidate(service_registration_pt registration) {
+	mock_c()->actualCall("serviceRegistration_invalidate")
+			->withPointerParameters("registration", registration);
+}
+
+celix_status_t serviceRegistration_unregister(service_registration_pt registration) {
+	mock_c()->actualCall("serviceRegistration_unregister")
+		->withPointerParameters("registration", registration);
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+celix_status_t serviceRegistration_getService(service_registration_pt registration, bundle_pt bundle, void **service) {
+	mock_c()->actualCall("serviceRegistration_getService")
+		->withPointerParameters("registration", registration)
+		->withPointerParameters("bundle", bundle)
+		->_andPointerOutputParameters("service", (void **) service);
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+celix_status_t serviceRegistration_getProperties(service_registration_pt registration, properties_pt *properties) {
+	mock_c()->actualCall("serviceRegistration_getProperties")
+			->withPointerParameters("registration", registration)
+			->_andPointerOutputParameters("properties", (void **) properties);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistration_getRegistry(service_registration_pt registration, service_registry_pt *registry) {
+	mock_c()->actualCall("serviceRegistration_getRegistry")
+			->withPointerParameters("registration", registration)
+			->_andPointerOutputParameters("registry", (void **) registry);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistration_getServiceReferences(service_registration_pt registration, array_list_pt *references) {
+	mock_c()->actualCall("serviceRegistration_getServiceReferences")
+			->withPointerParameters("registration", registration)
+			->_andPointerOutputParameters("references", (void **) references);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistration_getBundle(service_registration_pt registration, bundle_pt *bundle) {
+	mock_c()->actualCall("serviceRegistration_getBundle")
+			->withPointerParameters("registration", registration)
+			->_andPointerOutputParameters("bundle", (void **) bundle);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName) {
+	mock_c()->actualCall("serviceRegistration_getServiceName")
+			->withPointerParameters("registration", registration)
+			->_andStringOutputParameters("serviceName", (const char **) serviceName);
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+

Added: incubator/celix/trunk/framework/private/mock/service_registry_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/service_registry_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/service_registry_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/service_registry_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,119 @@
+/**
+ *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_registry_mock.c
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "service_registry.h"
+
+celix_status_t serviceRegistry_create(apr_pool_t *pool, framework_pt framework, serviceChanged_function_pt serviceChanged, service_registry_pt *registry) {
+	mock_c()->actualCall("serviceRegistry_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_destroy(service_registry_pt registry) {
+	mock_c()->actualCall("serviceRegistry_destroy");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_getRegisteredServices(service_registry_pt registry, apr_pool_t *pool, bundle_pt bundle, array_list_pt *services) {
+	mock_c()->actualCall("serviceRegistry_getRegisteredServices");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_getServicesInUse(service_registry_pt registry, bundle_pt bundle, array_list_pt *services) {
+	mock_c()->actualCall("serviceRegistry_getServicesInUse");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_registerService(service_registry_pt registry, bundle_pt bundle, char * serviceName, void * serviceObject, properties_pt dictionary, service_registration_pt *registration) {
+	mock_c()->actualCall("serviceRegistry_registerService");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_registerServiceFactory(service_registry_pt registry, bundle_pt bundle, char * serviceName, service_factory_pt factory, properties_pt dictionary, service_registration_pt *registration) {
+	mock_c()->actualCall("serviceRegistry_registerServiceFactory");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_unregisterService(service_registry_pt registry, bundle_pt bundle, service_registration_pt registration) {
+	mock_c()->actualCall("serviceRegistry_unregisterService")
+		->withPointerParameters("registry", registry)
+		->withPointerParameters("bundle", bundle)
+		->withPointerParameters("registration", registration);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_unregisterServices(service_registry_pt registry, bundle_pt bundle) {
+	mock_c()->actualCall("serviceRegistry_unregisterServices");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_getServiceReferences(service_registry_pt registry, apr_pool_t *pool, const char *serviceName, filter_pt filter, array_list_pt *references) {
+	mock_c()->actualCall("serviceRegistry_getServiceReferences");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_getService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, void **service) {
+	mock_c()->actualCall("serviceRegistry_getService");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_ungetService(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, bool *result) {
+	mock_c()->actualCall("serviceRegistry_ungetService");
+	return mock_c()->returnValue().value.intValue;
+}
+
+void serviceRegistry_ungetServices(service_registry_pt registry, bundle_pt bundle) {
+	mock_c()->actualCall("serviceRegistry_ungetServices");
+}
+
+array_list_pt serviceRegistry_getUsingBundles(service_registry_pt registry, apr_pool_t *pool, service_reference_pt reference) {
+	mock_c()->actualCall("serviceRegistry_getUsingBundles")
+			->withPointerParameters("registry", registry)
+			->withPointerParameters("pool", pool)
+			->withPointerParameters("reference", reference);
+	return mock_c()->returnValue().value.pointerValue;
+}
+
+service_registration_pt serviceRegistry_findRegistration(service_registry_pt registry, service_reference_pt reference) {
+	mock_c()->actualCall("serviceRegistry_findRegistration");
+	return mock_c()->returnValue().value.pointerValue;
+}
+
+celix_status_t serviceRegistry_createServiceReference(service_registry_pt registry, apr_pool_t *pool, service_registration_pt registration, service_reference_pt *reference) {
+	mock_c()->actualCall("serviceRegistry_createServiceReference");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_getListenerHooks(service_registry_pt registry, apr_pool_t *pool, array_list_pt *hooks) {
+	mock_c()->actualCall("serviceRegistry_getListenerHooks");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceRegistry_servicePropertiesModified(service_registry_pt registry, service_registration_pt registration, properties_pt oldprops) {
+	mock_c()->actualCall("serviceRegistry_servicePropertiesModified");
+	return mock_c()->returnValue().value.intValue;
+}
+

Added: incubator/celix/trunk/framework/private/mock/service_tracker_customizer_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/service_tracker_customizer_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/service_tracker_customizer_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/service_tracker_customizer_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,74 @@
+/**
+ *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_tracker_customizer_mock.c
+ *
+ *  \date       Feb 7, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "service_tracker_customizer_private.h"
+
+celix_status_t serviceTrackerCustomizer_create(apr_pool_t *pool, void *handle,
+		adding_callback_pt addingFunction, added_callback_pt addedFunction,
+		modified_callback_pt modifiedFunction, removed_callback_pt removedFunction,
+		service_tracker_customizer_pt *customizer) {
+	mock_c()->actualCall("serviceTrackerCustomizer_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceTrackerCustomizer_getHandle(service_tracker_customizer_pt customizer, void **handle) {
+	mock_c()->actualCall("serviceTrackerCustomizer_getHandle")
+			->withPointerParameters("customizer", customizer)
+			->_andPointerOutputParameters("handle", handle);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceTrackerCustomizer_getAddingFunction(service_tracker_customizer_pt customizer, adding_callback_pt *function) {
+	mock_c()->actualCall("serviceTrackerCustomizer_getAddingFunction")
+		->withPointerParameters("customizer", customizer)
+		->_andPointerOutputParameters("function", (void **) function);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceTrackerCustomizer_getAddedFunction(service_tracker_customizer_pt customizer, added_callback_pt *function) {
+	mock_c()->actualCall("serviceTrackerCustomizer_getAddedFunction")
+		->withPointerParameters("customizer", customizer)
+		->_andPointerOutputParameters("function", (void **) function);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceTrackerCustomizer_getModifiedFunction(service_tracker_customizer_pt customizer, modified_callback_pt *function) {
+	mock_c()->actualCall("serviceTrackerCustomizer_getModifiedFunction")
+			->withPointerParameters("customizer", customizer)
+			->_andPointerOutputParameters("function", (void **) function);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t serviceTrackerCustomizer_getRemovedFunction(service_tracker_customizer_pt customizer, removed_callback_pt *function) {
+	mock_c()->actualCall("serviceTrackerCustomizer_getRemovedFunction")
+			->withPointerParameters("customizer", customizer)
+			->_andPointerOutputParameters("function", (void **) function);
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+

Added: incubator/celix/trunk/framework/private/mock/version_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/version_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/version_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/version_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,83 @@
+/**
+ *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.
+ */
+/*
+ * version_mock.c
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "version.h"
+
+celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, int micro, char * qualifier, version_pt *version) {
+	mock_c()->actualCall("version_createVersion");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_clone(version_pt version, apr_pool_t *pool, version_pt *clone) {
+	mock_c()->actualCall("version_clone");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_createVersionFromString(apr_pool_t *pool, char * versionStr, version_pt *version) {
+	mock_c()->actualCall("version_createVersionFromString");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_createEmptyVersion(apr_pool_t *pool, version_pt *version) {
+	mock_c()->actualCall("version_createEmptyVersion")
+			->withPointerParameters("pool", pool)
+			->_andPointerOutputParameters("version", (void **) version);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_getMajor(version_pt version, int *major) {
+	mock_c()->actualCall("version_getMajor");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_getMinor(version_pt version, int *minor) {
+	mock_c()->actualCall("version_getMinor");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_getMicro(version_pt version, int *micro) {
+	mock_c()->actualCall("version_getMicro");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_getQualifier(version_pt version, char **qualifier) {
+	mock_c()->actualCall("version_getQualifier");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_compareTo(version_pt version, version_pt compare, int *result) {
+	mock_c()->actualCall("version_compareTo");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t version_toString(version_pt version, apr_pool_t *pool, char **string) {
+	mock_c()->actualCall("version_toString");
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+

Added: incubator/celix/trunk/framework/private/mock/version_range_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/version_range_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/version_range_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/version_range_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,54 @@
+/**
+ *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.
+ */
+/*
+ * version_range_mock.c
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "version_range.h"
+
+celix_status_t versionRange_createVersionRange(apr_pool_t *pool, version_pt low, bool isLowInclusive, version_pt high, bool isHighInclusive, version_range_pt *versionRange) {
+	mock_c()->actualCall("versionRange_createVersionRange");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t versionRange_createInfiniteVersionRange(apr_pool_t *pool, version_range_pt *range) {
+	mock_c()->actualCall("versionRange_createInfiniteVersionRange");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t versionRange_isInRange(version_range_pt versionRange, version_pt version, bool *inRange) {
+	mock_c()->actualCall("versionRange_isInRange")
+			->withPointerParameters("versionRange", versionRange)
+			->withPointerParameters("version", version)
+			->_andIntOutputParameters("inRange", inRange);
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t versionRange_parse(apr_pool_t *pool, char * rangeStr, version_range_pt *range) {
+	mock_c()->actualCall("versionRange_parse");
+	return mock_c()->returnValue().value.intValue;
+}
+
+
+

Added: incubator/celix/trunk/framework/private/mock/wire_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/wire_mock.c?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/mock/wire_mock.c (added)
+++ incubator/celix/trunk/framework/private/mock/wire_mock.c Wed Oct  2 09:16:54 2013
@@ -0,0 +1,55 @@
+/**
+ *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.
+ */
+/*
+ * wire_mock.c
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
+ */
+#include "CppUTestExt/MockSupport_c.h"
+
+#include "wire.h"
+
+celix_status_t wire_create(apr_pool_t *pool, module_pt importer, requirement_pt requirement,
+		module_pt exporter, capability_pt capability, wire_pt *wire) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t wire_getCapability(wire_pt wire, capability_pt *capability) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t wire_getRequirement(wire_pt wire, requirement_pt *requirement) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t wire_getImporter(wire_pt wire, module_pt *importer) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+
+celix_status_t wire_getExporter(wire_pt wire, module_pt *exporter) {
+	mock_c()->actualCall("requirement_create");
+	return mock_c()->returnValue().value.intValue;
+}
+

Added: incubator/celix/trunk/framework/private/resources-test/properties.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/resources-test/properties.txt?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/resources-test/properties.txt (added)
+++ incubator/celix/trunk/framework/private/resources-test/properties.txt Wed Oct  2 09:16:54 2013
@@ -0,0 +1,2 @@
+a=b
+b=c
\ No newline at end of file

Added: incubator/celix/trunk/framework/private/test/attribute_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/attribute_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/attribute_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/attribute_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,91 @@
+/**
+ *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:celix-dev@incubator.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 "attribute_private.h"
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+TEST_GROUP(attribute) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(attribute, create) {
+	char key[] = "key";
+	char value[] = "value";
+
+	attribute_pt attribute = NULL;
+	celix_status_t status = attribute_create(pool, key, value, &attribute);
+	STRCMP_EQUAL(key, attribute->key);
+	STRCMP_EQUAL(value, attribute->value);
+}
+
+TEST(attribute, getKey) {
+	char key[] = "key";
+	char value[] = "value";
+
+	attribute_pt attribute = (attribute_pt) apr_palloc(pool, sizeof(*attribute));
+	attribute->key = key;
+	attribute->value = value;
+
+	char *actual = NULL;
+	celix_status_t status = attribute_getKey(attribute, &actual);
+	STRCMP_EQUAL(key, actual);
+}
+
+TEST(attribute, getValue) {
+	char key[] = "key";
+	char value[] = "value";
+
+	attribute_pt attribute = (attribute_pt) apr_palloc(pool, sizeof(*attribute));
+	attribute->key = key;
+	attribute->value = value;
+
+	char *actual = NULL;
+	celix_status_t status = attribute_getValue(attribute, &actual);
+	STRCMP_EQUAL(value, actual);
+}

Copied: incubator/celix/trunk/framework/private/test/bundle_archive_test.cpp (from r1528390, incubator/celix/trunk/framework/public/include/service_event.h)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_archive_test.cpp?p2=incubator/celix/trunk/framework/private/test/bundle_archive_test.cpp&p1=incubator/celix/trunk/framework/public/include/service_event.h&r1=1528390&r2=1528394&rev=1528394&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/service_event.h (original)
+++ incubator/celix/trunk/framework/private/test/bundle_archive_test.cpp Wed Oct  2 09:16:54 2013
@@ -1,4 +1,4 @@
-/*
+/**
  *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
@@ -16,41 +16,44 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/**
- *
- * @defgroup ServiceListener Service Listener
- * @ingroup framework
- * @{
+/*
+ * bundle_archive_test.cpp
  *
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- *  \date      	January 11, 2012
- *  \copyright	Apache License, Version 2.0
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ *  \copyright  Apache License, Version 2.0
  */
-#ifndef SERVICE_EVENT_H_
-#define SERVICE_EVENT_H_
+#include <stdlib.h>
+#include <stdio.h>
 
-typedef enum serviceEventType service_event_type_e;
-typedef struct serviceEvent *service_event_pt;
-
-#include "service_reference.h"
-
-enum serviceEventType
-{
-	SERVICE_EVENT_REGISTERED = 0x00000001,
-	SERVICE_EVENT_MODIFIED = 0x00000002,
-	SERVICE_EVENT_UNREGISTERING = 0x00000004,
-	SERVICE_EVENT_MODIFIED_ENDMATCH = 0x00000008,
+#include "CppUTest/TestHarness.h"
+#include "CppUTest/TestHarness_c.h"
+#include "CppUTest/CommandLineTestRunner.h"
+#include "CppUTestExt/MockSupport.h"
+
+extern "C" {
+#include "bundle_archive.h"
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+TEST_GROUP(bundle_archive) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
 };
 
-#include "service_reference.h"
 
-struct serviceEvent {
-	service_reference_pt reference;
-	service_event_type_e type;
-};
 
-#endif /* SERVICE_EVENT_H_ */
 
-/**
- * @}
- */

Added: incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,144 @@
+/**
+ *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.
+ */
+/*
+ * bundle_cache_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.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 <apr_file_io.h>
+#include "bundle_cache_private.h"
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+TEST_GROUP(bundle_cache) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(bundle_cache, create) {
+	properties_pt configuration = (properties_pt) 0x10;
+
+	mock().expectOneCall("properties_get")
+		.withParameter("properties", configuration)
+		.withParameter("key", "org.osgi.framework.storage")
+		.andReturnValue((char *) NULL);
+
+	mock().expectOneCall("properties_destroy")
+		.withParameter("properties", configuration);
+
+	bundle_cache_pt cache = NULL;
+	celix_status_t status = bundleCache_create(configuration, pool, &cache);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle_cache, deleteTree) {
+	bundle_cache_pt cache = (bundle_cache_pt) apr_palloc(pool, sizeof(*cache));
+	char cacheDir[] = "bundle_cache_test_directory";
+	char cacheFile[] = "bundle_cache_test_directory/temp";
+	cache->cacheDir = cacheDir;
+	cache->mp = pool;
+
+	apr_dir_make(cacheDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool);
+	apr_file_t *file;
+	apr_file_mktemp(&file, cacheFile, APR_UREAD|APR_UWRITE, pool);
+
+	celix_status_t status = bundleCache_delete(cache);
+
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+}
+
+TEST(bundle_cache, getArchive) {
+	bundle_cache_pt cache = (bundle_cache_pt) apr_palloc(pool, sizeof(*cache));
+	char cacheDir[] = "bundle_cache_test_directory";
+	cache->cacheDir = cacheDir;
+	cache->mp = pool;
+
+	char bundle0[] = "bundle_cache_test_directory/bundle0";
+	char bundle1[] = "bundle_cache_test_directory/bundle1";
+	apr_dir_make(cacheDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool);
+	apr_dir_make(bundle0, APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool);
+	apr_dir_make(bundle1, APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool);
+
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	mock().expectOneCall("bundleArchive_recreate")
+		.withParameter("archiveRoot", bundle1)
+		.withParameter("mp", pool)
+		.andOutputParameter("bundle_archive", archive)
+		.andReturnValue(CELIX_SUCCESS);
+
+	array_list_pt archives = NULL;
+	celix_status_t status = bundleCache_getArchives(cache, pool, &archives);
+
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	CHECK(archives);
+	LONGS_EQUAL(1, arrayList_size(archives));
+	POINTERS_EQUAL(archive, arrayList_get(archives, 0));
+
+	apr_dir_remove(bundle0, pool);
+	apr_dir_remove(bundle1, pool);
+	apr_dir_remove(cacheDir, pool);
+}
+
+TEST(bundle_cache, createArchive) {
+	bundle_cache_pt cache = (bundle_cache_pt) apr_palloc(pool, sizeof(*cache));
+	char cacheDir[] = "bundle_cache_test_directory";
+	cache->cacheDir = cacheDir;
+
+	char archiveRoot[] = "bundle_cache_test_directory/bundle1";
+	int id = 1;
+	char location[] = "test.zip";
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	mock().expectOneCall("bundleArchive_create")
+		.withParameter("archiveRoot", archiveRoot)
+		.withParameter("id", id)
+		.withParameter("location", location)
+		.withParameter("inputFile", (char *) NULL)
+		.withParameter("mp", pool)
+		.andOutputParameter("bundle_archive", archive)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_archive_pt actual;
+	bundleCache_createArchive(cache, pool, 1l, location, NULL, &actual);
+	POINTERS_EQUAL(archive, actual);
+}

Added: incubator/celix/trunk/framework/private/test/bundle_context_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_context_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/bundle_context_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/bundle_context_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,528 @@
+/**
+ *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.
+ */
+/*
+ * bundle_context_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.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 "bundle_context_private.h"
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+TEST_GROUP(bundle_context) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(bundle_context, create) {
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+
+	mock().expectOneCall("bundle_getMemoryPool")
+		.withParameter("bundle", bundle)
+		.andOutputParameter("pool", pool)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_context_pt context = NULL;
+	bundleContext_create(framework, bundle, &context);
+	POINTERS_EQUAL(framework, context->framework)
+	POINTERS_EQUAL(bundle, context->bundle)
+	CHECK(context->pool);
+}
+
+TEST(bundle_context, destroy) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *spool = NULL;
+	apr_pool_create(&spool, pool);
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = spool;
+
+	celix_status_t status = bundleContext_destroy(context);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	status = bundleContext_destroy(NULL);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getBundle) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	celix_status_t status;
+	bundle_pt actualBundle = NULL;
+	status = bundleContext_getBundle(context, &actualBundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(bundle, actualBundle);
+
+	framework_pt actualFramework = NULL;
+	status = bundleContext_getFramework(context, &actualFramework);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(framework, actualFramework);
+
+	apr_pool_t *actualPool = NULL;
+	status = bundleContext_getMemoryPool(context, &actualPool);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(pool, actualPool);
+
+	actualBundle = NULL;
+	status = bundleContext_getBundle(NULL, &actualBundle);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+	actualFramework = NULL;
+	status = bundleContext_getFramework(NULL, &actualFramework);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+	actualPool = NULL;
+	status = bundleContext_getMemoryPool(NULL, &actualPool);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, installBundle) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	char location[] = "test.zip";
+	bundle_pt installedBundle = (bundle_pt) 0x40;
+	mock().expectOneCall("fw_installBundle")
+		.withParameter("framework", framework)
+		.withParameter("location", location)
+		.withParameter("inputFile", (char *) NULL)
+		.andOutputParameter("bundle", installedBundle)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualInstalledBundle = NULL;
+	celix_status_t status = bundleContext_installBundle(context, location, &actualInstalledBundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(installedBundle, actualInstalledBundle);
+}
+
+TEST(bundle_context, installBundle2) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	char location[] = "test.zip";
+	char inputFile[] = "input.zip";
+	bundle_pt installedBundle = (bundle_pt) 0x40;
+	mock().expectOneCall("fw_installBundle")
+		.withParameter("framework", framework)
+		.withParameter("location", location)
+		.withParameter("inputFile", inputFile)
+		.andOutputParameter("bundle", installedBundle)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualInstalledBundle = NULL;
+	celix_status_t status = bundleContext_installBundle2(context, location, inputFile, &actualInstalledBundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(installedBundle, actualInstalledBundle);
+
+	actualInstalledBundle = NULL;
+	status = bundleContext_installBundle2(NULL, location, inputFile, &actualInstalledBundle);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, registerService) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	char serviceName[] = "service";
+	void *service = (void *) 0x40;
+	properties_pt properties = (properties_pt) 0x50;
+	service_registration_pt registration = (service_registration_pt) 0x60;
+
+	mock().expectOneCall("fw_registerService")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("serviceName", serviceName)
+		.withParameter("service", service)
+		.withParameter("properties", properties)
+		.andOutputParameter("registration", registration)
+		.andReturnValue(CELIX_SUCCESS);
+
+	service_registration_pt actualRegistration = NULL;
+	celix_status_t status = bundleContext_registerService(context, serviceName, service, properties, &actualRegistration);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(registration, actualRegistration);
+
+	actualRegistration = NULL;
+	status = bundleContext_registerService(NULL, serviceName, service, properties, &actualRegistration);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, registerServiceFactory) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	char serviceName[] = "service";
+	service_factory_pt serviceFactory = (service_factory_pt) 0x40;
+	properties_pt properties = (properties_pt) 0x50;
+	service_registration_pt registration = (service_registration_pt) 0x60;
+
+	mock().expectOneCall("fw_registerServiceFactory")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("serviceName", serviceName)
+		.withParameter("serviceFactory", serviceFactory)
+		.withParameter("properties", properties)
+		.andOutputParameter("registration", registration)
+		.andReturnValue(CELIX_SUCCESS);
+
+	service_registration_pt actualRegistration = NULL;
+	celix_status_t status = bundleContext_registerServiceFactory(context, serviceName, serviceFactory, properties, &actualRegistration);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(registration, actualRegistration);
+
+	actualRegistration = NULL;
+	status = bundleContext_registerServiceFactory(NULL, serviceName, serviceFactory, properties, &actualRegistration);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getServiceReferences) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	apr_pool_t *pool = (apr_pool_t *) 0x30;
+	context->framework = framework;
+	context->bundle = bundle;
+	context->pool = pool;
+
+	char serviceName[] = "service";
+	char filter[] = "";
+	array_list_pt references = (array_list_pt) 0x40;
+
+	mock().expectOneCall("fw_getServiceReferences")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("serviceName", serviceName)
+		.withParameter("filter", filter)
+		.andOutputParameter("references", references)
+		.andReturnValue(CELIX_SUCCESS);
+
+	array_list_pt actualReferences = NULL;
+	celix_status_t status = bundleContext_getServiceReferences(context, serviceName, filter, &actualReferences);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(references, actualReferences);
+
+	actualReferences = NULL;
+	status = bundleContext_getServiceReferences(NULL, serviceName, filter, &actualReferences);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getServiceReference) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	char serviceName[] = "service";
+	array_list_pt references = NULL;
+	arrayList_create(pool, &references);
+	service_reference_pt reference = (service_reference_pt) 0x40;
+	arrayList_add(references, reference);
+
+	mock().expectOneCall("fw_getServiceReferences")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("serviceName", serviceName)
+		.withParameter("filter", (char *) NULL)
+		.andOutputParameter("references", references)
+		.andReturnValue(CELIX_SUCCESS);
+
+	service_reference_pt actualReference = NULL;
+	celix_status_t status = bundleContext_getServiceReference(context, serviceName, &actualReference);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(reference, actualReference);
+
+	actualReference = NULL;
+	status = bundleContext_getServiceReference(context, NULL, &actualReference);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getService) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	char serviceName[] = "service";
+	service_reference_pt serviceReference = (service_reference_pt) 0x30;
+	void *service = (void *) 0x40;
+
+	mock().expectOneCall("fw_getService")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("reference", serviceReference)
+		.andReturnValue(service);
+
+	void *actualService = NULL;
+	celix_status_t status = bundleContext_getService(context, serviceReference, &actualService);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(service, actualService);
+
+	actualService = NULL;
+	status = bundleContext_getService(context, NULL, &actualService);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, ungetService) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	char serviceName[] = "service";
+	service_reference_pt serviceReference = (service_reference_pt) 0x30;
+	bool result = true;
+
+	mock().expectOneCall("framework_ungetService")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("reference", serviceReference)
+		.andReturnValue(result);
+
+	bool actualResult = NULL;
+	celix_status_t status = bundleContext_ungetService(context, serviceReference, &actualResult);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	LONGS_EQUAL(result, actualResult);
+
+	actualResult = NULL;
+	status = bundleContext_ungetService(context, NULL, &actualResult);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getBundles) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	array_list_pt bundles = (array_list_pt) 0x40;
+
+	mock().expectOneCall("framework_getBundles")
+		.withParameter("framework", framework)
+		.andReturnValue(bundles);
+
+	array_list_pt actualBundles = NULL;
+	celix_status_t status = bundleContext_getBundles(context, &actualBundles);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(bundles, actualBundles);
+
+	actualBundles = NULL;
+	status = bundleContext_getBundles(NULL, &actualBundles);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getBundleById) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	bundle_pt result = (bundle_pt) 0x40;
+	int id = 1;
+
+	mock().expectOneCall("framework_getBundleById")
+		.withParameter("framework", framework)
+		.withParameter("id", id)
+		.andReturnValue(result);
+
+	bundle_pt actualBundle = NULL;
+	celix_status_t status = bundleContext_getBundleById(context, id, &actualBundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(result, actualBundle);
+
+	actualBundle = NULL;
+	status = bundleContext_getBundleById(NULL, id, &actualBundle);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, addServiceListener) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	service_listener_pt listener = (service_listener_pt) 0x30;
+	char filter[] = "";
+	mock().expectOneCall("fw_addServiceListener")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("listener", listener)
+		.withParameter("filter", filter)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualBundle = NULL;
+	celix_status_t status = bundleContext_addServiceListener(context, listener, filter);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	actualBundle = NULL;
+	status = bundleContext_addServiceListener(context, NULL, filter);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, removeServiceListener) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	service_listener_pt listener = (service_listener_pt) 0x30;
+	mock().expectOneCall("fw_removeServiceListener")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("listener", listener)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualBundle = NULL;
+	celix_status_t status = bundleContext_removeServiceListener(context, listener);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	actualBundle = NULL;
+	status = bundleContext_removeServiceListener(context, NULL);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, addBundleListener) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	bundle_listener_pt listener = (bundle_listener_pt) 0x30;
+	mock().expectOneCall("fw_addBundleListener")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("listener", listener)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualBundle = NULL;
+	celix_status_t status = bundleContext_addBundleListener(context, listener);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	actualBundle = NULL;
+	status = bundleContext_addBundleListener(context, NULL);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, removeBundleListener) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	bundle_listener_pt listener = (bundle_listener_pt) 0x30;
+	mock().expectOneCall("fw_removeBundleListener")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("listener", listener)
+		.andReturnValue(CELIX_SUCCESS);
+
+	bundle_pt actualBundle = NULL;
+	celix_status_t status = bundleContext_removeBundleListener(context, listener);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+
+	actualBundle = NULL;
+	status = bundleContext_removeBundleListener(context, NULL);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle_context, getProperty) {
+	bundle_context_pt context = (bundle_context_pt) apr_palloc(pool, sizeof(*context));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_pt bundle = (bundle_pt) 0x20;
+	context->framework = framework;
+	context->bundle = bundle;
+
+	char name[] = "property";
+	char value[] = "value";
+	mock().expectOneCall("fw_getProperty")
+		.withParameter("framework", framework)
+		.withParameter("name", name)
+		.withParameter("value", value)
+		.andReturnValue(CELIX_SUCCESS);
+
+	char *actualValue = NULL;
+	celix_status_t status = bundleContext_getProperty(context, name, &actualValue);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	STRCMP_EQUAL(value, actualValue);
+
+	actualValue = NULL;
+	status = bundleContext_getProperty(context, NULL, &actualValue);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}

Added: incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,130 @@
+/**
+ *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.
+ */
+/*
+ * bundle_revision_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.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 "bundle_revision_private.h"
+}
+
+int main(int argc, char** argv) {
+	return RUN_ALL_TESTS(argc, argv);
+}
+
+TEST_GROUP(bundle_revision) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(bundle_revision, create) {
+	char root[] = "bundle_revision_test";
+	char location[] = "test_bundle.zip";
+	char *inputFile = NULL;
+	long revisionNr = 1l;
+
+	mock().expectOneCall("extractBundle")
+			.withParameter("bundleName", location)
+			.withParameter("revisionRoot", root)
+			.andReturnValue(CELIX_SUCCESS);
+
+	bundle_revision_pt revision = NULL;
+	celix_status_t status = bundleRevision_create(pool, root, location, revisionNr, inputFile, &revision);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	LONGS_EQUAL(revisionNr, revision->revisionNr);
+	STRCMP_EQUAL(root, revision->root);
+	STRCMP_EQUAL(location, revision->location);
+}
+
+TEST(bundle_revision, createWithInput) {
+	char root[] = "bundle_revision_test";
+	char location[] = "test_bundle.zip";
+	char inputFile[] = "from_somewhere.zip";
+	long revisionNr = 1l;
+
+	mock().expectOneCall("extractBundle")
+			.withParameter("bundleName", inputFile)
+			.withParameter("revisionRoot", root)
+			.andReturnValue(CELIX_SUCCESS);
+
+	bundle_revision_pt revision = NULL;
+	celix_status_t status = bundleRevision_create(pool, root, location, revisionNr, inputFile, &revision);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	LONGS_EQUAL(revisionNr, revision->revisionNr);
+	STRCMP_EQUAL(root, revision->root);
+	STRCMP_EQUAL(location, revision->location);
+}
+
+TEST(bundle_revision, getNumber) {
+	bundle_revision_pt revision = (bundle_revision_pt) apr_palloc(pool, sizeof(*revision));
+	char root[] = "bundle_revision_test";
+	char location[] = "test_bundle.zip";
+	long revisionNr = 1l;
+	revision->root = root;
+	revision->location = location;
+	revision->revisionNr = revisionNr;
+
+	char *actualRoot = NULL;
+	char *actualLocation = NULL;
+	long actualRevisionNr = 0l;
+	celix_status_t status = CELIX_SUCCESS;
+
+	status = bundleRevision_getNumber(revision, &actualRevisionNr);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	LONGS_EQUAL(revisionNr, actualRevisionNr);
+
+	status = bundleRevision_getLocation(revision, &actualLocation);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	STRCMP_EQUAL(location, actualLocation);
+
+	status = bundleRevision_getRoot(revision, &actualRoot);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	STRCMP_EQUAL(root, actualRoot);
+
+	status = bundleRevision_getNumber(NULL, &actualRevisionNr);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+	status = bundleRevision_getLocation(NULL, &actualLocation);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+
+	status = bundleRevision_getRoot(NULL, &actualRoot);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+

Added: incubator/celix/trunk/framework/private/test/bundle_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/bundle_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/bundle_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,488 @@
+/**
+ *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.
+ */
+/*
+ * bundle_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.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 "bundle_private.h"
+}
+
+int main(int argc, char** argv) {
+	RUN_ALL_TESTS(argc, argv);
+	return 0;
+}
+
+TEST_GROUP(bundle) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(bundle, create) {
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	mock().expectOneCall("bundleArchive_createSystemBundleArchive")
+			.withParameter("pool", pool)
+			.andOutputParameter("bundle_archive", archive)
+			.andReturnValue(CELIX_SUCCESS);
+
+	module_pt module = (module_pt) 0x20;
+	mock().expectOneCall("module_createFrameworkModule")
+			.ignoreOtherParameters()
+			.andReturnValue(module);
+
+	mock().expectOneCall("resolver_addModule")
+			.withParameter("module", module);
+	mock().expectOneCall("resolver_addModule")
+			.withParameter("module", module);
+
+	bundle_pt actual = NULL;
+	celix_status_t status = bundle_create(&actual, pool);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(NULL, actual->context);
+	POINTERS_EQUAL(NULL, actual->activator);
+	LONGS_EQUAL(BUNDLE_INSTALLED, actual->state);
+	POINTERS_EQUAL(NULL, actual->handle);
+	POINTERS_EQUAL(archive, actual->archive);
+	CHECK(actual->modules);
+	POINTERS_EQUAL(NULL, actual->manifest);
+	POINTERS_EQUAL(pool, actual->memoryPool);
+	CHECK(actual->lock)
+	LONGS_EQUAL(0, actual->lockCount);
+	POINTERS_EQUAL(NULL, actual->lockThread);
+	POINTERS_EQUAL(NULL, actual->framework);
+}
+
+TEST(bundle, createFromArchive) {
+	framework_pt framework = (framework_pt) 0x10;
+	bundle_archive_pt archive = (bundle_archive_pt) 0x20;
+
+	manifest_pt manifest = (manifest_pt) 0x30;
+	mock().expectOneCall("getManifest")
+		.withParameter("archive", archive)
+		.withParameter("pool", pool)
+		.andOutputParameter("manifest", manifest)
+		.andReturnValue(CELIX_SUCCESS);
+
+	// CPPUTest has no build in support for longs, which breaks this test.
+	mock().expectOneCall("bundleArchive_getId")
+		.withParameter("archive", archive)
+		.andOutputParameter("id", 1)
+		.andReturnValue(CELIX_SUCCESS);
+
+	module_pt module = (module_pt) 0x40;
+	mock().expectOneCall("module_create")
+		.withParameter("headerMap", manifest)
+//		.withParameter("moduleId", "1.0")
+//		.withParameter("bundle", (void *) 0x40)
+		.ignoreOtherParameters()
+		.andReturnValue(module);
+
+	version_pt version = (version_pt) 0x50;
+	mock().expectOneCall("module_getVersion")
+		.withParameter("module", module)
+		.andReturnValue(version);
+
+	char symbolicName[] = "name";
+	mock().expectOneCall("module_getSymbolicName")
+		.withParameter("module", module)
+		.andOutputParameter("symbolicName", symbolicName)
+		.andReturnValue(CELIX_SUCCESS);
+
+	array_list_pt bundles = NULL;
+	arrayList_create(pool, &bundles);
+	mock().expectOneCall("framework_getBundles")
+		.withParameter("framework", framework)
+		.andReturnValue(bundles);
+
+	mock().expectOneCall("resolver_addModule")
+		.withParameter("module", module);
+
+	mock().expectOneCall("resolver_addModule")
+		.withParameter("module", module);
+
+	bundle_pt actual = NULL;
+	celix_status_t status = bundle_createFromArchive(&actual, framework, archive, pool);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(NULL, actual->context);
+	POINTERS_EQUAL(NULL, actual->activator);
+	LONGS_EQUAL(BUNDLE_INSTALLED, actual->state);
+	POINTERS_EQUAL(NULL, actual->handle);
+	POINTERS_EQUAL(archive, actual->archive);
+	CHECK(actual->modules);
+	POINTERS_EQUAL(NULL, actual->manifest);
+	POINTERS_EQUAL(pool, actual->memoryPool);
+	CHECK(actual->lock)
+	LONGS_EQUAL(0, actual->lockCount);
+	POINTERS_EQUAL(NULL, actual->lockThread);
+	POINTERS_EQUAL(framework, actual->framework);
+}
+
+TEST(bundle, getArchive) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	bundle->archive = archive;
+
+	bundle_archive_pt actual = NULL;
+	celix_status_t status = bundle_getArchive(bundle, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(archive, actual);
+
+	actual = NULL;
+	status = bundle_getArchive(NULL, &actual);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle, getCurrentModule) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	module_pt module1 = (module_pt) 0x11;
+	module_pt module2 = (module_pt) 0x12;
+	module_pt module3 = (module_pt) 0x13;
+	module_pt module4 = (module_pt) 0x14;
+	arrayList_create(pool, &bundle->modules);
+	arrayList_add(bundle->modules, module1);
+	arrayList_add(bundle->modules, module2);
+	arrayList_add(bundle->modules, module3);
+	arrayList_add(bundle->modules, module4);
+
+	module_pt actual = NULL;
+	celix_status_t status = bundle_getCurrentModule(bundle, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(module4, actual);
+
+	actual = NULL;
+	status = bundle_getCurrentModule(NULL, &actual);
+	LONGS_EQUAL(CELIX_ILLEGAL_ARGUMENT, status);
+}
+
+TEST(bundle, getModules) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	array_list_pt modules = (array_list_pt) 0x10;
+	bundle->modules = modules;
+
+	array_list_pt actual = bundle_getModules(bundle);
+	POINTERS_EQUAL(modules, actual);
+}
+
+TEST(bundle, getHandle) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	void *expected = (void *) 0x10;
+	bundle->handle = expected;
+
+	void *actual = bundle_getHandle(bundle);
+	POINTERS_EQUAL(expected, actual);
+}
+
+TEST(bundle, setHandle) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	void *expected = (void *) 0x10;
+
+	bundle_setHandle(bundle, expected);
+	POINTERS_EQUAL(expected, bundle->handle);
+}
+
+TEST(bundle, getActivator) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	activator_pt expected = (activator_pt) 0x10;
+	bundle->activator = expected;
+
+	activator_pt actual = bundle_getActivator(bundle);
+	POINTERS_EQUAL(expected, actual);
+}
+
+TEST(bundle, setActivator) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	activator_pt expected = (activator_pt) 0x10;
+
+	celix_status_t status = bundle_setActivator(bundle, expected);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(expected, bundle->activator);
+}
+
+TEST(bundle, getContext) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle_context_pt expected = (bundle_context_pt) 0x10;
+	bundle->context = expected;
+
+	bundle_context_pt actual = NULL;
+	celix_status_t status = bundle_getContext(bundle, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(expected, actual);
+}
+
+TEST(bundle, setContext) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle_context_pt expected = (bundle_context_pt) 0x10;
+
+	celix_status_t status = bundle_setContext(bundle, expected);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(expected, bundle->context);
+}
+
+TEST(bundle, getEntry) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle->framework = framework;
+
+	char name[] = "name";
+	char *expected = (char *) 0x20;
+	mock().expectOneCall("framework_getBundleEntry")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("name", name)
+		.withParameter("pool", pool)
+		.andOutputParameter("entry", expected)
+		.andReturnValue(CELIX_SUCCESS);
+
+	char *actual = NULL;
+	celix_status_t status = bundle_getEntry(bundle, name, pool, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(expected, actual);
+}
+
+TEST(bundle, getState) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle->state = BUNDLE_ACTIVE;
+
+	bundle_state_e actual = BUNDLE_UNKNOWN;
+	celix_status_t status = bundle_getState(bundle, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(BUNDLE_ACTIVE, actual);
+}
+
+TEST(bundle, setState) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle->state = BUNDLE_UNKNOWN;
+
+	celix_status_t status = bundle_setState(bundle, BUNDLE_INSTALLED);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(BUNDLE_INSTALLED, bundle->state);
+}
+
+TEST(bundle, getManifest) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	manifest_pt manifest = (manifest_pt) 0x10;
+	bundle->manifest = manifest;
+
+	manifest_pt actual = NULL;
+	celix_status_t status = bundle_getManifest(bundle, &actual);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(manifest, actual);
+}
+
+TEST(bundle, setManifest) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle->manifest = NULL;
+
+	manifest_pt manifest = (manifest_pt) 0x10;
+	celix_status_t status = bundle_setManifest(bundle, manifest);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+	POINTERS_EQUAL(manifest, bundle->manifest);
+}
+
+TEST(bundle, start) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle->framework = framework;
+
+	int options = 42;
+	mock().expectOneCall("fw_startBundle")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("options", options)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_startWithOptions(bundle, options);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, update) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle->framework = framework;
+
+	char input[] = "input";
+	mock().expectOneCall("framework_updateBundle")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("inputFile", input)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_update(bundle, input);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, stop) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle->framework = framework;
+
+	int options = 1;
+	mock().expectOneCall("fw_stopBundle")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.withParameter("record", 0)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_stopWithOptions(bundle, options);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, uninstall) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	framework_pt framework = (framework_pt) 0x10;
+	bundle->framework = framework;
+
+	mock().expectOneCall("fw_uninstallBundle")
+		.withParameter("framework", framework)
+		.withParameter("bundle", bundle)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_uninstall(bundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, setPersistentStateInactive) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	bundle->archive = archive;
+
+
+	mock().expectOneCall("bundleArchive_getId")
+		.withParameter("archive", archive)
+		.andOutputParameter("id", 0)
+		.andReturnValue(CELIX_SUCCESS);
+
+	mock().expectOneCall("bundleArchive_setPersistentState")
+		.withParameter("archive", archive)
+		.withParameter("state", BUNDLE_INSTALLED)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_setPersistentStateInactive(bundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, setPersistentStateUninstalled) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	bundle_archive_pt archive = (bundle_archive_pt) 0x10;
+	bundle->archive = archive;
+
+
+	mock().expectOneCall("bundleArchive_getId")
+		.withParameter("archive", archive)
+		.andOutputParameter("id", 0)
+		.andReturnValue(CELIX_SUCCESS);
+
+	mock().expectOneCall("bundleArchive_setPersistentState")
+		.withParameter("archive", archive)
+		.withParameter("state", BUNDLE_UNINSTALLED)
+		.andReturnValue(CELIX_SUCCESS);
+
+	celix_status_t status = bundle_setPersistentStateUninstalled(bundle);
+	LONGS_EQUAL(CELIX_SUCCESS, status);
+}
+
+TEST(bundle, revise) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+
+	char location[] = "location";
+	char inputFile[] = "inputFile";
+	celix_status_t status = bundle_revise(bundle, location, inputFile);
+}
+
+TEST(bundle, isLockable) {
+	bundle_pt bundle = (bundle_pt) apr_palloc(pool, sizeof(*bundle));
+	apr_thread_mutex_create(&bundle->lock, APR_THREAD_MUTEX_UNNESTED, pool);
+
+	bool lockable = false;
+	celix_status_t status = bundle_isLockable(bundle, &lockable);
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getLockingThread) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, lock) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, unlock) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, close) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, closeAndDelete) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, closeModules) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, refresh) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getBundleId) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getRegisteredServices) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getServicesInUse) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getMemoryPool) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, setFramework) {
+	FAIL("Test not fully implemented");
+}
+
+TEST(bundle, getFramework) {
+	FAIL("Test not fully implemented");
+}

Added: incubator/celix/trunk/framework/private/test/capability_test.cpp
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/capability_test.cpp?rev=1528394&view=auto
==============================================================================
--- incubator/celix/trunk/framework/private/test/capability_test.cpp (added)
+++ incubator/celix/trunk/framework/private/test/capability_test.cpp Wed Oct  2 09:16:54 2013
@@ -0,0 +1,109 @@
+/**
+ *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.
+ */
+/*
+ * capability_test.cpp
+ *
+ *  \date       Feb 11, 2013
+ *  \author     <a href="mailto:celix-dev@incubator.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 "capability_private.h"
+#include "attribute.h"
+}
+
+int main(int argc, char** argv) {
+	RUN_ALL_TESTS(argc, argv);
+	return 0;
+}
+
+TEST_GROUP(capability) {
+	apr_pool_t *pool;
+
+	void setup(void) {
+		apr_initialize();
+		apr_pool_create(&pool, NULL);
+	}
+
+	void teardown() {
+		apr_pool_destroy(pool);
+		mock().checkExpectations();
+		mock().clear();
+	}
+};
+
+TEST(capability, create) {
+	module_pt module = (module_pt) 0x10;
+	hash_map_pt directives = hashMap_create(NULL, NULL, NULL, NULL);
+	hash_map_pt attributes = hashMap_create(NULL, NULL, NULL, NULL);
+
+	version_pt emptyVersion = (version_pt) 0x20; //apr_palloc(pool, sizeof(*version));
+	attribute_pt attribute = (attribute_pt) 0x30;
+	char key[] = "key";
+
+	mock().expectOneCall("version_createEmptyVersion")
+			.withParameter("pool", pool)
+			.andOutputParameter("version", emptyVersion)
+			.andReturnValue(CELIX_SUCCESS);
+	mock().expectOneCall("attribute_getValue")
+			// .withParameter("attribute", (void *) 0x0)
+			// .andOutputParameter("value", (char *) 0x0)
+			.andReturnValue(CELIX_SUCCESS);
+
+	capability_pt capability = NULL;
+	celix_status_t status = capability_create(pool, module, directives, attributes, &capability);
+}
+
+TEST(capability, getServiceName) {
+	capability_pt capability = (capability_pt) apr_palloc(pool, sizeof(*capability));
+	char serviceName[] = "service";
+	capability->serviceName = serviceName;
+
+	char *actual = NULL;
+	capability_getServiceName(capability, &actual);
+	STRCMP_EQUAL(serviceName, actual);
+}
+
+TEST(capability, getVersion) {
+	capability_pt capability = (capability_pt) apr_palloc(pool, sizeof(*capability));
+	version_pt version = (version_pt) 0x10;
+	capability->version = version;
+
+	version_pt actual = NULL;
+	capability_getVersion(capability, &actual);
+	POINTERS_EQUAL(version, actual);
+}
+
+TEST(capability, getModule) {
+	capability_pt capability = (capability_pt) apr_palloc(pool, sizeof(*capability));
+	module_pt module = (module_pt) 0x10;
+	capability->module = module;
+
+	module_pt actual = NULL;
+	capability_getModule(capability, &actual);
+	POINTERS_EQUAL(module, actual);
+}



Mime
View raw message