felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1727487 [1/7] - in /felix/sandbox/pderop/dependencymanager-lambda: org.apache.felix.dependencymanager.lambda.itest/ org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/builder/ org.apache.felix.dependencymanager.lambda....
Date Fri, 29 Jan 2016 06:50:11 GMT
Author: pderop
Date: Fri Jan 29 06:50:09 2016
New Revision: 1727487

URL: http://svn.apache.org/viewvc?rev=1727487&view=rev
Log:
Renamed DependencyActivatorBase to DependencyManagerActivator.
Avoid conflicts between DependencyManagerActivator init method and DM component lifecycle methods, and replaced DependencyManagerActivator init to "activate" method.
Fixed package names, which are now all prefixed with "org.apache.felix.dm.lambda".
Moved FluentProperties class to toplevel API package.


Added:
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyParallelTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectBaseTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectChainTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectDynamicsTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyWithSwapCallbackTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWhiteboardTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithCallbacksServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithPropagationTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AutoConfigTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterWithCallbacksNotAutoConfiguredTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ComponentTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/CompositionTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicProxyAspectTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/Ensure.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryInjectedWithConfigurationBeforeTheCreateMethod.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/InstanceBoundDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ModifiedBundleDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependenciesTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest2.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/RemovedDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ResourceProvider.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyCallbackSignaturesTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyInjectionTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyPropagateTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyThroughCallbackInstanceTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUpdateTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUtil.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TemporalServiceDependencyTest.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TestBase.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Configurator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Provider.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite1.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite2.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderFactory.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Device.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccess.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameter.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryService.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/SpellChecker.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Provider.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderFactory.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinks.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProvider.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/DisplaySite.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/ObservableCompletableFuture.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/SiteInfo.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/SiteInfoImpl.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/observable/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/observable/Activator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/observable/ObservableComponent.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/observable/README
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyManagerActivator.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FluentProperties.java
Removed:
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/builder/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dependencymanager/
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/DependencyActivatorBase.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/FluentProperties.java
Modified:
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/bnd.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/compositefactory.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/device.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/dictionary.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/factory.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/future.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/hello.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/rx.completable.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/rx.observable.bnd
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/BundleAdapterBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/BundleDependencyBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ConfigurationDependencyBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FactoryPidAdapterBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/FutureDependencyBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAdapterBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceAspectBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/AdapterBase.java
    felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ComponentBuilderImpl.java

Modified: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/bnd.bnd?rev=1727487&r1=1727486&r2=1727487&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/bnd.bnd (original)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/bnd.bnd Fri Jan 29 06:50:09 2016
@@ -22,7 +22,7 @@
 -runvm: -ea
 Bundle-Version: 0.0.0.${tstamp}
 Private-Package:  \
-	org.apache.felix.dm.builder.lambda.itest
+	org.apache.felix.dm.lambda.itest
 Test-Cases:  \
 	${classes;CONCRETE;EXTENDS;junit.framework.TestCase}
 javac.source:          1.8

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AbstractServiceDependencyTest extends TestBase {
+   public void testAbstractClassDependency() {
+       DependencyManager m = getDM();
+       // helper class that ensures certain steps get executed in sequence
+       Ensure e = new Ensure();
+       // create a service provider and consumer
+       
+       Component sp = component(m)
+           .provides(ServiceAbstract.class).impl(new ServiceProvider(e)).build();
+
+       Component sc = component(m)
+           .impl(new ServiceConsumer(e)).withSrv(ServiceAbstract.class, srv -> srv.cb(ServiceConsumer::bind, ServiceConsumer::unbind))
+           .build();
+           
+       m.add(sp);
+       m.add(sc);
+       m.remove(sp);
+       // ensure we executed all steps inside the component instance
+       e.step(8);
+       m.clear();
+   }
+
+   static abstract class ServiceAbstract {
+       public abstract void invoke();
+   }
+
+   static class ServiceProvider extends ServiceAbstract {
+       private final Ensure m_ensure;
+       public ServiceProvider(Ensure e) {
+           m_ensure = e;
+       }
+
+       public void start() {
+           m_ensure.step(1);
+       }
+
+       public void invoke() {
+           m_ensure.step(4);
+       }
+
+       public void stop() {
+           m_ensure.step(7);
+       }
+   }
+
+   static class ServiceConsumer {
+       private volatile ServiceAbstract m_service;
+       private final Ensure m_ensure;
+
+       public ServiceConsumer(Ensure e) {
+           m_ensure = e;
+       }
+
+       public void bind(ServiceAbstract service) {
+           m_ensure.step(2);
+           m_service = service;
+       }
+
+       public void start() {
+           m_ensure.step(3);
+           m_service.invoke();
+       }
+
+       public void stop() {
+           m_ensure.step(5);
+       }
+
+       public void unbind(ServiceAbstract service) {
+           System.out.println("UNBINDDDDDDDDDDDDDDDDDDDDDDDDDDD");
+           Assert.assertEquals(m_service, service);
+           m_ensure.step(6);
+       }
+   }
+}
\ No newline at end of file

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterAndConsumerTest extends TestBase {
+    
+    public void testServiceWithAdapterAndConsumer() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+
+        Component provider = component(m).provides(OriginalService.class).impl(new ServiceProvider(e)).build();
+        Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+        Component adapter = adapter(m, OriginalService.class).provides(AdaptedService.class).impl(ServiceAdapter.class).build();
+        		        
+        // add the provider and the adapter
+        m.add(provider);
+        m.add(adapter);
+        // add a consumer that will invoke the adapter
+        // which will in turn invoke the original provider
+        m.add(consumer);
+        // now validate that both have been invoked in the right order
+        e.waitForStep(2, 5000);
+        // remove the provider again
+        m.remove(provider);
+        // ensure that the consumer is stopped
+        e.waitForStep(3, 5000);
+        // remove adapter and consumer
+        m.remove(adapter);
+        m.remove(consumer);
+    }
+
+    static interface OriginalService {
+        public void invoke();
+    }
+    
+    static interface AdaptedService {
+        public void invoke();
+    }
+    
+    static class ServiceProvider implements OriginalService {
+        private final Ensure m_ensure;
+        public ServiceProvider(Ensure e) {
+            m_ensure = e;
+        }
+        public void invoke() {
+            m_ensure.step(2);
+        }
+    }
+    
+    public static class ServiceAdapter implements AdaptedService {
+        private volatile OriginalService m_originalService;
+        
+        public void start() { System.out.println("start"); }
+        public void stop() { System.out.println("stop"); }
+        public void invoke() {
+            m_originalService.invoke();
+        }
+    }
+
+    static class ServiceConsumer {
+        private volatile AdaptedService m_service;
+        private final Ensure m_ensure;
+        
+        public ServiceConsumer(Ensure e) {
+            m_ensure = e;
+        }
+        public void start() {
+            m_ensure.step(1);
+            m_service.invoke();
+        }
+        public void stop() {
+            m_ensure.step(3);
+        }
+    }
+}
+
+

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+
+/**
+ * This tests validates that autoconfiguration of adapted service on adapter class field(s) is not
+ * enabled when an instance callback is used when injected adapted service.
+ */
+public class AdapterNoAutoConfigIfInstanceCallbackIsUsed extends TestBase {
+    static Ensure m_e;
+
+    public void testNoAutoConfigIfInstanceCallbackIsUsed() {
+        m_e = new Ensure();
+        DependencyManager m = getDM();
+        
+        // Declare S1 service
+        component(m, c -> c.impl(S1Impl.class).provides(S1.class));
+        
+        // Declare S1 adapter
+        S1AdapterCallback s1AdapterCB = new S1AdapterCallback();
+        adapter(m, S1.class, a -> a.impl(S1Adapter.class).cbi(s1AdapterCB, "set"));
+        
+        // At this point, the s1AdapterCB.set(S1 s1) method should be called, and s1Adapter.start() method should then be called.
+        // but s1 should not be injected on s1Adapter class fields.
+        
+        m_e.waitForStep(3, 5000);
+        m.clear();
+    }
+    
+    public void testNoAutoConfigIfInstanceCallbackIsUsedRef() {
+        m_e = new Ensure();
+        DependencyManager m = getDM();
+        
+        // Declare S1 service
+        component(m, c -> c.impl(S1Impl.class).provides(S1.class));
+        
+        // Declare S1 adapter
+        S1AdapterCallback s1AdapterCB = new S1AdapterCallback();
+        adapter(m, S1.class, a -> a.impl(S1Adapter.class).cbi(s1AdapterCB::set));
+        
+        // At this point, the s1AdapterCB.set(S1 s1) method should be called, and s1Adapter.start() method should then be called.
+        // but s1 should not be injected on s1Adapter class fields.
+        
+        m_e.waitForStep(3, 5000);
+        m.clear();
+    }
+    
+    public interface S1 {        
+    }
+    
+    public static class S1Impl implements S1 {        
+    }
+    
+    public static class S1Adapter {
+        volatile S1 m_s1; // should not be injected by reflection
+        
+        void start() {
+            m_e.step(2);
+            Assert.assertNull(m_s1);
+            m_e.step(3);
+        }
+    }
+    
+    public static class S1AdapterCallback {
+        void set(S1 s1) {
+            Assert.assertNotNull(s1);
+            m_e.step(1);
+        }
+    }
+    
+}

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithCallbackInstanceTest extends TestBase {
+    
+    public void testServiceWithAdapterAndConsumer() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+
+        ServiceProvider serviceProvider = new ServiceProvider(e);
+        Component provider = component(m).provides(OriginalService.class).impl(serviceProvider).build();
+        Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+        
+        ServiceAdapterCallbackInstance callbackInstance = new ServiceAdapterCallbackInstance(e);
+        Component adapter = adapter(m, OriginalService.class)
+            .provides(AdaptedService.class).impl(new ServiceAdapter(e)).propagate(true)
+            .autoConfig("m_originalService")
+            .cbi(callbackInstance, "set", "changed", "unset")
+            .build();
+       
+        // add the provider and the adapter
+        m.add(provider);
+        m.add(adapter);
+        // Checks if the callbackInstances is called, and if the adapter start method is called
+        e.waitForStep(2, 5000);
+        
+        // add a consumer that will invoke the adapter
+        // which will in turn invoke the original provider
+        m.add(consumer);
+        // now validate that both have been invoked in the right order
+        e.waitForStep(4, 5000);
+        
+        // change the service properties of the provider, and check that the adapter callback instance is changed.
+        serviceProvider.changeServiceProperties();
+        e.waitForStep(5, 5000);
+        
+        // remove the provider
+        m.remove(provider);
+        // ensure that the consumer is stopped, the adapter callback is called in its unset method, and the adapter is stopped.
+        e.waitForStep(8, 5000);
+        // remove adapter and consumer
+        m.remove(adapter);
+        m.remove(consumer);
+    }
+
+    public void testServiceWithAdapterAndConsumerRef() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+
+        ServiceProvider serviceProvider = new ServiceProvider(e);
+        Component provider = component(m).provides(OriginalService.class).impl(serviceProvider).build();
+        Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+        
+        ServiceAdapterCallbackInstance callbackInstance = new ServiceAdapterCallbackInstance(e);
+        Component adapter = adapter(m, OriginalService.class, adp -> adp
+            .provides(AdaptedService.class).impl(new ServiceAdapter(e))
+            .autoAdd(false).propagate(true)
+            .autoConfig("m_originalService")
+            .cbi(callbackInstance::set, callbackInstance::changed, callbackInstance::unset));
+       
+        // add the provider and the adapter
+        m.add(provider);
+        m.add(adapter);
+        // Checks if the callbackInstances is called, and if the adapter start method is called
+        e.waitForStep(2, 5000);
+        
+        // add a consumer that will invoke the adapter
+        // which will in turn invoke the original provider
+        m.add(consumer);
+        // now validate that both have been invoked in the right order
+        e.waitForStep(4, 5000);
+        
+        // change the service properties of the provider, and check that the adapter callback instance is changed.
+        serviceProvider.changeServiceProperties();
+        e.waitForStep(5, 5000);
+        
+        // remove the provider
+        m.remove(provider);
+        // ensure that the consumer is stopped, the adapter callback is called in its unset method, and the adapter is stopped.
+        e.waitForStep(8, 5000);
+        // remove adapter and consumer
+        m.remove(adapter);
+        m.remove(consumer);
+    }
+
+    static interface OriginalService {
+        public void invoke();
+    }
+    
+    static interface AdaptedService {
+        public void invoke();
+    }
+    
+    static class ServiceProvider implements OriginalService {
+        private final Ensure m_ensure;
+        private volatile ServiceRegistration m_registration; // auto injected when started.
+        public ServiceProvider(Ensure e) {
+            m_ensure = e;
+        }
+        public void changeServiceProperties() {
+            Hashtable<String, String> props = new Hashtable<>();
+            props.put("foo", "bar");
+            m_registration.setProperties(props);
+        }
+        public void invoke() {
+            m_ensure.step(4);
+        }
+    }
+    
+    public static class ServiceAdapter implements AdaptedService {
+        private volatile OriginalService m_originalService;
+        private final Ensure m_ensure;
+        
+        public ServiceAdapter(Ensure e) {
+            m_ensure = e;
+        }
+
+        public void start() { m_ensure.step(2); }
+        public void stop() { m_ensure.step(7); }
+        public void invoke() {
+            m_originalService.invoke();
+        }
+    }
+
+    public static class ServiceAdapterCallbackInstance {
+        private final Ensure m_ensure;
+        public ServiceAdapterCallbackInstance(Ensure e) {
+            m_ensure = e;
+        }
+        
+        public void set(OriginalService m_originalService, Map<String, Object> props) {
+            m_ensure.step(1);
+        }
+        
+        public void changed(OriginalService m_originalService, Map<String, Object> props) {   
+            Assert.assertEquals("bar", props.get("foo"));
+            m_ensure.step(5);
+        }
+        
+        public void unset(OriginalService m_originalService, Map<String, Object> props) {            
+            m_ensure.step(8);
+        }
+    }
+
+    static class ServiceConsumer {
+        private volatile AdaptedService m_service;
+        private final Ensure m_ensure;
+        
+        public ServiceConsumer(Ensure e) {
+            m_ensure = e;
+        }
+        public void start() {
+            m_ensure.step(3);
+            m_service.invoke();
+        }
+        public void stop() {
+            m_ensure.step(6);
+        }
+    }
+}
+
+

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithExtraDependenciesTest extends TestBase {
+    
+    public void testAdapterWithExtraDependenciesAndCallbacks() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+        
+        // create a service adapter that adapts to services S1 and has an optional dependency on services S2
+        Component sa = adapter(m, S1.class).impl(SA.class).withSrv(S2.class, s2 -> s2.cb("add", "remove")).build();
+        m.add(sa);
+        
+        // create a service S1, which triggers the creation of the first adapter instance (A1)
+        Component s1 = component(m).provides(S1.class).impl(new S1Impl()).build();
+        m.add(s1);
+        
+        // create a service S2, which will be added to A1
+        Component s2 = component(m).provides(S2.class).impl(new S2Impl(e)).build();
+        m.add(s2);
+        
+        // create a second service S1, which triggers the creation of the second adapter instance (A2)
+        Component s1b = component(m).provides(S1.class).impl(new S1Impl()).build();
+        m.add(s1b);
+        
+        // observe that S2 is also added to A2
+        e.waitForStep(2, 5000);
+        
+        // remove S2 again
+        m.remove(s2);
+        
+        // make sure both adapters have their "remove" callbacks invoked
+        e.waitForStep(4, 5000);
+        
+        m.remove(s1);
+        m.remove(sa);
+        m.clear();
+    }
+    
+    public void testAdapterWithExtraDependenciesAndCallbacksRef() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+        
+        // create a service adapter that adapts to services S1 and has an optional dependency on services S2
+        Component sa = adapter(m, S1.class).impl(SA.class).withSrv(S2.class, s2 -> s2.cb(SA::add, SA::remove)).build();
+        m.add(sa);
+        
+        // create a service S1, which triggers the creation of the first adapter instance (A1)
+        Component s1 = component(m).provides(S1.class).impl(new S1Impl()).build();
+        m.add(s1);
+        
+        // create a service S2, which will be added to A1
+        Component s2 = component(m).provides(S2.class).impl(new S2Impl(e)).build();
+        m.add(s2);
+        
+        // create a second service S1, which triggers the creation of the second adapter instance (A2)
+        Component s1b = component(m).provides(S1.class).impl(new S1Impl()).build();
+        m.add(s1b);
+        
+        // observe that S2 is also added to A2
+        e.waitForStep(2, 5000);
+        
+        // remove S2 again
+        m.remove(s2);
+        
+        // make sure both adapters have their "remove" callbacks invoked
+        e.waitForStep(4, 5000);
+        
+        m.remove(s1);
+        m.remove(sa);
+        m.clear();
+    }
+
+    static interface S1 {
+    }
+    static interface S2 {
+        public void invoke();
+    }
+    static class S1Impl implements S1 {
+    }
+    static class S2Impl implements S2 {
+
+        private final Ensure m_e;
+
+        public S2Impl(Ensure e) {
+            m_e = e;
+        }
+
+        public void invoke() {
+            m_e.step();
+        }
+    }
+    
+    public static class SA {
+        volatile S2 s2;
+        
+        public SA() {
+            System.out.println("Adapter created");
+        }
+        public void init() {
+            System.out.println("Adapter init " + s2);
+        }
+        public void add(S2 s) {
+            System.out.println("adding " + s);
+            s.invoke();
+        }
+        public void remove(S2 s) {
+            System.out.println("removing " + s);
+            s.invoke();
+        }
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyParallelTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyParallelTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyParallelTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyParallelTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithInstanceBoundDependencyParallelTest extends AdapterWithInstanceBoundDependencyTest {
+    public AdapterWithInstanceBoundDependencyParallelTest() {
+        setParallel();
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithInstanceBoundDependencyTest extends TestBase {
+    
+    public void testInstanceBoundDependency() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+        // create a service provider and consumer
+        
+        Component sp = component(m).provides(ServiceInterface.class).impl(new ServiceProvider(e)).build();
+        Component sp2 = component(m).provides(ServiceInterface2.class).impl(new ServiceProvider2(e)).build();
+        Component sc = component(m).impl(new ServiceConsumer(e)).autoAdd(false).withSrv(ServiceInterface3.class).build();
+        Component sa = adapter(m, ServiceInterface.class).provides(ServiceInterface3.class).impl(new ServiceAdapter(e)).build();
+        m.add(sc);
+        m.add(sp);
+        m.add(sp2);
+        m.add(sa);
+        e.waitForStep(5, 15000);
+        // cleanup
+        m.remove(sa);
+        m.remove(sp2);
+        m.remove(sp);
+        m.remove(sc);
+        m.clear();
+        e.waitForStep(9, 5000); // make sure all components are stopped
+    }       
+    
+    static interface ServiceInterface {
+        public void invoke();
+    }
+    
+    static interface ServiceInterface2 {
+        public void invoke();
+    }
+    
+    static interface ServiceInterface3 {
+        public void invoke();
+    }
+    
+    static class ServiceProvider2 implements ServiceInterface2 {
+        private final Ensure m_ensure;
+
+        public ServiceProvider2(Ensure ensure) {
+            m_ensure = ensure;
+        }
+
+        public void invoke() {
+            m_ensure.step(4);
+        }
+        
+        public void stop() {
+            m_ensure.step();
+        }
+    }
+
+    static class ServiceProvider implements ServiceInterface {
+        private final Ensure m_ensure;
+        public ServiceProvider(Ensure e) {
+            m_ensure = e;
+        }
+        public void invoke() {
+            m_ensure.step(5);
+        }
+        public void stop() {
+            m_ensure.step();
+        }
+    }
+    
+    static class ServiceAdapter implements ServiceInterface3 {
+        private Ensure m_ensure;
+        private volatile ServiceInterface m_originalService;
+        private volatile ServiceInterface2 m_injectedService;
+        private volatile Component m_component;
+        private volatile DependencyManager m_manager;
+        
+        public ServiceAdapter(Ensure e) {
+            m_ensure = e;
+        }
+        public void init() {
+            m_ensure.step(1);
+            component(m_component, c->c.withSrv(ServiceInterface2.class));
+        }
+        public void start() {
+            m_ensure.step(2);
+        }
+        public void invoke() {
+            m_ensure.step(3);
+            m_injectedService.invoke();
+            m_originalService.invoke();
+        }
+        
+        public void stop() {
+            m_ensure.step();
+        }
+    }
+
+    static class ServiceConsumer implements Runnable {
+        volatile ServiceInterface3 m_service;
+        final Ensure m_ensure;
+        
+        ServiceConsumer(Ensure e) {
+            m_ensure = e;
+        }
+        
+        public void init() {
+            Thread t = new Thread(this);
+            t.start();
+        }
+        
+        public void run() {
+            m_service.invoke();
+        }
+        public void stop() {
+            m_ensure.step();
+        }
+    }
+}
+
+

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+
+/**
+ * Test for FELIX-4334 issue.
+ * 
+ * Three components: A, B and C
+ * 
+ * - A provided with property foo=bar
+ * - B adapts A, B has no filters on A, and B.init() method adds an instance bound required dependency to C.
+ * - C depends on A(foo=bar)
+ * - Now someone modifies the service properties of A: foo=bar2
+ * - As a result of that, C becomes unavailable and is unbound from B.
+ * - Since B has an instance bound required dependency to C: B should not be destroyed: it should be called in B.stop(), B.remove(C), B.change(A, "foo=bar2))
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithModifiedInstanceBoundDependencyTest extends TestBase {
+    public static interface A {
+    }
+    
+    static class AImpl implements A {
+        final Ensure m_e;
+        AImpl(Ensure e) {
+            m_e = e;
+        }        
+    }
+    
+    public static interface C {
+    }
+
+    static class CImpl implements C {
+        volatile A m_a;
+    }
+    
+    public static interface B {
+    }
+    
+    public static class BImpl implements B {
+        final Ensure m_e;
+        volatile A m_a;
+        volatile C m_c;
+        
+        BImpl(Ensure e) {
+            m_e = e;
+        }
+        
+        void init(Component comp) {
+            m_e.step(2);
+            component(comp, c->c.withSrv(C.class, s->s.cb("addC", "removeC")));
+        }      
+        
+        void addA(A a, Map<String, Object> properties) {
+            m_e.step(1);
+        }
+
+        public void addC(C c) {
+            m_e.step(3);
+        }
+        
+        public void start() {
+            m_e.step(4);            
+        }
+        
+        public void stop() { // C becomes unsatisfied when A properties are changed to foo=bar2
+            m_e.step(5);
+        }
+
+        public void removeC(C c) {
+            m_e.step(6);
+        }
+
+        public void changeA(A a, Map<String, Object> properties) {
+            Assert.assertEquals("bar2", properties.get("foo"));
+            m_e.step(7);
+        }
+        
+        public void destroy() {
+            m_e.step(8);
+        }
+
+        public void removeA(A a, Map<String, Object> properties) {   
+            m_e.step(9);
+        }                    
+    }
+    
+    public void testAdapterWithChangedInstanceBoundDependency() {
+        DependencyManager m = getDM();
+        Ensure e = new Ensure();
+
+        Component a = component(m).impl(new AImpl(e)).provides(A.class).properties(foo -> "bar").build();
+        Component b = adapter(m, A.class).provides(B.class).impl(new BImpl(e)).cb("addA", "changeA", "removeA").build();
+        Component c = component(m).impl(new CImpl()).provides(C.class).withSrv(A.class, "(foo=bar)").build();
+                      
+        m.add(a);
+        m.add(c);
+        m.add(b);
+        
+        e.waitForStep(4, 5000);
+        
+        System.out.println("changing A props ...");
+        Properties props = new Properties();
+        props.put("foo", "bar2");
+        a.setServiceProperties(props);
+        
+        e.waitForStep(7, 5000);                
+        
+        m.remove(c);
+        m.remove(a);
+        m.remove(b);
+        
+        e.waitForStep(9, 5000);                
+    }
+    
+    public void testAdapterWithChangedInstanceBoundDependencyRef() {
+        DependencyManager m = getDM();
+        Ensure e = new Ensure();
+
+        Component a = component(m).impl(new AImpl(e)).provides(A.class).properties(foo -> "bar").build();        
+        Component b = adapter(m, A.class).impl(new BImpl(e)).provides(B.class).cb(BImpl::addA, BImpl::changeA, BImpl::removeA).build();        
+        Component c = component(m).impl(new CImpl()).provides(C.class).withSrv(A.class, s -> s.filter("(foo=bar)")).build();
+                      
+        m.add(a);
+        m.add(c);
+        m.add(b);
+        
+        e.waitForStep(4, 5000);
+        
+        System.out.println("changing A props ...");
+        Properties props = new Properties();
+        props.put("foo", "bar2");
+        a.setServiceProperties(props);
+        
+        e.waitForStep(7, 5000);                
+        
+        m.remove(c);
+        m.remove(a);
+        m.remove(b);
+        
+        e.waitForStep(9, 5000);                
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+
+/**
+ * Checks if a service adapter propagates its service properties, if 
+ * the adapted service properties are changed:
+ * 
+ * S1Impl provides S
+ * S1Adapter adapts S1Impl(S) to S2
+ * S3 depends on S2
+ * 
+ * So, when S1Impl service properties are changed, S1Adapter shall propagate the changed properties to S3.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@SuppressWarnings({"unchecked", "rawtypes"})
+public class AdapterWithPropagationTest extends TestBase {
+    public static interface S1 {}
+    
+    static class S1Impl implements S1 {
+        private Ensure m_ensure;
+        public S1Impl(Ensure e) {
+            m_ensure = e;
+        }
+        
+        public void start() {
+            m_ensure.step(1);
+        }
+    }
+    
+    public static interface S2 {}
+
+    static class S1Adapter implements S2 {
+        private Ensure m_ensure;
+        public S1Adapter(Ensure e) {
+            m_ensure = e;
+        }
+        
+        public void add(Map properties, S1 s1) {
+            Assert.assertTrue("v1".equals(properties.get("p1")));
+            Assert.assertTrue("v2overriden".equals(properties.get("p2")));
+            m_ensure.step(2);
+        }
+        
+        public void change(Map properties, S1 s1) {   
+            Assert.assertTrue("v1modified".equals(properties.get("p1")));
+            Assert.assertTrue("v2overriden".equals(properties.get("p2")));
+            m_ensure.step(4);
+        }
+    }
+
+    static class S3 {
+        private final Ensure m_ensure;
+
+        public S3(Ensure e) {
+            m_ensure = e;
+        }
+                        
+        public void add(Map properties, S2 s2) {
+            Assert.assertTrue("v1".equals(properties.get("p1")));
+            Assert.assertTrue("v2".equals(properties.get("p2"))); // s1 should not override adapter service properties
+            m_ensure.step(3);
+        }
+        
+        public void change(Map properties, S2 s2) {
+            Assert.assertTrue("v1modified".equals(properties.get("p1")));
+            Assert.assertTrue("v2".equals(properties.get("p2"))); // s1 should not override adapter service properties
+            m_ensure.step(5);
+        }
+    }
+    
+    public void testAdapterWithPropagation() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure(); 
+        
+        Component s1 = component(m).impl(new S1Impl(e)).provides(S1.class).properties(p1 -> "v1", p2 -> "v2overriden").build();
+        Component s1Adapter = adapter(m, S1.class).cb("add", "change", null).impl(new S1Adapter(e)).provides(S2.class).properties(p2 -> "v2").build();   
+        Component s3 = component(m).impl(new S3(e)).withSrv(S2.class, s -> s.cb("add", "change", null)).build();
+                                          
+        m.add(s1);
+        m.add(s1Adapter);
+        m.add(s3);
+        
+        e.waitForStep(3, 5000);
+        
+        Hashtable s1Properties = new Hashtable();
+        s1Properties.put("p1", "v1modified");
+        s1Properties.put("p2", "v2overriden");
+        s1.setServiceProperties(s1Properties);
+        
+        e.waitForStep(5, 5000);
+
+        m.clear();
+    }
+}

Added: felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java?rev=1727487&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java (added)
+++ felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java Fri Jan 29 06:50:09 2016
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+package org.apache.felix.dm.lambda.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.adapter;
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.junit.Assert;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AdapterWithoutPropagationTest extends TestBase {
+    
+    public void testAdapterNoPropagate() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+
+        // The provider has a "foo=bar" property
+        ServiceProvider serviceProvider = new ServiceProvider(e);
+        Component provider = component(m).provides(OriginalService.class).properties(foo -> "bar").impl(serviceProvider).build();
+
+        // The Adapter will see the "foo=bar" property from the adaptee
+        Component adapter = adapter(m, OriginalService.class)
+            .propagate(false).cb("set", "change", null).provides(AdaptedService.class).impl(new ServiceAdapter(e)).build();
+
+        // The consumer depends on the AdaptedService, but won't see foo=bar property from the adaptee 
+        Component consumer = component(m) 
+            .impl(new ServiceConsumer(e)).withSrv(AdaptedService.class, b -> b.cb("set", "change", null)).build();
+        
+        // add the provider and the adapter
+        m.add(provider);
+        m.add(adapter);
+        // Checks if the adapter has been started and has seen the adaptee properties
+        e.waitForStep(1, 5000);
+        
+        // add a consumer that must not see the adaptee service properties
+        m.add(consumer);
+        e.waitForStep(2, 5000);
+        
+        // change the service properties of the provider, and check that the adapter callback instance is caled.
+        serviceProvider.changeServiceProperties();
+        e.waitForStep(3, 5000);
+        
+        // cleanup
+        m.clear();
+    }
+
+    public void testAdapterNoPropagateRef() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+
+        // The provider has a "foo=bar" property
+        ServiceProvider serviceProvider = new ServiceProvider(e);
+        Component provider = component(m).provides(OriginalService.class).properties(foo -> "bar").impl(serviceProvider).build();
+
+        // The Adapter will see the "foo=bar" property from the adaptee
+        ServiceAdapter saimpl = new ServiceAdapter(e);
+        Component adapter = adapter(m, OriginalService.class).propagate(false).impl(saimpl).provides(AdaptedService.class).cbi(saimpl::set, saimpl::change, null).build();           
+
+        // The consumer depends on the AdaptedService, but won't see foo=bar property from the adaptee 
+        ServiceConsumer scimpl = new ServiceConsumer(e);
+        Component consumer = component(m).impl(scimpl).withSrv(AdaptedService.class, s -> s.cbi(scimpl::set, scimpl::change, null)).build();
+        
+        // add the provider and the adapter
+        m.add(provider);
+        m.add(adapter);
+        // Checks if the adapter has been started and has seen the adaptee properties
+        e.waitForStep(1, 5000);
+        
+        // add a consumer that must not see the adaptee service properties
+        m.add(consumer);
+        e.waitForStep(2, 5000);
+        
+        // change the service properties of the provider, and check that the adapter callback instance is caled.
+        serviceProvider.changeServiceProperties();
+        e.waitForStep(3, 5000);
+        
+        // cleanup
+        m.clear();
+    }
+
+    static interface OriginalService {
+    }
+    
+    static interface AdaptedService {
+    }
+    
+    static class ServiceProvider implements OriginalService {
+        private volatile ServiceRegistration m_registration; // auto injected when started.
+        public ServiceProvider(Ensure e) {
+        }
+        public void changeServiceProperties() {
+            Hashtable<String, String> props = new Hashtable<>();
+            props.put("foo", "bar2");
+            m_registration.setProperties(props);
+        }
+    }
+    
+    public static class ServiceAdapter implements AdaptedService {
+        private final Ensure m_ensure;
+        
+        public ServiceAdapter(Ensure e) {
+            m_ensure = e;
+        }
+
+        public void set(OriginalService adaptee, Dictionary<String, Object> props) {
+            Assert.assertEquals("bar", props.get("foo"));
+            m_ensure.step(1);
+        }
+        
+        void change(OriginalService adapted, Dictionary<String, Object> props) {
+            Assert.assertEquals("bar2", props.get("foo"));
+            m_ensure.step(3);
+        }
+    }
+
+    static class ServiceConsumer {
+        @SuppressWarnings("unused")
+		private volatile AdaptedService m_service;
+        private final Ensure m_ensure;
+        
+        public ServiceConsumer(Ensure e) {
+            m_ensure = e;
+        }
+        
+        void set(AdaptedService adapted, Dictionary<String, Object> props) {
+            Assert.assertNull(props.get("foo"));
+            m_ensure.step(2);
+        }
+        
+        void change(AdaptedService adapted, Dictionary<String, Object> props) {
+            Assert.assertNull(props.get("foo"));
+            Assert.fail("Change callback should not be called");
+        }
+    }
+}
+
+



Mime
View raw message