You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2017/10/16 23:03:17 UTC

[1/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improver coverage.

Repository: incubator-tamaya-extensions
Updated Branches:
  refs/heads/master fe5eac609 -> a1cd433a9


TAMAYA-300 Added tests to improver coverage.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/1e8ac056
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/1e8ac056
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/1e8ac056

Branch: refs/heads/master
Commit: 1e8ac05636110b42adb71ecd5147829890ea3287
Parents: fe5eac6
Author: Anatole Tresch <an...@apache.org>
Authored: Mon Oct 16 15:59:10 2017 +0200
Committer: Anatole Tresch <an...@apache.org>
Committed: Mon Oct 16 15:59:10 2017 +0200

----------------------------------------------------------------------
 modules/osgi/updater/bnd.bnd                    |  34 +++++++
 modules/osgi/updater/pom.xml                    |  92 +++++++++++++++++
 .../apache/tamaya/osgi/updater/Activator.java   |  76 ++++++++++++++
 .../tamaya/osgi/updater/EventListener.java      |  79 +++++++++++++++
 .../tamaya/osgi/updater/AbstractOSGITest.java   | 101 +++++++++++++++++++
 .../tamaya/osgi/updater/ActivatorTest.java      |  44 ++++++++
 .../tamaya/osgi/updater/EventListenerTest.java  |  60 +++++++++++
 7 files changed, 486 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/bnd.bnd b/modules/osgi/updater/bnd.bnd
new file mode 100644
index 0000000..416db00
--- /dev/null
+++ b/modules/osgi/updater/bnd.bnd
@@ -0,0 +1,34 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - OSGI Updater
+Bundle-SymbolicName: org.apache.tamaya.osgi.updater
+Bundle-Description: Apacha Tamaya Configuration - OSGI Updater
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Bundle-Activator: org.apache.tamaya.osgi.updater.Activator
+Export-Package: \
+	org.apache.tamaya.osgi.updater
+Import-Package: \
+    org.apache.tamaya.osgi,\
+    org.osgi.framework,\
+    org.osgi.service.cm,\
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.apache.tamaya.functions,\
+    org.apache.tamaya.spisupport,\
+    org.apache.tamaya.events
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/pom.xml b/modules/osgi/updater/pom.xml
new file mode 100644
index 0000000..18d5370
--- /dev/null
+++ b/modules/osgi/updater/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-osgi-updater</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tamaya :: OSGi :: Updater</name>
+    <description>Tamaya Based OSGI Updater to propagate Tamaya changes to OSGI.</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-functions</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-spisupport</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-events</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-osgi</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <!-- Testing -->
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java
new file mode 100644
index 0000000..a83f18f
--- /dev/null
+++ b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java
@@ -0,0 +1,76 @@
+/*
+ * 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.tamaya.osgi.updater;
+
+import org.apache.tamaya.events.ConfigEventManager;
+import org.apache.tamaya.events.ConfigurationChange;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.*;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.logging.Logger;
+
+/**
+ * Activator that registers the Tamaya based Service Class for {@link ConfigurationAdmin},
+ * using a default service priority of {@code 0}. This behaviour is configurable based on OSGI properties:
+ * <ul>
+ *     <li><p><b>org.tamaya.integration.osgi.cm.ranking, type: int</b> allows to configure the OSGI service ranking for
+ *     Tamaya based ConfigurationAdmin instance. The default ranking used is 10.</p></li>
+ *     <li><p><b>org.tamaya.integration.osgi.cm.override, type: boolean</b> allows to configure if Tamaya should
+ *     register its ConfigAdmin service. Default is true.</p></li>
+ * </ul>
+ */
+public class Activator implements BundleActivator {
+
+    private static final Logger LOG = Logger.getLogger(Activator.class.getName());
+
+    private EventListener listener;
+
+    private static final long DELAY = 5000L;
+    private static final long PERIOD = 5000L;
+    private Timer updateTimer = new Timer("Tamaya OSGI update monitor.", true);
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        listener = new EventListener(context);
+        ConfigEventManager.addListener(listener, ConfigurationChange.class);
+        LOG.info("Registered Tamaya getConfig trigger for OSGI.");
+        ServiceReference<TamayaConfigService> pluginRef = context.getServiceReference(TamayaConfigService.class);
+        TamayaConfigService tamayaPlugin = context.getService(pluginRef);
+        updateTimer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                ConfigEventManager.enableChangeMonitoring(tamayaPlugin.isAutoUpdateEnabled());
+            }
+        }, DELAY, PERIOD);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        updateTimer.cancel();
+        if (listener != null) {
+            ConfigEventManager.removeListener(this.listener, ConfigurationChange.class);
+            LOG.info("Unregistered Tamaya getConfig trigger for OSGI.");
+            ConfigEventManager.enableChangeMonitoring(false);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
new file mode 100644
index 0000000..68e9bcb
--- /dev/null
+++ b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
@@ -0,0 +1,79 @@
+/*
+ * 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.tamaya.osgi.updater;
+
+import org.apache.tamaya.events.ConfigEvent;
+import org.apache.tamaya.events.ConfigEventListener;
+import org.apache.tamaya.events.ConfigurationChange;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.*;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.beans.PropertyChangeEvent;
+import java.util.*;
+import java.util.logging.Logger;
+
+/**
+ * Tamaya plugin that updates/extends the component configurations managed
+ * by {@link ConfigurationAdmin}, based on the configured {@link Policy}.
+ */
+final class EventListener implements ConfigEventListener{
+    private static final Logger LOG = Logger.getLogger(EventListener.class.getName());
+    private BundleContext context;
+
+    public EventListener(BundleContext context){
+        this.context = context;
+    }
+
+
+    @Override
+    public void onConfigEvent(ConfigEvent<?> event) {
+        LOG.finest("Tamya Config change triggered: " + event);
+        Set<String> changedPids = new HashSet<>();
+        ConfigurationChange cc = (ConfigurationChange)event;
+        for(PropertyChangeEvent evt: cc.getChanges()){
+            String key = evt.getPropertyName();
+            String pid = getPid(key);
+            if(pid!=null){
+                changedPids.add(pid);
+            }
+        }
+        if(changedPids.isEmpty()){
+            LOG.finest("Tamya Config change not targeting OSGI.");
+            return;
+        }
+        LOG.finest("Tamya Config change for pids: " + changedPids);
+        // Reload the given pids
+        ServiceReference<TamayaConfigService> pluginRef = context.getServiceReference(TamayaConfigService.class);
+        TamayaConfigService tamayaPlugin = context.getService(pluginRef);
+        for(String pid:changedPids) {
+            tamayaPlugin.updateConfig(pid);
+        }
+    }
+
+    private String getPid(String key) {
+        int index0 = key.indexOf("[");
+        int index1 = key.indexOf("]");
+        if(index0 >=0 && (index1 - index0) > 0){
+            return key.substring(index0+1,index1);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
new file mode 100644
index 0000000..6f9f521
--- /dev/null
+++ b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.tamaya.osgi.updater;
+
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.junit.Before;
+import org.mockito.Mock;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+/**
+ * Created by atsticks on 27.09.17.
+ */
+public abstract class AbstractOSGITest {
+
+    private Map<String,Hashtable<String, Object>> properties = new ConcurrentHashMap<>();
+
+    @Mock
+    protected BundleContext bundleContext;
+
+    @Mock
+    protected ConfigurationAdmin cm;
+
+    @Mock
+    private ServiceReference<ConfigurationAdmin> cmRef;
+
+    @Mock
+    private ServiceReference<TamayaConfigService> tamayaRef;
+
+    @Mock
+    protected TamayaConfigService tamayaConfigService;
+
+    protected Dictionary<String,Object> getProperties(String pid){
+        return this.properties.get(pid);
+    }
+
+    @Before
+    public void setup()throws Exception{
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any());
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any(), any());
+        doReturn(new Bundle[0]).when(bundleContext).getBundles();
+        doReturn(cmRef).when(bundleContext).getServiceReference(ConfigurationAdmin.class);
+        doReturn(cm).when(bundleContext).getService(cmRef);
+        doReturn(tamayaConfigService).when(bundleContext).getService(tamayaRef);
+        doReturn(tamayaRef).when(bundleContext).getServiceReference(TamayaConfigService.class);
+    }
+
+    protected Configuration initConfigurationMock(final String pid)throws Exception{
+        Configuration config = mock(Configuration.class);
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            props.clear();
+            props.putAll((Map<? extends String, ?>) invocation.getArguments()[0]);
+            return null;
+        }).when(config).update(any(Dictionary.class));
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            if(props==null){
+                props = new Hashtable<>();
+                properties.put(pid, props);
+                for(Map.Entry en:System.getProperties().entrySet()){
+                    props.put(en.getKey().toString(), en.getValue());
+                }
+            }
+            return new Hashtable<>(props);
+        }).when(config).getProperties();
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
new file mode 100644
index 0000000..5e1f614
--- /dev/null
+++ b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.tamaya.osgi.updater;
+
+import org.apache.tamaya.events.ConfigEventManager;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static junit.framework.TestCase.assertEquals;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ActivatorTest extends AbstractOSGITest{
+
+    @Test
+    public void startStop() throws Exception {
+        int size = ConfigEventManager.getListeners().size();
+        Activator activator = new Activator();
+        activator.start(super.bundleContext);
+        assertEquals(ConfigEventManager.getListeners().size(), size+1);
+        activator.stop(super.bundleContext);
+        assertEquals(ConfigEventManager.getListeners().size(), size);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/1e8ac056/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/EventListenerTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/EventListenerTest.java b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/EventListenerTest.java
new file mode 100644
index 0000000..6ffd618
--- /dev/null
+++ b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/EventListenerTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tamaya.osgi.updater;
+
+import org.apache.tamaya.events.ConfigEvent;
+import org.apache.tamaya.events.ConfigurationChangeBuilder;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class EventListenerTest extends AbstractOSGITest{
+
+    private EventListener eventListener;
+
+    @Before
+    public void setupEL() throws Exception {
+        eventListener = new EventListener(bundleContext);
+    }
+
+    @Test
+    public void testEventWithNoDataDoesNotTriggerTamayaServices() throws Exception {
+        ConfigEvent evt = ConfigurationChangeBuilder.of().addChange("a", "b").build();
+        eventListener.onConfigEvent(evt);
+        verify(bundleContext, never()).getServiceReference(TamayaConfigService.class);
+    }
+
+    @Test
+    public void testEventForPIDDoesTriggerTamayaServices() throws Exception {
+        ConfigEvent evt = ConfigurationChangeBuilder.of().addChange("[PID.foo]a", "b").build();
+        eventListener.onConfigEvent(evt);
+        verify(bundleContext).getServiceReference(TamayaConfigService.class);
+        verify(tamayaConfigService).updateConfig("PID.foo");
+    }
+
+}
\ No newline at end of file


[4/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/ConfigCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/ConfigCommandsTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/ConfigCommandsTest.java
new file mode 100644
index 0000000..a2c273b
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/ConfigCommandsTest.java
@@ -0,0 +1,204 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.apache.tamaya.osgi.AbstractOSGITest;
+import org.apache.tamaya.osgi.Policy;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigCommandsTest extends AbstractOSGITest{
+    @Test
+    public void getInfo() throws Exception {
+        String result = ConfigCommands.getInfo(tamayaConfigPlugin);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("Property Sources"));
+        assertTrue(result.contains("Property Converter"));
+        assertTrue(result.contains("Property Filter"));
+        assertTrue(result.contains("ConfigurationContext"));
+        assertTrue(result.contains("Configuration"));
+    }
+
+    @Test
+    public void readTamayaConfig() throws Exception {
+        String result = ConfigCommands.readTamayaConfig("java", null);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains(".version"));
+        assertTrue(result.contains("Section"));
+        assertTrue(result.contains("java"));
+        result = ConfigCommands.readTamayaConfig("java", "version");
+        assertNotNull(result);
+        assertFalse(result.contains(".version"));
+        assertTrue(result.contains("Section"));
+        assertTrue(result.contains("java"));
+        assertTrue(result.contains("Filter"));
+        assertTrue(result.contains("version"));
+        assertFalse(result.contains("java.vendor"));
+        System.out.println("readTamayaConfig: " + result);
+    }
+
+    @Test
+    public void readTamayaConfig4PID() throws Exception {
+        String result = ConfigCommands.readTamayaConfig4PID("test", null);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("Configuration"));
+        assertTrue(result.contains("test"));
+    }
+
+    @Test
+    public void applyTamayaConfiguration() throws Exception {
+        String result = ConfigCommands.applyTamayaConfiguration(tamayaConfigPlugin, "applyTamayaConfiguration", Policy.OVERRIDE.toString(), true);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("OSGI Configuration for PID"));
+        assertTrue(result.contains("applyTamayaConfiguration"));
+        assertTrue(result.contains("OVERRIDE"));
+        assertTrue(result.contains("Applied"));
+        assertTrue(result.contains("false"));
+    }
+
+    @Test
+    public void readOSGIConfiguration() throws Exception {
+        String result = ConfigCommands.readOSGIConfiguration(tamayaConfigPlugin, "readOSGIConfiguration", "java");
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("OSGI Configuration for PID"));
+        assertTrue(result.contains("readOSGIConfiguration"));
+        assertTrue(result.contains("java.home"));
+    }
+
+    @Test
+    public void getDefaultOpPolicy() throws Exception {
+        Policy mode = tamayaConfigPlugin.getDefaultPolicy();
+        String result = ConfigCommands.getDefaultOpPolicy(tamayaConfigPlugin);
+        assertNotNull(result);
+        assertTrue(result.contains(mode.toString()));
+    }
+
+    @Test
+    public void setDefaultOpPolicy() throws Exception {
+        String result = ConfigCommands.setDefaultOpPolicy(tamayaConfigPlugin, Policy.EXTEND.toString());
+        assertNotNull(result);
+        assertTrue(result.contains("EXTEND"));
+        assertEquals(tamayaConfigPlugin.getDefaultPolicy(), Policy.EXTEND);
+        result = ConfigCommands.setDefaultOpPolicy(tamayaConfigPlugin, Policy.UPDATE_ONLY.toString());
+        assertNotNull(result);
+        assertTrue(result.contains("UPDATE_ONLY"));
+        assertEquals(tamayaConfigPlugin.getDefaultPolicy(), Policy.UPDATE_ONLY);
+    }
+
+    @Test
+    public void getProperty() throws Exception {
+        String result = ConfigCommands.getProperty("system-properties", "java.version", false);
+        assertNotNull(result);
+        System.out.println(result);
+        assertEquals(result, System.getProperty("java.version"));
+        result = ConfigCommands.getProperty("system-properties", "java.version", true);
+        assertNotNull(result);
+    }
+
+    @Test
+    public void getPropertySource() throws Exception {
+        String result = ConfigCommands.getPropertySource("system-properties");
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("Property Source"));
+        assertTrue(result.contains("ID"));
+        assertTrue(result.contains("system-properties"));
+        assertTrue(result.contains("Ordinal"));
+        assertTrue(result.contains("java.version"));
+    }
+
+    @Test
+    public void getPropertySourceOverview() throws Exception {
+        String result = ConfigCommands.getPropertySourceOverview();
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("Ordinal"));
+        assertTrue(result.contains("Class"));
+        assertTrue(result.contains("Ordinal"));
+        assertTrue(result.contains("ID"));
+        assertTrue(result.contains("Ordinal"));
+        assertTrue(result.contains("system-properties"));
+        assertTrue(result.contains("environment-properties"));
+        assertTrue(result.contains("CLI"));
+    }
+
+    @Test
+    public void setDefaultEnabled() throws Exception {
+        String result = ConfigCommands.setDefaultEnabled(tamayaConfigPlugin, true);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains(TamayaConfigService.TAMAYA_ENABLED_PROP+"=true"));
+        assertTrue(tamayaConfigPlugin.isTamayaEnabledByDefault());
+        result = ConfigCommands.setDefaultEnabled(tamayaConfigPlugin, false);
+        assertNotNull(result);
+        assertTrue(result.contains(TamayaConfigService.TAMAYA_ENABLED_PROP+"=false"));
+        assertFalse(tamayaConfigPlugin.isTamayaEnabledByDefault());
+    }
+
+    @Test
+    public void getDefaultEnabled() throws Exception {
+        tamayaConfigPlugin.setTamayaEnabledByDefault(true);
+        String result = ConfigCommands.getDefaultEnabled(tamayaConfigPlugin);
+        System.out.println(result);
+        tamayaConfigPlugin.setTamayaEnabledByDefault(false);
+        result = ConfigCommands.getDefaultEnabled(tamayaConfigPlugin);
+        assertNotNull(result);
+        assertTrue(result.equals("false"));
+    }
+
+    @Test
+    public void setAutoUpdateEnabled() throws Exception {
+        String result = ConfigCommands.setAutoUpdateEnabled(tamayaConfigPlugin, true);
+        assertNotNull(result);
+        System.out.println(result);
+        assertTrue(result.contains("true"));
+        assertTrue(result.contains(TamayaConfigService.TAMAYA_AUTO_UPDATE_ENABLED_PROP));
+        assertTrue(tamayaConfigPlugin.isAutoUpdateEnabled());
+        result = ConfigCommands.setAutoUpdateEnabled(tamayaConfigPlugin, false);
+        assertNotNull(result);
+        assertTrue(result.contains("false"));
+        assertTrue(result.contains(TamayaConfigService.TAMAYA_AUTO_UPDATE_ENABLED_PROP));
+        assertFalse(tamayaConfigPlugin.isAutoUpdateEnabled());
+    }
+
+    @Test
+    public void getAutoUpdateEnabled() throws Exception {
+        tamayaConfigPlugin.setAutoUpdateEnabled(true);
+        String result = ConfigCommands.getAutoUpdateEnabled(tamayaConfigPlugin);
+        System.out.println(result);
+        assertTrue(result.contains("true"));
+        tamayaConfigPlugin.setAutoUpdateEnabled(false);
+        result = ConfigCommands.getAutoUpdateEnabled(tamayaConfigPlugin);
+        assertNotNull(result);
+        assertTrue(result.contains("false"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/HistoryCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/HistoryCommandsTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/HistoryCommandsTest.java
new file mode 100644
index 0000000..ad32857
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/HistoryCommandsTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.apache.tamaya.osgi.AbstractOSGITest;
+import org.apache.tamaya.osgi.ConfigHistory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class HistoryCommandsTest extends AbstractOSGITest {
+
+    @Test
+    public void clearHistory() throws Exception {
+        ConfigHistory.configured("clearHistory1", "test");
+        ConfigHistory.configured("clearHistory2", "test");
+        assertTrue(ConfigHistory.getHistory("clearHistory1").size()==1);
+        assertTrue(ConfigHistory.getHistory("clearHistory2").size()==1);
+        assertTrue(ConfigHistory.getHistory("clearHistory3").size()==0);
+        String result = HistoryCommands.clearHistory(tamayaConfigPlugin, "clearHistory1");
+        assertTrue(result.contains("PID"));
+        assertTrue(result.contains("clearHistory1"));
+        assertTrue(ConfigHistory.getHistory("clearHistory1").size()==0);
+        assertTrue(ConfigHistory.getHistory("clearHistory2").size()==1);
+        assertTrue(ConfigHistory.getHistory("clearHistory3").size()==0);
+        ConfigHistory.configured("clearHistory1", "test");
+        result = HistoryCommands.clearHistory(tamayaConfigPlugin, "*");
+        assertTrue(result.contains("PID"));
+        assertTrue(result.contains("*"));
+        assertTrue(ConfigHistory.getHistory("clearHistory1").size()==0);
+        assertTrue(ConfigHistory.getHistory("clearHistory2").size()==0);
+        assertTrue(ConfigHistory.getHistory("clearHistory3").size()==0);
+
+    }
+
+    @Test
+    public void getHistory() throws Exception {
+        ConfigHistory.configured("getHistory", "test");
+        ConfigHistory.configuring("getHistory", "test");
+        ConfigHistory.propertySet("getHistory", "k1", "v1", null);
+        ConfigHistory.propertySet("getHistory", "k2", null, "v2");
+        String result = HistoryCommands.getHistory(tamayaConfigPlugin, "getHistory");
+        assertNotNull(result);
+        assertTrue(result.contains("k1"));
+        assertTrue(result.contains("v1"));
+        assertTrue(result.contains("test"));
+        result = HistoryCommands.getHistory(tamayaConfigPlugin, "getHistory", ConfigHistory.TaskType.BEGIN.toString());
+        assertNotNull(result);
+        assertTrue(result.contains("getHistory"));
+        assertTrue(result.contains("test"));
+        assertFalse(result.contains("k1"));
+        assertFalse(result.contains("v2"));
+    }
+
+    @Test
+    public void getSetMaxHistorySize() throws Exception {
+        String result = HistoryCommands.getMaxHistorySize(tamayaConfigPlugin);
+        assertEquals(result, String.valueOf(tamayaConfigPlugin.getMaxHistorySize()));
+        result = HistoryCommands.setMaxHistorySize(tamayaConfigPlugin, 111);
+        assertEquals(result, "tamaya-max-getHistory-size=111");
+        result = HistoryCommands.getMaxHistorySize(tamayaConfigPlugin);
+        assertEquals(result, "111");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/resources/META-INF/javaconfiguration.properties b/modules/osgi/common/src/test/resources/META-INF/javaconfiguration.properties
new file mode 100644
index 0000000..d0b0cb8
--- /dev/null
+++ b/modules/osgi/common/src/test/resources/META-INF/javaconfiguration.properties
@@ -0,0 +1,22 @@
+# 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.
+#
+[tamaya]my.testProperty1=success1
+[tamaya]my.testProperty2=success2
+[tamaya]my.testProperty3=success3
+[tamaya]my.testProperty4=success4
+[tamaya]java.version=Java2000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/resources/org.ops4j.pax.logging.cfg
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/resources/org.ops4j.pax.logging.cfg b/modules/osgi/common/src/test/resources/org.ops4j.pax.logging.cfg
new file mode 100644
index 0000000..6683438
--- /dev/null
+++ b/modules/osgi/common/src/test/resources/org.ops4j.pax.logging.cfg
@@ -0,0 +1,48 @@
+# 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.
+#
+#updated by pax-exam
+#Sun Nov 27 20:55:11 CET 2016
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.sift.appender.append=true
+log4j.appender.out.maxFileSize=1MB
+log4j.appender.audit.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
+log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.append=true
+log4j.appender.sift.appender=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out=org.apache.log4j.RollingFileAppender
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
+log4j.appender.out.file=${karaf.data}/log/karaf.log
+log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
+log4j.appender.audit.append=true
+log4j.appender.audit.maxBackupIndex=10
+log4j.appender.audit.layout=org.apache.log4j.PatternLayout
+log4j.appender.sift.key=bundle.name
+log4j.appender.audit.maxFileSize=1MB
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.additivity.org.apache.karaf.jaas.modules.audit=false
+log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit
+log4j.appender.audit.file=${karaf.data}/security/audit.log
+log4j.appender.sift.default=karaf
+log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n
+log4j.appender.out.maxBackupIndex=10
+log4j.appender.audit=org.apache.log4j.RollingFileAppender
+log4j.rootLogger=WARN, out, stdout, osgi\:*
+log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
index d33e7e0..a4bab0f 100644
--- a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
@@ -28,9 +28,14 @@ import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.Map;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 
 import static org.mockito.Matchers.any;
@@ -61,6 +66,20 @@ public abstract class AbstractOSGITest {
         return this.properties.get(pid);
     }
 
+    String runTest(Callable<?> r) throws Exception {
+        PrintStream backup = System.out;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        PrintStream pw = new PrintStream(bos);
+        System.setOut(pw);
+        try{
+            r.call();
+            return new String(bos.toByteArray());
+        }finally{
+            System.setOut(backup);
+            pw.flush();
+        }
+    }
+
     @Before
     public void setup()throws Exception{
         doAnswer(invocation -> {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
index 8478cb1..0d5afd9 100644
--- a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
@@ -24,8 +24,15 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
 
+import java.util.Hashtable;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
 
 /**
@@ -44,21 +51,57 @@ public class BackupCommandsTest extends AbstractOSGITest{
 
     @Test
     public void testBackup_Create() throws Exception {
-        commands.tm_backup_create("testBackup_Create1",false);
-        verify(tamayaConfigPlugin).createBackup("testBackup_Create1");
-        commands.tm_backup_create("testBackup_Create2",true);
-        verify(tamayaConfigPlugin).createBackup("testBackup_Create2");
+        String pid = UUID.randomUUID().toString();
+        doReturn(true).when(tamayaConfigPlugin).createBackup(pid);
+        String out = runTest(()-> {
+            commands.tm_backup_create(pid,false);
+            return null;
+        });
+        assertTrue(out.startsWith("Backup created, PID = " + pid));
+        assertTrue(out.contains("Key"));
+        assertTrue(out.contains("Value"));
+        assertTrue(out.contains("-------------------------------------------------------------"));
+        assertTrue(out.contains("java.home"));
+        assertTrue(out.contains(System.getProperty("java.home")));
+        verify(tamayaConfigPlugin).createBackup(pid);
+        String pid2 = UUID.randomUUID().toString();
+        doReturn(true).when(tamayaConfigPlugin).createBackup(pid2);
+        doReturn(true).when(tamayaConfigPlugin).containsBackup(pid2);
+        out = runTest(()-> {
+            commands.tm_backup_create(pid2,true);
+            return null;
+        });
+        assertTrue(out.startsWith("Backup created, PID = " + pid2));
+        assertTrue(out.contains("java.home"));
+        assertTrue(out.contains(System.getProperty("java.home")));
+        verify(tamayaConfigPlugin).createBackup(pid2);
     }
 
     @Test
     public void testBackup_Delete() throws Exception {
-        commands.tm_backup_delete("testBackup_Delete");
+        String out = runTest(()-> {
+            commands.tm_backup_delete("testBackup_Delete");
+            return null;
+        });
+        assertEquals("Backup deleted: testBackup_Delete".trim(), out.trim());
         verify(tamayaConfigPlugin).deleteBackup("testBackup_Delete");
     }
 
     @Test
     public void testBackup_Get() throws Exception {
-        commands.tm_backup_get("testBackup_Get");
+        String out = runTest(()-> {
+            commands.tm_backup_get("testBackup_Get");
+            return null;
+        });
+        assertEquals("No backup found: testBackup_Get".trim(), out.trim());
+        verify(tamayaConfigPlugin).getBackup("testBackup_Get");
+        reset(tamayaConfigPlugin);
+        doReturn(new Hashtable<>()).when(tamayaConfigPlugin).getBackup("testBackup_Get");
+        out = runTest(()-> {
+            commands.tm_backup_get("testBackup_Get");
+            return null;
+        });
+        assertTrue(out.startsWith("PID: testBackup_Get\n"));
         verify(tamayaConfigPlugin).getBackup("testBackup_Get");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
index 5926029..dde7b42 100644
--- a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
@@ -28,9 +28,12 @@ import org.mockito.runners.MockitoJUnitRunner;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
 
 /**
@@ -49,22 +52,62 @@ public class ConfigCommandsTest extends AbstractOSGITest{
 
     @Test
     public void testPropertySources() throws Exception {
-        commands.tm_propertysources();
+        String out = runTest(() -> {
+            commands.tm_propertysources();
+            return null;
+        });
+        assertTrue(out.startsWith("Property Sources"));
+        assertTrue(out.contains(  "----------------"));
+        assertTrue(out.contains("ID"));
+        assertTrue(out.contains("Ordinal"));
+        assertTrue(out.contains("Class"));
+        assertTrue(out.contains("Size"));
+        assertTrue(out.contains("environment-properties"));
+        assertTrue(out.contains("system-properties"));
+
     }
 
     @Test
     public void testProperty_Default() throws Exception {
-        commands.tm_property("system-properties", "java.version", false);
+        String out = runTest(() -> {
+            commands.tm_property("system-properties", "java.version", false);
+            return null;
+        });
+        assertEquals(System.getProperty("java.version").trim(), out.trim());
     }
 
     @Test
     public void testProperty_Extended() throws Exception {
-        commands.tm_property("system-properties", "java.version", true);
+        String out = runTest(() -> {
+            commands.tm_property("system-properties", "java.version", true);
+            return null;
+        });
+        assertTrue(out.contains(System.getProperty("java.version")));
+        assertTrue(out.contains("Property Source"));
+        assertTrue(out.contains("Value"));
+        assertTrue(out.contains("system-properties"));
     }
 
     @Test
     public void testPropertsource() throws Exception {
-        commands.tm_propertysource("system-properties");
+        String out = runTest(() -> {
+            commands.tm_propertysource("system-properties");
+            return null;
+        });
+        assertTrue(out.startsWith("Property Source"));
+        assertTrue(out.contains("ID"));
+        assertTrue(out.contains("system-properties"));
+        assertTrue(out.contains("Ordinal"));
+        assertTrue(out.contains("1000"));
+        assertTrue(out.contains("Class"));
+        assertTrue(out.contains("SystemPropertySource"));
+        assertTrue(out.contains("Properties"));
+        assertTrue(out.contains("Key"));
+        assertTrue(out.contains("Value"));
+        assertTrue(out.contains("Source"));
+        assertTrue(out.contains("Meta"));
+        assertTrue(out.contains("java.version"));
+        assertTrue(out.contains(System.getProperty("java.version")));
     }
 
     @Test
@@ -72,8 +115,34 @@ public class ConfigCommandsTest extends AbstractOSGITest{
         Dictionary<String,Object> testConfig = new Hashtable<>();
         testConfig.put("test","testVal");
         doReturn(testConfig).when(tamayaConfigPlugin).getOSGIConfiguration(any(),any());
-        commands.tm_config(null,"testConfig");
-        commands.tm_config("java","testConfig");
+        String out = runTest(() -> {
+            commands.tm_config(null, "testConfig");
+            return null;
+        });
+        assertTrue(out.contains("Tamaya Configuration"));
+        assertTrue(out.contains("Section"));
+        assertTrue(out.contains("[testConfig]"));
+        assertTrue(out.contains("Configuration"));
+        out = runTest(() -> {
+            commands.tm_config("java", "testConfig");
+            return null;
+        });
+        assertTrue(out.contains("Tamaya Configuration"));
+        assertTrue(out.contains("Section"));
+        assertTrue(out.contains("[testConfig]"));
+        assertTrue(out.contains("Filter"));
+        assertTrue(out.contains("java"));
+        assertTrue(out.contains("Configuration"));
+        out = runTest(() -> {
+            commands.tm_config("java", "");
+            return null;
+        });
+        assertTrue(out.contains("Tamaya Configuration"));
+        assertTrue(out.contains("Section"));
+        assertTrue(out.contains("java"));
+        assertTrue(out.contains("Configuration"));
+        assertTrue(out.contains(".version"));
+        assertTrue(out.contains(System.getProperty("java.version")));
     }
 
     @Test
@@ -81,9 +150,35 @@ public class ConfigCommandsTest extends AbstractOSGITest{
         Dictionary<String,Object> testConfig = new Hashtable<>();
         testConfig.put("test","testVal");
         doReturn(testConfig).when(tamayaConfigPlugin).updateConfig(any(),any(), anyBoolean(), anyBoolean());
-        commands.tm_apply_config("testApplyConfig", Policy.EXTEND, true);
+        String out = runTest(() -> {
+            commands.tm_apply_config("testApplyConfig", Policy.EXTEND, true);
+            return null;
+        });
+        assertTrue(out.contains("Applied Configuration"));
+        assertTrue(out.contains("PID"));
+        assertTrue(out.contains("testApplyConfig"));
+        assertTrue(out.contains("Policy"));
+        assertTrue(out.contains("EXTEND"));
+        assertTrue(out.contains("Dryrun"));
+        assertTrue(out.contains("true"));
+        assertTrue(out.contains("OSGI Configuration for PID"));
+        assertTrue(out.contains("test"));
+        assertTrue(out.contains("testVal"));
         verify(tamayaConfigPlugin).updateConfig("testApplyConfig", Policy.EXTEND, true, true);
-        commands.tm_apply_config("testApplyConfig", Policy.OVERRIDE, false);
+        out = runTest(() -> {
+            commands.tm_apply_config("testApplyConfig", Policy.OVERRIDE, false);
+            return null;
+        });
+        assertTrue(out.contains("Applied Configuration"));
+        assertTrue(out.contains("PID"));
+        assertTrue(out.contains("testApplyConfig"));
+        assertTrue(out.contains("Policy"));
+        assertTrue(out.contains("OVERRIDE"));
+        assertTrue(out.contains("Dryrun"));
+        assertTrue(out.contains("false"));
+        assertTrue(out.contains("OSGI Configuration for PID"));
+        assertTrue(out.contains("test"));
+        assertTrue(out.contains("testVal"));
         verify(tamayaConfigPlugin).updateConfig("testApplyConfig", Policy.OVERRIDE, true, false);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
index 1d129a0..8dac595 100644
--- a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
@@ -18,12 +18,14 @@
  */
 package org.apache.tamaya.gogo.shell;
 
+import org.apache.tamaya.osgi.ConfigHistory;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
 
+import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
 
 /**
@@ -53,9 +55,12 @@ public class HistoryCommandsTest extends AbstractOSGITest{
     }
 
     @Test
-    public void testHisatory_Get() throws Exception {
-        commands.tm_history_get("testHisatory_Get", "");
-        verify(tamayaConfigPlugin).getHistory("testHisatory_Get");
+    public void testHistory_Get() throws Exception {
+        commands.tm_history_get("testHistory_Get", "");
+        verify(tamayaConfigPlugin).getHistory("testHistory_Get");
+        reset(tamayaConfigPlugin);
+        commands.tm_history_get("testHistory_Get", "BEGIN,END");
+        verify(tamayaConfigPlugin).getHistory("testHistory_Get");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
index fa4e3aa..bc165e9 100644
--- a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.gogo.shell;
 
+import org.apache.tamaya.osgi.Policy;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -75,4 +76,17 @@ public class SettingsCommandsTest extends AbstractOSGITest{
         verify(tamayaConfigPlugin).setAutoUpdateEnabled(false);
     }
 
+    @Test
+    public void testPolicy() throws Exception {
+        commands.tm_policy();
+        verify(tamayaConfigPlugin).getDefaultPolicy();
+    }
+
+    @Test
+    public void testPolicySet() throws Exception {
+        commands.tm_policy_set(Policy.EXTEND);
+        verify(tamayaConfigPlugin).setDefaultPolicy(Policy.EXTEND);
+        commands.tm_policy_set(Policy.OVERRIDE);
+        verify(tamayaConfigPlugin).setDefaultPolicy(Policy.OVERRIDE);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/bnd.bnd b/modules/osgi/injection/bnd.bnd
new file mode 100644
index 0000000..69e9637
--- /dev/null
+++ b/modules/osgi/injection/bnd.bnd
@@ -0,0 +1,34 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Activator: org.apache.tamaya.osgi.injection.Activator
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - OSGI Configuration Injection
+Bundle-SymbolicName: org.apache.tamaya.osgi.injection
+Bundle-Description: Apacha Tamaya Configuration - OSGI Service Configuration Injection
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Import-Package: \
+    org.osgi.service.cm,\
+    org.osgi.framework,\
+    org.osgi.util.tracker,\
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.apache.tamaya.functions,\
+    org.apache.tamaya.spisupport,\
+    org.apache.tamaya.osgi,\
+    org.apache.tamaya.inject.api,\
+    org.apache.tamaya.inject.spi,\
+    org.apache.tamaya.inject

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/pom.xml b/modules/osgi/injection/pom.xml
new file mode 100644
index 0000000..692e98f
--- /dev/null
+++ b/modules/osgi/injection/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-osgi-injection</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tamaya :: OSGI :: Config Injection</name>
+    <description>Tamaya OSGI Configuration Injector</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-injection</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-osgi</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+
+        <!-- Testing -->
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
new file mode 100644
index 0000000..b344415
--- /dev/null
+++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/Activator.java
@@ -0,0 +1,95 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.osgi.framework.*;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Objects;
+import java.util.function.Supplier;
+import java.util.logging.Logger;
+
+/**
+ * Activator that registers the Tamaya commands for the Felix Gogo console used
+ * in Apache Felix and Equinox.
+ */
+public class Activator implements BundleActivator {
+
+    private static final Logger LOG = Logger.getLogger(Activator.class.getName());
+
+    private TamayaOSGIInjector injector;
+    private ServiceRegistration<ConfigInjectionService> serviceReg;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        LOG.finest("Registering Tamaya OSGI Config injector...");
+        injector = new TamayaOSGIInjector(context);
+        Dictionary<String, Object> props = new Hashtable<>();
+        serviceReg = context.registerService(
+                ConfigInjectionService.class,
+                new TamayaConfigInjectionService(injector), props);
+        injector.start();
+        LOG.finest("Registered Tamaya OSGI Config injector.");
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        LOG.finest("Unregistering Tamaya Config injector...");
+        if (serviceReg != null) {
+            injector.stop();
+            serviceReg.unregister();
+        }
+    }
+
+    private final class TamayaConfigInjectionService implements ConfigInjectionService{
+
+        private TamayaOSGIInjector injector;
+
+        TamayaConfigInjectionService(TamayaOSGIInjector injector){
+            this.injector = Objects.requireNonNull(injector);
+        }
+
+        @Override
+        public boolean isInjectionEnabled(ServiceReference reference) {
+            return injector.isInjectionEnabled(reference);
+        }
+
+        @Override
+        public boolean isInjectionEnabled(Bundle bundle) {
+            return injector.isInjectionEnabled(bundle);
+        }
+
+        @Override
+        public <T> T configure(String pid, String location, T instance) {
+            return injector.configure(pid, location, instance);
+        }
+
+        @Override
+        public <T> Supplier<T> getConfiguredSupplier(String pid, String location, Supplier<T> supplier) {
+            return injector.getConfiguredSupplier(pid, location, supplier);
+        }
+
+        @Override
+        public <T> T createTemplate(String pid, String location, Class<T> templateType) {
+            return injector.createTemplate(pid, location, templateType);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/ConfigInjectionService.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/ConfigInjectionService.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/ConfigInjectionService.java
new file mode 100644
index 0000000..dce25e6
--- /dev/null
+++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/ConfigInjectionService.java
@@ -0,0 +1,115 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+import java.util.function.Supplier;
+
+/**
+ * OSGI service interface registered by the Tamaya configuration injector plugin.
+ */
+public interface ConfigInjectionService {
+    /** The manifest entry to enable Tamaya injection. */
+    String TAMAYA_INJECTION_ENABLED_MANIFEST = "Tamaya-Config-Inject";
+    /** The OSGI config entry to enable Tamaya injection. */
+    String TAMAYA_INJECTION_ENABLED_PROP = "tamaya-config-inject";
+
+    /**
+     * Checks if injection is enabled on the given service.
+     * @param reference the service reference, not null.
+     * @return true, if enjection is enabled.
+     */
+    boolean isInjectionEnabled(ServiceReference reference);
+
+    /**
+     * Checks if injection is enabled on the given service.
+     * @param bundle the bundle, not null.
+     * @return true, if enjection is enabled.
+     */
+    boolean isInjectionEnabled(Bundle bundle);
+
+    /**
+     * Configures the passed instance.
+     * @param instance the instance, not null.
+     * @param <T> the input and return type.
+     * @param pid the target PID, not null.
+     * @param location the optional location
+     * @return the configured instance.
+     */
+    <T> T configure(String pid, String location, T instance);
+
+    /**
+     * Creates a suzpplier, which supplies events as created by the basic supplier, which are
+     * automatically configured, when supplying.
+     * @param supplier the base supplier, not null.
+     * @param pid the target PID, not null.
+     * @param location the optional location
+     * @param <T> the type
+     * @return a configuring supplier.
+     */
+    <T> Supplier<T> getConfiguredSupplier(String pid, String location, java.util.function.Supplier<T> supplier);
+
+    /**
+     * Creates a template implementing the annotated methods based on current configuration data.
+     *
+     * @param <T> the type of the template.
+     * @param templateType the type of the template to be created.
+     * @param pid the target PID, not null.
+     * @param location the optional location
+     * @return the configured template.
+     */
+    <T> T createTemplate(String pid, String location, Class<T> templateType);
+
+    /**
+     * Configures the passed instance.
+     * @param instance the instance, not null.
+     * @param <T> the input and return type.
+     * @param bundle the target bundle, not null.
+     * @return the configured instance.
+     */
+    default <T> T configure(Bundle bundle, T instance){
+        return configure(bundle.getSymbolicName(), bundle.getLocation(), instance);
+    }
+
+    /**
+     * Creates a suzpplier, which supplies events as created by the basic supplier, which are
+     * automatically configured, when supplying.
+     * @param supplier the base supplier, not null.
+     * @param bundle the target bundle, not null.
+     * @param <T> the type
+     * @return a configuring supplier.
+     */
+    default <T> Supplier<T> getConfiguredSupplier(Bundle bundle, java.util.function.Supplier<T> supplier){
+        return getConfiguredSupplier(bundle.getSymbolicName(), bundle.getLocation(), supplier);
+    }
+
+    /**
+     * Creates a template implementing the annotated methods based on current configuration data.
+     *
+     * @param <T> the type of the template.
+     * @param templateType the type of the template to be created.
+     * @param bundle the target bundle, not null.
+     * @return the configured template.
+     */
+    default <T> T createTemplate(Bundle bundle, Class<T> templateType){
+        return createTemplate(bundle.getSymbolicName(), bundle.getLocation(), templateType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySource.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySource.java
new file mode 100644
index 0000000..529468e
--- /dev/null
+++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySource.java
@@ -0,0 +1,108 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.spi.PropertyValue;
+import org.apache.tamaya.spisupport.BasePropertySource;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This is a Tamaya PropertySource, which internally wraps the OSGI ConfigAdmin service, preconfigured
+ * for a PID and (optionally) location.
+ */
+public class OSGIConfigAdminPropertySource extends BasePropertySource{
+
+    private static final Logger LOG = Logger.getLogger(OSGIConfigAdminPropertySource.class.getName());
+    private ConfigurationAdmin configurationAdmin;
+    private String pid;
+    private String location;
+
+    public OSGIConfigAdminPropertySource(ConfigurationAdmin configurationAdmin, String pid){
+        this.configurationAdmin = Objects.requireNonNull(configurationAdmin);
+        this.pid = Objects.requireNonNull(pid);
+    }
+
+    public OSGIConfigAdminPropertySource(ConfigurationAdmin configurationAdmin, String pid, String location){
+        this.configurationAdmin = Objects.requireNonNull(configurationAdmin);
+        this.pid = Objects.requireNonNull(pid);
+        this.location = location;
+    }
+
+    /**
+     * Get the configured OSGI service PID.
+     * @return the pid, nnever null.
+     */
+    public String getPid() {
+        return pid;
+    }
+
+    /**
+     * Get the configured OSGI config location, may be null.
+     * @return the location, or null.
+     */
+    public String getLocation() {
+        return location;
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        try {
+            Configuration osgiConfig = configurationAdmin.getConfiguration(pid, location);
+            Dictionary<String,Object> props = osgiConfig.getProperties();
+            if(props!=null){
+                Object value = props.get(key);
+                if(value!=null) {
+                    return PropertyValue.of(key, String.valueOf(value), "OSGI ConfigAdmin: " + pid);
+                }
+            }
+        } catch (IOException e) {
+            LOG.log(Level.FINEST,  e, () -> "No config for PID: " + pid);
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, PropertyValue> getProperties() {
+        try {
+            Configuration osgiConfig = configurationAdmin.getConfiguration(pid);
+            Dictionary<String,Object> props = osgiConfig.getProperties();
+            if(props!=null){
+                Map<String, PropertyValue> result = new HashMap<>();
+                Enumeration<String> keys = props.keys();
+                while(keys.hasMoreElements()){
+                    String key = keys.nextElement();
+                    Object value = props.get(key);
+                    result.put(key, PropertyValue.of(key, String.valueOf(value), "OSGI ConfigAdmin: " + pid));
+                }
+                return result;
+            }
+        } catch (IOException e) {
+            LOG.log(Level.FINEST,  e, () -> "No config for PID: " + pid);
+        }
+        return Collections.emptyMap();
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjector.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjector.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjector.java
new file mode 100644
index 0000000..4ac520d
--- /dev/null
+++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjector.java
@@ -0,0 +1,118 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.inject.ConfigurationInjection;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Objects;
+import java.util.function.Supplier;
+
+/**
+ * This class wraps an OSGI Configuration based on PID and location and provides injection services for
+ * configuration.
+ */
+final class OSGIConfigurationInjector{
+    /** The OSGI ConfigManager. */
+    private ConfigurationAdmin cm;
+    /** The corresponding Tamaya configuration. */
+    private Configuration tamayaOSGIConfiguration;
+    /** The target PID. */
+    private String pid;
+    /** The target location. */
+    private String location;
+
+    /**
+     * Creates a new instance.
+     * @param cm the OSGI ConfigManager, not null.
+     * @param pid the target PID.
+     */
+    public OSGIConfigurationInjector(ConfigurationAdmin cm, String pid){
+        this(cm, pid, null);
+    }
+
+    /**
+     * Creates a new instance.
+     * @param cm the OSGI ConfigManager, not null.
+     * @param pid the target PID.
+     * @param location the optional location.
+     */
+    public OSGIConfigurationInjector(ConfigurationAdmin cm, String pid, String location){
+        this.cm = Objects.requireNonNull(cm);
+        tamayaOSGIConfiguration = ConfigurationProvider.createConfiguration(
+                ConfigurationProvider.getConfigurationContextBuilder()
+                .addDefaultPropertyConverters()
+                .addDefaultPropertyFilters()
+                .addPropertySources(new OSGIConfigAdminPropertySource(cm, pid, location))
+                .build());
+    }
+
+    /**
+     * Get the target PID.
+     * @return the target PID, not null.
+     */
+    public String getPid() {
+        return pid;
+    }
+
+    /**
+     * Get the location.
+     * @return the location.
+     */
+    public String getLocation() {
+        return location;
+    }
+
+    /**
+     * Configures the passed instance.
+     * @param instance the instance, not null.
+     * @param <T> the input and return type.
+     * @return the configured instance.
+     */
+    public <T> T configure(T instance){
+        return ConfigurationInjection.getConfigurationInjector()
+                .configure(instance, tamayaOSGIConfiguration);
+    }
+
+    /**
+     * Creates a suzpplier, which supplies events as created by the basic supplier, which are
+     * automatically configured, when supplying.
+     * @param supplier the base supplier, not null.
+     * @param <T> the type
+     * @return a configuring supplier.
+     */
+    public <T> Supplier<T> getConfiguredSupplier(java.util.function.Supplier<T> supplier){
+        return ConfigurationInjection.getConfigurationInjector()
+                .getConfiguredSupplier(supplier, tamayaOSGIConfiguration);
+    }
+
+    /**
+     * Creates a template implementing the annotated methods based on current configuration data.
+     *
+     * @param <T> the type of the template.
+     * @param templateType the type of the template to be created.
+     * @return the configured template.
+     */
+    public <T> T createTemplate(Class<T> templateType){
+        return ConfigurationInjection.getConfigurationInjector()
+                .createTemplate(templateType, tamayaOSGIConfiguration);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java
new file mode 100644
index 0000000..2b245d3
--- /dev/null
+++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java
@@ -0,0 +1,162 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
+import java.util.logging.Logger;
+
+/**
+ * Class that monitors services and configures them if they have {@code Tamaya-Config = true} in the
+ * service settings.
+ */
+public class TamayaOSGIInjector{
+    /** The logger. */
+    private static final Logger log = Logger.getLogger(TamayaConfigPlugin.class.getName());
+    /** The bundle context. */
+    private BundleContext context;
+    /** OSGI Config manager. */
+    private ConfigurationAdmin cm;
+    /** The service tracker. */
+    private ServiceTracker<Object, Object> tracker;
+    /** The cached injectors. */
+    private static final Map<String, OSGIConfigurationInjector> INJECTORS = new ConcurrentHashMap<>();
+
+    /**
+     * Creates a new injector.
+     * @param context thge bundle contex, not null.
+     */
+    public TamayaOSGIInjector(BundleContext context) {
+        this.context = Objects.requireNonNull(context);
+    }
+
+    /**
+     * Starts the injector by registering the servidce tracker for all type of services. Injection is performed on
+     * service creation and modification.
+     */
+    public void start(){
+        tracker = new ServiceTracker<Object, Object>(context, Object.class.getName(), null) {
+            @Override
+            public Object addingService(ServiceReference reference) {
+                log.info("Checking service for configuration: " + reference);
+                Object service =  super.addingService(reference);
+                if(isInjectionEnabled(reference)) {
+                    String pid = (String)reference.getProperty(Constants.SERVICE_PID);
+                    if(pid==null){
+                        pid = reference.getBundle().getSymbolicName();
+                    }
+                    OSGIConfigurationInjector injector = getInjector(pid, reference.getBundle().getLocation());
+                    injector.configure(service);
+                }
+                return service;
+            }
+
+            @Override
+            public void modifiedService(ServiceReference<Object> reference, Object service) {
+                super.modifiedService(reference, service);
+                if(isInjectionEnabled(reference)) {
+                    String pid = (String)reference.getProperty(Constants.SERVICE_PID);
+                    if(pid==null){
+                        pid = reference.getBundle().getSymbolicName();
+                    }
+                    OSGIConfigurationInjector injector = getInjector(pid, reference.getBundle().getLocation());
+                    injector.configure(service);
+                }
+            }
+        };
+        tracker.open(true);
+    }
+
+    /**
+     * Stops the service tracker listening.
+     */
+    public void stop(){
+        if(tracker!=null){
+            tracker.close();
+            tracker = null;
+        }
+    }
+
+    /**
+     * Get or create an injector for injecting OSGI configuration using Tamaya's injection API.
+     * @param pid the PID, not nbull.
+     * @param location the optional location.
+     * @return a injector, never null.
+     */
+    private OSGIConfigurationInjector getInjector(String pid, String location){
+        String key = location==null?pid.trim():pid.trim()+"::"+location.trim();
+        OSGIConfigurationInjector injector = INJECTORS.get(key);
+        if(injector==null){
+            injector = new OSGIConfigurationInjector(cm, pid, location);
+            INJECTORS.put(key, injector);
+        }
+        return injector;
+    }
+
+    /**
+     * Checks if injection is enabled on the given service.
+     * @param reference the service reference, not null.
+     * @return true, if injection is enabled.
+     */
+    static boolean isInjectionEnabled(ServiceReference reference){
+        String enabledVal = (String)reference.getProperty(ConfigInjectionService.TAMAYA_INJECTION_ENABLED_PROP);
+        if(enabledVal!=null){
+            return Boolean.parseBoolean(enabledVal);
+        }
+        if(enabledVal!=null){
+            return Boolean.parseBoolean(enabledVal);
+        }
+        return isInjectionEnabled(reference.getBundle());
+    }
+
+    /**
+     * Checks if injection is enabled on the given bundle.
+     * @param bundle the bundle, not null.
+     * @return true, if injection is enabled.
+     */
+    static boolean isInjectionEnabled(Bundle bundle){
+        String enabledVal = (String)bundle.getHeaders().get(ConfigInjectionService.TAMAYA_INJECTION_ENABLED_MANIFEST);
+        if(enabledVal!=null){
+            return Boolean.parseBoolean(enabledVal);
+        }
+        return false;
+    }
+
+    <T> T configure(String pid, String location, T instance) {
+        return getInjector(pid, location).configure(instance);
+    }
+
+    <T> Supplier<T> getConfiguredSupplier(String pid, String location, Supplier<T> supplier) {
+        return getInjector(pid, location).getConfiguredSupplier(supplier);
+    }
+
+    <T> T createTemplate(String pid, String location, Class<T> templateType) {
+        return getInjector(pid, location).createTemplate(templateType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/AbstractOSGITest.java b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/AbstractOSGITest.java
new file mode 100644
index 0000000..e3f73c3
--- /dev/null
+++ b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/AbstractOSGITest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+import org.junit.Before;
+import org.mockito.Mock;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+/**
+ * Created by atsticks on 27.09.17.
+ */
+public abstract class AbstractOSGITest {
+
+    private Map<String,Hashtable<String, Object>> properties = new ConcurrentHashMap<>();
+
+    @Mock
+    protected BundleContext bundleContext;
+
+    @Mock
+    protected ConfigurationAdmin cm;
+
+    @Mock
+    private ServiceReference<ConfigurationAdmin> cmRef;
+    @Mock
+    private ServiceReference<TamayaConfigPlugin> tamayaRef;
+
+    protected TamayaConfigPlugin tamayaConfigPlugin;
+
+    protected Dictionary<String,Object> getProperties(String pid){
+        return this.properties.get(pid);
+    }
+
+    @Before
+    public void setup()throws Exception{
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any());
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any(), any());
+        doReturn(new Bundle[0]).when(bundleContext).getBundles();
+        doReturn(cmRef).when(bundleContext).getServiceReference(ConfigurationAdmin.class);
+        doReturn(cm).when(bundleContext).getService(cmRef);
+        doReturn(tamayaRef).when(bundleContext).getServiceReference(TamayaConfigPlugin.class);
+        tamayaConfigPlugin = new TamayaConfigPlugin(bundleContext);
+        doReturn(tamayaConfigPlugin).when(bundleContext).getService(tamayaRef);
+    }
+
+    protected Configuration initConfigurationMock(final String pid)throws Exception{
+        Configuration config = mock(Configuration.class);
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            props.clear();
+            props.putAll((Map<? extends String, ?>) invocation.getArguments()[0]);
+            return null;
+        }).when(config).update(any(Dictionary.class));
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            if(props==null){
+                props = new Hashtable<>();
+                properties.put(pid, props);
+                for(Map.Entry en:System.getProperties().entrySet()){
+                    props.put(en.getKey().toString(), en.getValue());
+                }
+            }
+            return new Hashtable<>(props);
+        }).when(config).getProperties();
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/ActivatorTest.java b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/ActivatorTest.java
new file mode 100644
index 0000000..9cd587f
--- /dev/null
+++ b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/ActivatorTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 03.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ActivatorTest extends AbstractOSGITest{
+
+    @Test
+    public void startStop() throws Exception {
+        Activator activator = new Activator();
+        activator.start(this.bundleContext);
+        verify(bundleContext).registerService(eq(TamayaOSGIInjector.class), anyObject(), anyObject());
+        activator.stop(this.bundleContext);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySourceTest.java b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySourceTest.java
new file mode 100644
index 0000000..f83ac56
--- /dev/null
+++ b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigAdminPropertySourceTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.spi.PropertyValue;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 03.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OSGIConfigAdminPropertySourceTest extends AbstractOSGITest{
+
+    OSGIConfigAdminPropertySource propertySource;
+
+    @Before
+    public void init(){
+        propertySource = new OSGIConfigAdminPropertySource(cm, "tamaya");
+    }
+
+    @Test
+    public void get() throws Exception {
+        PropertyValue val = propertySource.get("java.home");
+        assertNotNull(val);
+        assertEquals(val.getKey(), "java.home");
+        assertEquals(val.getValue(), System.getProperty("java.home"));
+        val = propertySource.get("foo.bar");
+        assertNull(val);
+    }
+
+    @Test
+    public void getProperties() throws Exception {
+        Map<String,PropertyValue> props = propertySource.getProperties();
+        assertNotNull(props);
+        PropertyValue val = props.get("java.home");
+        assertEquals(val.getKey(), "java.home");
+        assertEquals(val.getValue(), System.getProperty("java.home"));
+        val = props.get("foo.bar");
+        assertNull(val);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjectorTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjectorTest.java b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjectorTest.java
new file mode 100644
index 0000000..6735e7a
--- /dev/null
+++ b/modules/osgi/injection/src/test/java/org/apache/tamaya/osgi/injection/OSGIConfigurationInjectorTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.tamaya.osgi.injection;
+
+import org.apache.tamaya.inject.api.Config;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.function.Supplier;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 03.10.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OSGIConfigurationInjectorTest extends AbstractOSGITest{
+
+
+    @Test
+    public void configure() throws Exception {
+        OSGIConfigurationInjector injector = new OSGIConfigurationInjector(cm, "OSGIConfigurationInjectorTest");
+        Example example = new Example();
+        Example result = injector.configure(example);
+        assertNotNull(result);
+        assertTrue(result==example);
+        checkExampleConfig(example);
+    }
+
+    @Test
+    public void getConfiguredSupplier() throws Exception {
+        OSGIConfigurationInjector injector = new OSGIConfigurationInjector(cm, "OSGIConfigurationInjectorTest");
+        Supplier<Example> supplier = injector.getConfiguredSupplier(Example::new);
+        assertNotNull(supplier);
+        Example example = supplier.get();
+        checkExampleConfig(example);
+    }
+
+    @Test
+    public void createTemplate() throws Exception {
+        OSGIConfigurationInjector injector = new OSGIConfigurationInjector(cm, "OSGIConfigurationInjectorTest");
+        TemplateExample template = injector.createTemplate(TemplateExample.class);
+        checkExampleConfig(template);
+    }
+
+    private void checkExampleConfig(Example example) {
+        assertNotNull(example);
+        assertEquals(example.javaHome, System.getProperty("java.home"));
+        assertEquals(example.javaVersion, System.getProperty("java.version"));
+        assertEquals(example.javaUsed, true);
+    }
+
+    private void checkExampleConfig(TemplateExample template) {
+        assertNotNull(template);
+        assertEquals(template.getJavaHome(), System.getProperty("java.home"));
+        assertEquals(template.javaVersion(), System.getProperty("java.version"));
+        assertEquals(template.isJavaUsed(), true);
+    }
+
+    private static final class Example {
+        @Config("java.home")
+        String javaHome;
+        @Config("java.version")
+        String javaVersion;
+        @Config(value = "java.used", defaultValue = "true")
+        boolean javaUsed;
+    }
+
+    private interface TemplateExample {
+
+        @Config("java.home")
+        String getJavaHome();
+
+        @Config("java.version")
+        String javaVersion();
+
+        @Config(value = "java.used", defaultValue = "true")
+        boolean isJavaUsed();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-features/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-features/pom.xml b/modules/osgi/karaf-features/pom.xml
new file mode 100644
index 0000000..8d8c2d4
--- /dev/null
+++ b/modules/osgi/karaf-features/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-karaf-features</artifactId>
+    <packaging>feature</packaging>
+    <name>Apache Tamaya :: OSGI :: Karaf :: Features</name>
+    <description>Tamaya Karaf Feature Descriptor.</description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <configuration>
+                    <startLevel>80</startLevel>
+                    <aggregateFeatures>true</aggregateFeatures>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-features/src/main/features/features.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-features/src/main/features/features.xml b/modules/osgi/karaf-features/src/main/features/features.xml
new file mode 100644
index 0000000..20c5ee3
--- /dev/null
+++ b/modules/osgi/karaf-features/src/main/features/features.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org-apache-tamaya-all">
+    <features name="org-apache-tamaya-config" version="0.4-incubating">
+        <features name="org-apache-tamaya-configadmin" version="0.4-incubating">
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi_alpha/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-functions/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-spisupport/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-karaf_alpha/0.4-incubating/jar</bundle>
+            <features name="org-apache-tamaya-minimal" version="0.4-incubating">
+                <feature name="org-apache-tamaya-api" version="0.4-incubating">
+                    <bundle>mvn:org.apache.tamaya/tamaya-api/0.4-incubating/jar</bundle>
+                    <bundle>mvn:org.apache.geronimo.specs/geronimo-annotation_1.2_spec/1.0-alpha-1/jar</bundle>
+                </feature>
+                <feature name="org-apache-tamaya-core" version="0.4-incubating">
+                    <bundle>mvn:org.apache.tamaya/tamaya-core/0.4-incubating/jar</bundle>
+                </feature>
+            </features>
+        </features>
+        <features name="org-apache-tamaya-config-injection" version="0.4-incubating">
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-injection_alpha/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-injection-api/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-injection-se/0.4-incubating/jar</bundle>
+        </features>
+        <feature name="org-apache-tamaya-config-updater" version="0.4-incubating">
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-events/0.4-incubating/jar</bundle>
+            <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-updater_alpha/0.4-incubating/jar</bundle>
+        </feature>
+    </features>
+    <features name="org-apache-tamaya-formats" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-formats/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-formats-json" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-formats-json/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-formats-yaml" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-formats-yaml/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-filter" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-filter/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-resources" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-resources/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-resolver" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-resolver/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-mutable-config" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-mutable-config/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-spring" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-spring/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-optional" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-optional/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-jndi" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-jndi/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-features" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-features/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-events" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-events/0.4-incubating/jar</bundle>
+    </features>
+    <features name="org-apache-tamaya-uom" version="0.4-incubating">
+        <bundle>mvn:org.apache.tamaya.ext/tamaya-uom/0.4-incubating/jar</bundle>
+    </features>
+</features>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/bnd.bnd b/modules/osgi/karaf-shell/bnd.bnd
new file mode 100644
index 0000000..3bed7ca
--- /dev/null
+++ b/modules/osgi/karaf-shell/bnd.bnd
@@ -0,0 +1,38 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - Karaf Shell Commands
+Bundle-SymbolicName: org.apache.tamaya.osgi.karaf.shell
+Bundle-Description: Apacha Tamaya Configuration - Karaf Shell Extensions
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Export-Package: \
+	org.apache.tamaya.karaf.shell
+Import-Package: \
+    org.osgi.service.cm,\
+    org.osgi.framework,\
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.apache.tamaya.functions,\
+    org.apache.tamaya.spisupport,\
+    org.apache.tamaya.osgi,\
+    org.apache.tamaya.osgi.commands,\
+    org.apache.felix.service.command,\
+    org.apache.karaf.shell.api.console,\
+    org.apache.karaf.shell.api.action,\
+    org.apache.karaf.shell.api.action.lifecycle,\
+    org.apache.karaf.shell.support.completers
+Karaf-Commands: org.apache.tamaya.karaf.shell
\ No newline at end of file



[7/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.

Posted by an...@apache.org.
TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/a1cd433a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/a1cd433a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/a1cd433a

Branch: refs/heads/master
Commit: a1cd433a9828241664a85f77a950993b14403678
Parents: a91e434
Author: Anatole Tresch <an...@apache.org>
Authored: Tue Oct 17 01:02:53 2017 +0200
Committer: Anatole Tresch <an...@apache.org>
Committed: Tue Oct 17 01:02:54 2017 +0200

----------------------------------------------------------------------
 modules/microprofile/bnd.bnd                    |  34 ++
 modules/microprofile/pom.xml                    | 158 +++++++
 .../microprofile/MicroprofileAdapter.java       | 185 ++++++++
 .../tamaya/microprofile/MicroprofileConfig.java | 100 +++++
 .../microprofile/MicroprofileConfigBuilder.java | 140 ++++++
 .../MicroprofileConfigProviderResolver.java     |  82 ++++
 .../microprofile/MicroprofileConfigSource.java  |  78 ++++
 .../MicroprofileConfigSourceProvider.java       |  64 +++
 .../microprofile/MicroprofileConverter.java     |  50 +++
 .../MicroprofileDefaultProperties.java          |  33 ++
 .../microprofile/TamayaConfiguration.java       |  93 ++++
 .../microprofile/TamayaPropertyConverter.java   |  48 ++
 .../microprofile/TamayaPropertySource.java      |  78 ++++
 .../TamayaPropertySourceProvider.java           |  56 +++
 .../microprofile/cdi/BridgingConfigBean.java    |  95 ++++
 .../microprofile/cdi/ConfiguredField.java       |  65 +++
 .../microprofile/cdi/ConfiguredMethod.java      |  65 +++
 .../tamaya/microprofile/cdi/ConfiguredType.java |  86 ++++
 .../cdi/MicroprofileCDIExtension.java           | 127 ++++++
 .../cdi/MicroprofileConfigurationProducer.java  | 156 +++++++
 .../converter/BooleanAsIntegerConverterFix.java |  61 +++
 .../converter/ProviderConverter.java            |  98 ++++
 .../javax.enterprise.inject.spi.Extension       |  20 +
 .../org.apache.tamaya.spi.PropertyConverter     |  21 +
 .../org.apache.tamaya.spi.PropertySource        |  20 +
 ...croprofile.config.spi.ConfigProviderResolver |  20 +
 .../microprofile/src/main/resources/beans.xml   |  25 ++
 .../MicroprofileConfigBuilderTest.java          |  99 +++++
 .../MicroprofileConfigProviderResolverTest.java |  73 +++
 .../MicroprofileConfigProviderTest.java         |  62 +++
 .../microprofile/MicroprofileConfigTest.java    |  95 ++++
 .../tck/TamayaConfigArchiveProcessor.java       |  79 ++++
 .../microprofile/tck/TamayaConfigExtension.java |  36 ++
 .../src/test/resources/META-INF/beans.xml       |  24 +
 .../META-INF/microprofile-config.properties     | 105 +++++
 ....jboss.arquillian.core.spi.LoadableExtension |  19 +
 .../src/test/resources/sampleconfig.yaml        |  18 +
 modules/microprofile/src/test/tck-suite.xml     |  27 ++
 modules/osgi/common/bnd.bnd                     |  33 ++
 modules/osgi/common/pom.xml                     |  91 ++++
 .../java/org/apache/tamaya/osgi/Activator.java  |  74 ++++
 .../java/org/apache/tamaya/osgi/Backups.java    | 157 +++++++
 .../org/apache/tamaya/osgi/ConfigChanger.java   | 215 +++++++++
 .../org/apache/tamaya/osgi/ConfigHistory.java   | 268 +++++++++++
 .../java/org/apache/tamaya/osgi/Policy.java     |  31 ++
 .../apache/tamaya/osgi/TamayaConfigPlugin.java  | 444 +++++++++++++++++++
 .../tamaya/osgi/commands/BackupCommands.java    | 135 ++++++
 .../tamaya/osgi/commands/ConfigCommands.java    | 245 ++++++++++
 .../tamaya/osgi/commands/HistoryCommands.java   | 101 +++++
 .../apache/tamaya/osgi/commands/StringUtil.java |  46 ++
 .../osgi/commands/TamayaConfigService.java      | 206 +++++++++
 .../apache/tamaya/osgi/AbstractOSGITest.java    | 100 +++++
 .../org/apache/tamaya/osgi/ActivatorTest.java   |  44 ++
 .../org/apache/tamaya/osgi/BackupsTest.java     | 107 +++++
 .../apache/tamaya/osgi/ConfigHistoryTest.java   | 148 +++++++
 .../tamaya/osgi/TamayaConfigPluginTest.java     | 290 ++++++++++++
 .../osgi/commands/BackupCommandsTest.java       | 103 +++++
 .../osgi/commands/ConfigCommandsTest.java       | 204 +++++++++
 .../osgi/commands/HistoryCommandsTest.java      |  87 ++++
 .../META-INF/javaconfiguration.properties       |  22 +
 .../test/resources/org.ops4j.pax.logging.cfg    |  48 ++
 .../tamaya/gogo/shell/AbstractOSGITest.java     |  19 +
 .../tamaya/gogo/shell/BackupCommandsTest.java   |  55 ++-
 .../tamaya/gogo/shell/ConfigCommandsTest.java   | 111 ++++-
 .../tamaya/gogo/shell/HistoryCommandsTest.java  |  11 +-
 .../tamaya/gogo/shell/SettingsCommandsTest.java |  14 +
 modules/osgi/injection/bnd.bnd                  |  34 ++
 modules/osgi/injection/pom.xml                  |  72 +++
 .../apache/tamaya/osgi/injection/Activator.java |  95 ++++
 .../osgi/injection/ConfigInjectionService.java  | 115 +++++
 .../OSGIConfigAdminPropertySource.java          | 108 +++++
 .../injection/OSGIConfigurationInjector.java    | 118 +++++
 .../osgi/injection/TamayaOSGIInjector.java      | 162 +++++++
 .../tamaya/osgi/injection/AbstractOSGITest.java |  99 +++++
 .../tamaya/osgi/injection/ActivatorTest.java    |  43 ++
 .../OSGIConfigAdminPropertySourceTest.java      |  65 +++
 .../OSGIConfigurationInjectorTest.java          |  97 ++++
 modules/osgi/karaf-features/pom.xml             |  47 ++
 .../src/main/features/features.xml              |  84 ++++
 modules/osgi/karaf-shell/bnd.bnd                |  38 ++
 modules/osgi/karaf-shell/pom.xml                |  63 +++
 .../karaf/shell/ApplyTamayaConfigCommand.java   |  56 +++
 .../tamaya/karaf/shell/BackupCreateCommand.java |  56 +++
 .../tamaya/karaf/shell/BackupDeleteCommand.java |  47 ++
 .../tamaya/karaf/shell/BackupListCommand.java   |  47 ++
 .../karaf/shell/BackupRestoreCommand.java       |  46 ++
 .../karaf/shell/DefaultEnableCommand.java       |  67 +++
 .../karaf/shell/DefaultEnabledCommand.java      |  62 +++
 .../tamaya/karaf/shell/GetPolicyCommand.java    |  42 ++
 .../karaf/shell/HistoryDeleteAllCommand.java    |  43 ++
 .../karaf/shell/HistoryDeleteCommand.java       |  45 ++
 .../tamaya/karaf/shell/HistoryGetCommand.java   |  69 +++
 .../karaf/shell/HistoryMaxsizeCommand.java      |  41 ++
 .../karaf/shell/HistoryMaxsizeSetCommand.java   |  47 ++
 .../apache/tamaya/karaf/shell/InfoCommand.java  |  41 ++
 .../tamaya/karaf/shell/OSGIConfigCommand.java   |  51 +++
 .../tamaya/karaf/shell/PolicyGetCommand.java    |  42 ++
 .../tamaya/karaf/shell/PolicySetCommand.java    |  68 +++
 .../karaf/shell/PropagateUpdatesCommand.java    |  44 ++
 .../karaf/shell/PropagateUpdatesSetCommand.java |  49 ++
 .../tamaya/karaf/shell/PropertyGetCommand.java  |  49 ++
 .../karaf/shell/PropertySourceCommand.java      |  41 ++
 .../karaf/shell/PropertySourcesCommand.java     |  39 ++
 .../tamaya/karaf/shell/TamayaConfigCommand.java |  53 +++
 .../org/apache/tamaya/karaf/shell/commands      |  44 ++
 modules/osgi/pom.xml                            | 107 +++++
 modules/pom.xml                                 |   2 +
 107 files changed, 8625 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/microprofile/bnd.bnd b/modules/microprofile/bnd.bnd
new file mode 100644
index 0000000..da67308
--- /dev/null
+++ b/modules/microprofile/bnd.bnd
@@ -0,0 +1,34 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - Microprofile
+Bundle-SymbolicName: org.apache.tamaya.microprofile
+Bundle-Description: Apacha Tamaya Config - Microprofile Implementation
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Export-Package: \
+	org.apache.tamaya.microprofile,\
+    org.apache.tamaya.microprofile.cdi,\
+    org.apache.tamaya.microprofile.converter
+Import-Package: \
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.eclipse.microprofile.config
+Export-Service: \
+    org.apache.tamaya.spi.PropertyConverter,\
+    org.apache.tamaya.spi.ProperySource,\
+    org.eclipse.microprofile.config.spi.ConfigProviderResolver,\
+    javax.enterprise.inject.spi.Extension

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/microprofile/pom.xml b/modules/microprofile/pom.xml
new file mode 100644
index 0000000..ff4a8fd
--- /dev/null
+++ b/modules/microprofile/pom.xml
@@ -0,0 +1,158 @@
+<!-- 
+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 current 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-extensions</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-microprofile</artifactId>
+    <name>Apache Tamaya Modules - Microprofile API</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <maven.compile.sourceLevel>1.8</maven.compile.sourceLevel>
+        <maven.compile.targetLevel>1.8</maven.compile.targetLevel>
+        <microprofile.config.version>1.1</microprofile.config.version>
+        <geronimo-atinject-1.0-spec.version>1.0</geronimo-atinject-1.0-spec.version>
+        <geronimo-jcdi-1.1-spec.version>1.0</geronimo-jcdi-1.1-spec.version>
+        <version.shrinkwrap.resolvers>2.2.6</version.shrinkwrap.resolvers>
+        <tamaya-version>0.4-incubating-SNAPSHOT</tamaya-version>
+        <arquillian.version>1.1.13.Final</arquillian.version>
+        <arquillian-weld-embedded.version>2.0.0.Beta5</arquillian-weld-embedded.version>
+        <cdi-api.version>2.0</cdi-api.version>
+        <weld.version>3.0.1.Final</weld.version>
+        <deltaspike.version>1.1.0</deltaspike.version>
+        <openejb.version>4.7.1</openejb.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${tamaya-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${tamaya-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-functions</artifactId>
+            <version>${tamaya-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-events</artifactId>
+            <version>${tamaya-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.microprofile.config</groupId>
+            <artifactId>microprofile-config-api</artifactId>
+            <version>${microprofile.config.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.enterprise</groupId>
+            <artifactId>cdi-api</artifactId>
+            <version>${cdi-api.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.weld.se</groupId>
+            <artifactId>weld-se-shaded</artifactId>
+            <version>${weld.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <!-- Microprofile TCK support only -->
+        <dependency>
+            <groupId>org.jboss.arquillian.testng</groupId>
+            <artifactId>arquillian-testng-container</artifactId>
+            <version>${arquillian.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.9.9</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.shrinkwrap.resolver</groupId>
+            <artifactId>shrinkwrap-resolver-depchain</artifactId>
+            <version>${version.shrinkwrap.resolvers}</version>
+            <scope>test</scope>
+            <type>pom</type>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+        <profile>
+            <id>TCK</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.eclipse.microprofile.config</groupId>
+                    <artifactId>microprofile-config-tck</artifactId>
+                    <version>${microprofile.config.version}</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-weld-embedded</artifactId>
+                    <version>${arquillian-weld-embedded.version}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <version>2.20.1</version>
+                        <configuration>
+                            <suiteXmlFiles>
+                                <suiteXmlFile>src/test/tck-suite.xml</suiteXmlFile>
+                            </suiteXmlFiles>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java
new file mode 100644
index 0000000..8f5002c
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileAdapter.java
@@ -0,0 +1,185 @@
+/*
+ * 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.tamaya.microprofile;
+
+
+import org.apache.tamaya.*;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.Converter;
+
+import java.util.*;
+
+/**
+ * Utility class for adapting microprofile artifacts into Tamaya artifacts and vice versa.
+ */
+public final class MicroprofileAdapter{
+
+    /**
+     * Singleton constructor.
+     */
+    private MicroprofileAdapter(){}
+
+    /**
+     * Converts a Tamaya {@link Configuration} into a Microprofile.io {@link Config}.
+     * @param config the Tamaya {@link Configuration} instance, not null.
+     * @return the corresponding Microprofile.io {@link Config} instance, never null.
+     */
+    public static Config toConfig(Configuration config){
+        if(config instanceof TamayaConfiguration){
+            return ((TamayaConfiguration)config).getConfig();
+        }
+        return new MicroprofileConfig(config);
+    }
+
+    /**
+     * Converts a Microprofile {@link Config}s into Tamaya {@link Configuration}s.
+     * @param config the Microprofile {@link Config} instance, not null.
+     * @return the corresponding Tamaya {@link Configuration} instance, never null.
+     */
+    public static Configuration toConfiguration(Config config){
+        if(config instanceof MicroprofileConfig){
+            return ((MicroprofileConfig)config).getConfiguration();
+        }
+        return new TamayaConfiguration(config);
+    }
+
+    /**
+     * Converts a Tamaya {@link PropertySource}s into a Microprofile.io {@link ConfigSource}.
+     * @param propertySources the Tamaya {@link PropertySource} instances, not null.
+     * @return the corresponding Microprofile.io {@link ConfigSource} instance, never null.
+     */
+    public static List<ConfigSource> toConfigSources(Iterable<PropertySource> propertySources) {
+        List<ConfigSource> configSources = new ArrayList<>();
+        for(PropertySource ps:propertySources){
+            configSources.add(toConfigSource(ps));
+        }
+        Collections.reverse(configSources);
+        return configSources;
+    }
+
+    /**
+     * Converts a Microprofile {@link ConfigSource}s into Tamaya {@link PropertySource}s.
+     * @param configSources the Microprofile {@link ConfigSource} instances, not null.
+     * @return the corresponding Tamaya {@link PropertySource} instances, never null.
+     */
+    public static List<PropertySource> toPropertySources(Iterable<ConfigSource> configSources) {
+        List<PropertySource> propertySources = new ArrayList<>();
+        for(ConfigSource cs:configSources){
+            propertySources.add(toPropertySource(cs));
+        }
+        return propertySources;
+    }
+
+    /**
+     * Converts a Tamaya {@link PropertySource} into a Microprofile.io {@link ConfigSource}.
+     * @param propertySource the Tamaya {@link PropertySource} instance, not null.
+     * @return the corresponding Microprofile.io {@link ConfigSource} instance, never null.
+     */
+    public static ConfigSource toConfigSource(PropertySource propertySource) {
+        if(propertySource instanceof TamayaPropertySource){
+            return ((TamayaPropertySource)propertySource).getConfigSource();
+        }
+        return new MicroprofileConfigSource(propertySource);
+    }
+
+    /**
+     * Converts a Microprofile {@link ConfigSource} into a Tamaya {@link PropertySource}.
+     * @param configSource the Microprofile {@link ConfigSource} instance, not null.
+     * @return the corresponding Tamaya {@link PropertySource} instance, never null.
+     */
+    public static PropertySource toPropertySource(ConfigSource configSource) {
+        if(configSource instanceof MicroprofileConfigSource){
+            return ((MicroprofileConfigSource)configSource).getPropertySource();
+        }
+        return new TamayaPropertySource(configSource);
+    }
+
+    /**
+     * Converts a Microprofile {@link Converter} into a Tamaya {@link PropertyConverter}.
+     * @param converter the Microprofile {@link Converter} instance, not null.
+     * @param <T> the target type
+     * @return the corresponding Tamaya {@link PropertyConverter} instance, never null.
+     */
+    public static <T> PropertyConverter<T> toPropertyConverter(Converter<T> converter) {
+        if(converter instanceof MicroprofileConverter){
+            return ((MicroprofileConverter)converter).getPropertyConverter();
+        }
+        return new TamayaPropertyConverter(converter);
+    }
+
+    /**
+     * Converts a Tamaya {@link PropertyConverter} into a Microprofile.io {@link Converter}.
+     * @param converter the Tamaya {@link PropertyConverter} instance, not null.
+     * @param <T> the target type
+     * @return the corresponding Microprofile.io {@link Converter} instance, never null.
+     */
+    public static <T> Converter<T> toConverter(PropertyConverter<T> converter) {
+        if(converter instanceof TamayaPropertyConverter){
+            return ((TamayaPropertyConverter)converter).getConverter();
+        }
+        return new MicroprofileConverter(converter);
+    }
+
+    /**
+     * Converts a Tamaya {@link ConfigurationContextBuilder} into a Microprofile.io {@link ConfigBuilder}.
+     * @param builder the Tamaya {@link ConfigurationContextBuilder} instance, not null.
+     * @return the corresponding Microprofile.io {@link ConfigBuilder} instance, never null.
+     */
+    public static ConfigBuilder toConfigBuilder(ConfigurationContextBuilder builder) {
+        return new MicroprofileConfigBuilder(builder);
+    }
+
+    /**
+     * Converts the given Tamaya key, value map into a corresponding String based map, hereby
+     * omitting all meta-entries.
+     * @param properties the Tamaya key, value map, not null.
+     * @return the corresponding String based map, never null.
+     */
+    public static Map<String, String> toStringMap(Map<String, PropertyValue> properties) {
+        Map<String, String> valueMap = new HashMap<>(properties.size());
+        for(Map.Entry<String,PropertyValue> en:properties.entrySet()){
+            if(en.getValue().getValue()!=null) {
+                valueMap.put(en.getKey(), en.getValue().getValue());
+            }
+        }
+        return valueMap;
+    }
+
+    /**
+     * Converts the given String based key, value map into a corresponding String,PropertyValue
+     * based map.
+     * @param properties the String based key, value map, not null.
+     * @param source the source of the entries, not null.
+     * @return the corresponding String,PropertyValue based map, never null.
+     */
+    public static Map<String, PropertyValue> toPropertyValueMap(Map<String, String> properties, String source) {
+        Map<String, PropertyValue> valueMap = new HashMap<>(properties.size());
+        for(Map.Entry<String,String> en:properties.entrySet()){
+            valueMap.put(en.getKey(), PropertyValue.of(en.getKey(), en.getValue(), source));
+        }
+        return valueMap;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java
new file mode 100644
index 0000000..61c3cdc
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java
@@ -0,0 +1,100 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.events.FrozenConfiguration;
+import org.apache.tamaya.spi.PropertySource;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance.
+ */
+public class MicroprofileConfig implements Config, Serializable {
+
+    private Configuration delegate;
+
+    public MicroprofileConfig(Configuration delegate){
+        this.delegate = Objects.requireNonNull(delegate);
+    }
+
+    public Configuration getConfiguration(){
+        return this.delegate;
+    }
+
+
+    @Override
+    public <T> T getValue(String propertyName, Class<T> propertyType) {
+        T value = null;
+        try{
+            value = delegate.get(propertyName, propertyType);
+        }catch(ConfigException e){
+            if(e.toString().contains("Unparseable")){
+                throw new IllegalArgumentException("Invalid type: " + propertyType.getName());
+            }
+        }
+        if(value == null){
+            throw new NoSuchElementException("No such config property: " + propertyName);
+        }
+        return value;
+    }
+
+    @Override
+    public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
+        return Optional.ofNullable(delegate.get(propertyName, propertyType));
+    }
+
+    @Override
+    public Iterable<String> getPropertyNames() {
+        return delegate.getProperties().keySet();
+    }
+
+    @Override
+    public Iterable<ConfigSource> getConfigSources() {
+        return MicroprofileAdapter.toConfigSources(delegate.getContext().getPropertySources());
+    }
+
+    @Override
+    public String toString() {
+        return "MicroprofileConfig{" +
+                "delegate=" + delegate +
+                '}';
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException{
+        if(!(this.delegate instanceof Serializable)){
+            out.writeObject(FrozenConfiguration.of(this.delegate));
+        }else {
+            out.writeObject(this.delegate);
+        }
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{
+        this.delegate = (Configuration)in.readObject();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
new file mode 100644
index 0000000..896311c
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
@@ -0,0 +1,140 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.spisupport.EnvironmentPropertySource;
+import org.apache.tamaya.spisupport.PropertySourceComparator;
+import org.apache.tamaya.spisupport.SystemPropertySource;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
+import org.eclipse.microprofile.config.spi.Converter;
+
+import java.util.Objects;
+
+/**
+ * Created by atsticks on 23.03.17.
+ */
+final class MicroprofileConfigBuilder implements ConfigBuilder{
+
+    private ConfigurationContextBuilder contextBuilder;
+    private ClassLoader classLoader;
+
+    MicroprofileConfigBuilder(ConfigurationContextBuilder contextBuilder){
+        this.contextBuilder = Objects.requireNonNull(contextBuilder);
+        contextBuilder.addDefaultPropertyConverters();
+    }
+
+    public ConfigurationContextBuilder getConfigurationContextBuilder(){
+        return contextBuilder;
+    }
+
+    /**
+     * Add the default config sources appearing on the builder's classpath
+     * including:
+     * <ol>
+     * <li>System properties</li>
+     * <li>Environment properties</li>
+     * <li>/META-INF/microprofile-config.properties</li>
+     * </ol>
+     *
+     * @return the ConfigBuilder with the default config sources
+     */
+    @Override
+    public ConfigBuilder addDefaultSources() {
+        contextBuilder.addPropertySources(
+                new SystemPropertySource(400),
+                new EnvironmentPropertySource(300),
+                new MicroprofileDefaultProperties());
+        contextBuilder.sortPropertySources(PropertySourceComparator.getInstance());
+        return this;
+    }
+
+    /**
+     * Add ConfigSources registered using the ServiceLoader.
+     * @return the ConfigBuilder with the added config sources
+     */
+    @Override
+    public ConfigBuilder addDiscoveredSources() {
+        for(ConfigSource configSource: ServiceContextManager.getServiceContext().getServices(ConfigSource.class)){
+            contextBuilder.addPropertySources(MicroprofileAdapter.toPropertySource(configSource));
+        }
+        for(ConfigSourceProvider configSourceProvider: ServiceContextManager.getServiceContext().getServices(ConfigSourceProvider.class)){
+            contextBuilder.addPropertySources(MicroprofileAdapter.toPropertySources(configSourceProvider.getConfigSources(
+                    Thread.currentThread().getContextClassLoader()
+            )));
+        }
+        contextBuilder.sortPropertySources(PropertySourceComparator.getInstance());
+        return this;
+    }
+
+    /**
+     * Add Converters registered using the ServiceLoader.
+     * @return the ConfigBuilder with the added config converters
+     */
+    @Override
+    public ConfigBuilder addDiscoveredConverters() {
+        for(Converter<?> converter: ServiceContextManager.getServiceContext().getServices(Converter.class)){
+            TypeLiteral targetType = TypeLiteral.of(
+                    TypeLiteral.getGenericInterfaceTypeParameters(converter.getClass(),Converter.class)[0]);
+            contextBuilder.addPropertyConverters(targetType,
+                    MicroprofileAdapter.toPropertyConverter(converter));
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigBuilder forClassLoader(ClassLoader loader) {
+        this.classLoader = loader;
+        return this;
+    }
+
+    @Override
+    public ConfigBuilder withSources(ConfigSource... sources) {
+        for(ConfigSource source:sources){
+            contextBuilder.addPropertySources(MicroprofileAdapter.toPropertySource(source));
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigBuilder withConverters(Converter<?>... converters) {
+        for(Converter<?> converter:converters){
+            TypeLiteral lit = TypeLiteral.of(converter.getClass());
+            TypeLiteral target = TypeLiteral.of(lit.getType());
+            contextBuilder.removePropertyConverters(target);
+            contextBuilder.addPropertyConverters(
+                    target,
+                    MicroprofileAdapter.toPropertyConverter(converter));
+        }
+        return this;
+    }
+
+    @Override
+    public Config build() {
+        return MicroprofileAdapter.toConfig(ConfigurationProvider.createConfiguration(
+                contextBuilder.build()
+        ));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java
new file mode 100644
index 0000000..92a928a
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolver.java
@@ -0,0 +1,82 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+/**
+ * Created by atsticks on 23.03.17.
+ */
+public class MicroprofileConfigProviderResolver extends ConfigProviderResolver {
+
+    private Map<ClassLoader, Config> configs = new ConcurrentHashMap<>();
+
+    @Override
+    public Config getConfig() {
+        return getConfig(Thread.currentThread().getContextClassLoader());
+    }
+
+    @Override
+    public Config getConfig(ClassLoader loader) {
+        Config config = this.configs.get(loader);
+        if(config==null){
+            ConfigurationContextBuilder builder = ConfigurationProvider.getConfigurationContextBuilder();
+            builder.addDefaultPropertyConverters();
+            MicroprofileConfigBuilder microConfigBuilder = new MicroprofileConfigBuilder(builder);
+            microConfigBuilder.addDefaultSources();
+            microConfigBuilder.addDiscoveredSources();
+            config = microConfigBuilder.build();
+            this.configs.put(loader, config);
+        }
+        return config;
+    }
+
+    @Override
+    public ConfigBuilder getBuilder() {
+        return new MicroprofileConfigBuilder(ConfigurationProvider.getConfigurationContextBuilder());
+    }
+
+    @Override
+    public void registerConfig(Config config, ClassLoader classLoader) {
+        if(configs.containsKey(classLoader)){
+            Logger.getLogger(getClass().getName())
+                    .warning("Replacing existing config for classloader: " + classLoader);
+//            throw new IllegalArgumentException("Already a config registered with classloader: " + classLoader);
+        }
+        this.configs.put(classLoader, config);
+    }
+
+    @Override
+    public void releaseConfig(Config config) {
+        for(Map.Entry<ClassLoader, Config> en: this.configs.entrySet()){
+            if(en.getValue().equals(config)){
+                this.configs.remove(en.getKey());
+                return;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java
new file mode 100644
index 0000000..39ca119
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSource.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance.
+ */
+public class MicroprofileConfigSource implements ConfigSource{
+
+    private PropertySource delegate;
+
+    public MicroprofileConfigSource(PropertySource propertySource){
+        this.delegate = Objects.requireNonNull(propertySource);
+    }
+
+    public PropertySource getPropertySource(){
+        return this.delegate;
+    }
+
+    @Override
+    public int getOrdinal() {
+        return delegate.getOrdinal();
+    }
+
+    @Override
+    public String getName() {
+        return delegate.getName();
+    }
+
+    @Override
+    public String getValue(String key) {
+        PropertyValue value = delegate.get(key);
+        if(value!=null){
+            return value.getValue();
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return toMap(delegate.getProperties());
+    }
+
+    private Map<String, String> toMap(Map<String, PropertyValue> properties) {
+        Map<String, String> valueMap = new HashMap<>(properties.size());
+        for(Map.Entry<String,PropertyValue> en:properties.entrySet()){
+            if(en.getValue().getValue()!=null) {
+                valueMap.put(en.getKey(), en.getValue().getValue());
+            }
+        }
+        return valueMap;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSourceProvider.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSourceProvider.java
new file mode 100644
index 0000000..5176940
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigSourceProvider.java
@@ -0,0 +1,64 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+import org.apache.tamaya.spi.PropertyValue;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
+
+import java.util.*;
+
+/**
+ * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance.
+ */
+public class MicroprofileConfigSourceProvider implements ConfigSourceProvider{
+
+    private PropertySourceProvider delegate;
+
+    public MicroprofileConfigSourceProvider(PropertySourceProvider propertySourceProvider){
+        this.delegate = Objects.requireNonNull(propertySourceProvider);
+    }
+
+    public PropertySourceProvider getPropertySourceProvider(){
+        return this.delegate;
+    }
+
+
+    private Map<String, String> toMap(Map<String, PropertyValue> properties) {
+        Map<String, String> valueMap = new HashMap<>(properties.size());
+        for(Map.Entry<String,PropertyValue> en:properties.entrySet()){
+            if(en.getValue().getValue()!=null) {
+                valueMap.put(en.getKey(), en.getValue().getValue());
+            }
+        }
+        return valueMap;
+    }
+
+    @Override
+    public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
+        if(delegate instanceof TamayaPropertySourceProvider){
+            return ((TamayaPropertySourceProvider)delegate).getConfigSourceProvider()
+                    .getConfigSources(forClassLoader);
+        }else {
+            return MicroprofileAdapter.toConfigSources(delegate.getPropertySources());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConverter.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConverter.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConverter.java
new file mode 100644
index 0000000..cb6aab2
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConverter.java
@@ -0,0 +1,50 @@
+/*
+ * 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.tamaya.microprofile;
+
+
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.Converter;
+
+import java.util.Objects;
+
+/**
+ * Property source implementation that wraps a Microprofile {@link ConfigSource} instance.
+ */
+public class MicroprofileConverter<T> implements Converter<T> {
+
+    private PropertyConverter<T> delegate;
+
+    public MicroprofileConverter(PropertyConverter<T> delegate){
+        this.delegate = Objects.requireNonNull(delegate);
+    }
+
+    public PropertyConverter<T> getPropertyConverter(){
+        return this.delegate;
+    }
+
+    @Override
+    public T convert(String value) {
+        return delegate.convert(value, new ConversionContext.Builder("microprofile:no-key", TypeLiteral.of(
+                TypeLiteral.of(getClass()).getType())).build());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileDefaultProperties.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileDefaultProperties.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileDefaultProperties.java
new file mode 100644
index 0000000..cfe06bd
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileDefaultProperties.java
@@ -0,0 +1,33 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.spisupport.PropertiesResourcePropertySource;
+
+
+/**
+ * Default property source for config properties in the classpath.
+ */
+public class MicroprofileDefaultProperties extends PropertiesResourcePropertySource{
+
+    public MicroprofileDefaultProperties() {
+        super("META-INF/microprofile-config.properties", null);
+        setDefaultOrdinal(100);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaConfiguration.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaConfiguration.java
new file mode 100644
index 0000000..0f27821
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaConfiguration.java
@@ -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.tamaya.microprofile;
+
+import org.apache.tamaya.*;
+import org.apache.tamaya.spi.ConfigurationContext;
+import org.eclipse.microprofile.config.Config;
+
+import java.util.*;
+
+/**
+ * Created by atsticks on 23.03.17.
+ */
+public class TamayaConfiguration implements Configuration{
+
+    private Config delegate;
+
+    public TamayaConfiguration(Config config){
+        this.delegate = Objects.requireNonNull(config);
+    }
+
+    public Config getConfig(){
+        return delegate;
+    }
+
+    @Override
+    public String get(String key) {
+        return this.delegate.getOptionalValue(key, String.class).orElse(null);
+    }
+
+    @Override
+    public String getOrDefault(String key, String defaultValue) {
+        return this.delegate.getOptionalValue(key, String.class).orElse(defaultValue);
+    }
+
+    @Override
+    public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
+        return this.delegate.getOptionalValue(key, type).orElse(defaultValue);
+    }
+
+    @Override
+    public <T> T get(String key, Class<T> type) {
+        return this.delegate.getOptionalValue(key, type).orElseThrow(
+                () -> new NoSuchElementException("Missing key: " + key));
+    }
+
+    @Override
+    public <T> T get(String key, TypeLiteral<T> type) {
+        return this.delegate.getOptionalValue(key, type.getRawType()).orElseThrow(
+                () -> new NoSuchElementException("Missing key: " + key));
+    }
+
+    @Override
+    public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
+        return null;
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return null;
+    }
+
+    @Override
+    public Configuration with(ConfigOperator operator) {
+        return operator.operate(this);
+    }
+
+    @Override
+    public <T> T query(ConfigQuery<T> query) {
+        return query.query(this);
+    }
+
+    @Override
+    public ConfigurationContext getContext() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertyConverter.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertyConverter.java
new file mode 100644
index 0000000..a83008a
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertyConverter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.tamaya.microprofile;
+
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.Converter;
+
+import java.util.Objects;
+
+/**
+ * Property source implementation that wraps a Microprofile {@link ConfigSource} instance.
+ */
+public class TamayaPropertyConverter<T> implements PropertyConverter<T> {
+
+    private Converter<T> delegate;
+
+    public TamayaPropertyConverter(Converter<T> delegate){
+        this.delegate = Objects.requireNonNull(delegate);
+    }
+
+    public Converter<T> getConverter(){
+        return this.delegate;
+    }
+
+    @Override
+    public T convert(String value, ConversionContext context) {
+        return delegate.convert(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySource.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySource.java
new file mode 100644
index 0000000..f526514
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySource.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Property source implementation that wraps a Microprofile {@link ConfigSource} instance.
+ */
+public class TamayaPropertySource implements PropertySource{
+
+    private ConfigSource delegate;
+
+    public TamayaPropertySource(ConfigSource configSource){
+        this.delegate = Objects.requireNonNull(configSource);
+    }
+
+    public ConfigSource getConfigSource(){
+        return this.delegate;
+    }
+
+    @Override
+    public int getOrdinal() {
+        return delegate.getOrdinal();
+    }
+
+    @Override
+    public String getName() {
+        return Optional.ofNullable(delegate.getName())
+                .orElse(delegate.toString());
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        return PropertyValue.of(key, delegate.getValue(key),getName());
+    }
+
+    @Override
+    public Map<String, PropertyValue> getProperties() {
+        return toValueMap(delegate.getProperties());
+    }
+
+    private Map<String, PropertyValue> toValueMap(Map<String, String> properties) {
+        Map<String, PropertyValue> valueMap = new HashMap<>(properties.size());
+        for(Map.Entry<String,String> en:properties.entrySet()){
+            valueMap.put(en.getKey(), PropertyValue.of(en.getKey(), en.getValue(), getName()));
+        }
+        return valueMap;
+    }
+
+    @Override
+    public boolean isScannable() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySourceProvider.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySourceProvider.java
new file mode 100644
index 0000000..5b0bcf7
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/TamayaPropertySourceProvider.java
@@ -0,0 +1,56 @@
+/*
+ * 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.tamaya.microprofile;
+
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
+
+import java.util.*;
+
+/**
+ * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance.
+ */
+public class TamayaPropertySourceProvider implements PropertySourceProvider{
+
+    private ConfigSourceProvider delegate;
+
+    public TamayaPropertySourceProvider(ConfigSourceProvider configSourceProvider){
+        this.delegate = Objects.requireNonNull(configSourceProvider);
+    }
+
+    public ConfigSourceProvider getConfigSourceProvider(){
+        return this.delegate;
+    }
+
+
+    @Override
+    public Collection<PropertySource> getPropertySources() {
+        if(delegate instanceof MicroprofileConfigSourceProvider){
+            return ((MicroprofileConfigSourceProvider)delegate).getPropertySourceProvider()
+                    .getPropertySources();
+        }else {
+            return MicroprofileAdapter.toPropertySources(
+                    delegate.getConfigSources(Thread.currentThread().getContextClassLoader()));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java
new file mode 100644
index 0000000..a08f76f
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java
@@ -0,0 +1,95 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Internally used conversion bean.
+ */
+final class BridgingConfigBean implements Bean<Object> {
+
+    private final Bean<Object> delegate;
+    private final Set<Type> types;
+
+    public BridgingConfigBean(final Bean delegate, final Set<Type> types) {
+        this.types = types;
+        this.delegate = Objects.requireNonNull(delegate);
+    }
+
+    @Override
+    public Set<Type> getTypes() {
+        return types;
+    }
+
+    @Override
+    public Class<?> getBeanClass() {
+        return delegate.getBeanClass();
+    }
+
+    @Override
+    public Set<InjectionPoint> getInjectionPoints() {
+        return delegate.getInjectionPoints();
+    }
+
+    @Override
+    public String getName() {
+        return delegate.getName();
+    }
+
+    @Override
+    public Set<Annotation> getQualifiers() {
+        return delegate.getQualifiers();
+    }
+
+    @Override
+    public Class<? extends Annotation> getScope() {
+        return delegate.getScope();
+    }
+
+    @Override
+    public Set<Class<? extends Annotation>> getStereotypes() {
+        return delegate.getStereotypes();
+    }
+
+    @Override
+    public boolean isAlternative() {
+        return delegate.isAlternative();
+    }
+
+    @Override
+    public boolean isNullable() {
+        return false;
+        // delegate.isNullable();
+    }
+
+    @Override
+    public Object create(CreationalContext<Object> creationalContext) {
+        return this.delegate.create(creationalContext);
+    }
+
+    @Override
+    public void destroy(Object instance, CreationalContext<Object> creationalContext) {
+        delegate.destroy(instance, creationalContext);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java
new file mode 100644
index 0000000..29d7122
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredField.java
@@ -0,0 +1,65 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import org.apache.tamaya.Configuration;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.reflect.Field;
+
+/**
+ * CDI implementation for event publishing of configured instances.
+ */
+public final class ConfiguredField {
+
+    private final Field field;
+    private String key;
+
+    ConfiguredField(InjectionPoint injectionPoint, String key){
+        this.field = (Field)injectionPoint.getMember();
+        this.key = key;
+    }
+
+    public Class<?> getType() {
+        return field.getType();
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public Field getAnnotatedField() {
+        return field;
+    }
+
+    public String getName() {
+        return field.getName();
+    }
+
+    public String getSignature() {
+        return getName()+':'+field.getType().getName();
+    }
+
+    public void configure(Object instance, Configuration config) {
+        throw new UnsupportedOperationException("Use CDI annotations for configuration injection.");
+    }
+
+    @Override
+    public String toString() {
+        return "CDIConfiguredField["+getSignature()+']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java
new file mode 100644
index 0000000..90204fe
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredMethod.java
@@ -0,0 +1,65 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import org.apache.tamaya.Configuration;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.reflect.Method;
+
+/**
+ * Implementation of a configured methods for CDI module.
+ */
+public final class ConfiguredMethod {
+
+    private final Method method;
+    private String key;
+
+    ConfiguredMethod(InjectionPoint injectionPoint, String key){
+        this.method = (Method)injectionPoint.getMember();
+        this.key = key;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public Class<?>[] getParameterTypes() {
+        return method.getParameterTypes();
+    }
+
+    public Method getAnnotatedMethod() {
+        return method;
+    }
+
+    public String getName() {
+        return method.getName();
+    }
+
+    public String getSignature() {
+        return null;
+    }
+
+    public void configure(Object instance, Configuration config) {
+        throw new UnsupportedOperationException("Use CDI annotations for configuration injection.");
+    }
+
+    @Override
+    public String toString() {
+        return "CDIConfiguredMethod["+getSignature()+']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java
new file mode 100644
index 0000000..535a556
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/ConfiguredType.java
@@ -0,0 +1,86 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import org.apache.tamaya.Configuration;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Event published for items configured by CDI extensions. This is for example used by the documentation module
+ * to automatically track the configuration endpoints for documentation.
+ */
+public final class ConfiguredType {
+
+    private final Class<?> type;
+    private final List<ConfiguredMethod> methods = new ArrayList<>();
+    private final List<ConfiguredField> fields = new ArrayList<>();
+
+    public ConfiguredType(Class<?> type){
+        this.type = Objects.requireNonNull(type);
+    }
+
+    public Class getType() {
+        return type;
+    }
+
+    public String getName() {
+        return type.getName();
+    }
+
+    public Collection<ConfiguredField> getConfiguredFields() {
+        return null;
+    }
+
+    public Collection<ConfiguredMethod> getConfiguredMethods() {
+        return null;
+    }
+
+    public void configure(Object instance, Configuration config) {
+        throw new UnsupportedOperationException("Use CDI annotations for configuration injection.");
+    }
+
+    /**
+     * Used to build up during injection point processing.
+     * @param injectionPoint the CDI injection point, not null.
+     * @param key the possible config key, not null.
+     */
+    void addConfiguredMember(InjectionPoint injectionPoint, String key) {
+        Member member = injectionPoint.getMember();
+        if(member instanceof Field){
+            this.fields.add(new ConfiguredField(injectionPoint, key));
+        } else if(member instanceof Method){
+            this.methods.add(new ConfiguredMethod(injectionPoint, key));
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "CDIConfiguredType{" +
+                "type=" + type +
+                ", methods=" + methods +
+                ", fields=" + fields +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileCDIExtension.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileCDIExtension.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileCDIExtension.java
new file mode 100644
index 0000000..0be929b
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileCDIExtension.java
@@ -0,0 +1,127 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.inject.Provider;
+import java.lang.reflect.AnnotatedType;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
+
+
+/**
+ * CDI Extension module that adds injection mechanism for configuration.
+ *
+ * @see org.eclipse.microprofile.config.Config
+ * @see org.eclipse.microprofile.config.inject.ConfigProperty
+ */
+public class MicroprofileCDIExtension implements Extension {
+
+    private static final Logger LOG = Logger.getLogger(MicroprofileCDIExtension.class.getName());
+
+    private final Set<Type> types = new HashSet<>();
+    private Bean<?> convBean;
+
+    /**
+     * Constructor for loading logging its load.
+     */
+    public MicroprofileCDIExtension(){
+        LOG.finest("Loading Tamaya Microprofile Support...");
+    }
+
+    /**
+     * Method that checks the configuration injection points during deployment for available configuration.
+     * @param pb the bean to process.
+     * @param beanManager the bean manager to notify about new injections.
+     */
+    public void retrieveTypes(@Observes final ProcessBean<?> pb, BeanManager beanManager) {
+
+        final Set<InjectionPoint> ips = pb.getBean().getInjectionPoints();
+        ConfiguredType configuredType = new ConfiguredType(pb.getBean().getBeanClass());
+
+        boolean configured = false;
+        for (InjectionPoint injectionPoint : ips) {
+            if (injectionPoint.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
+                LOG.fine("Configuring: " + injectionPoint);
+                final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
+                String key = !annotation.name().isEmpty()?annotation.name():MicroprofileConfigurationProducer.getDefaultKey(injectionPoint);
+                configuredType.addConfiguredMember(injectionPoint, key);
+                Type originalType = injectionPoint.getType();
+                Type convertedType = unwrapType(originalType);
+                types.add(convertedType);
+                configured = true;
+                LOG.finest(() -> "Enabling Tamaya Microprofile Configuration on bean: " + configuredType.getName());
+            }else if(injectionPoint.getMember() instanceof Method){
+                Method method = (Method)injectionPoint.getMember();
+                for(AnnotatedType paramType: method.getAnnotatedParameterTypes()){
+                    if(paramType.isAnnotationPresent(ConfigProperty.class)) {
+                        LOG.fine("Configuring method: " + injectionPoint);
+                        final ConfigProperty annotation = paramType.getAnnotation(ConfigProperty.class);
+                        String key = !annotation.name().isEmpty() ? annotation.name() : MicroprofileConfigurationProducer.getDefaultKey(injectionPoint);
+                        configuredType.addConfiguredMember(injectionPoint, key);
+                        Type originalType = paramType.getType();
+                        Type convertedType = unwrapType(originalType);
+                        types.add(convertedType);
+                        configured = true;
+                        LOG.finest(() -> "Enabling Tamaya Microprofile Configuration on bean: " + configuredType.getName());
+                    }
+                }
+            }
+        }
+        if(configured) {
+            beanManager.fireEvent(configuredType);
+        }
+    }
+
+
+    public void captureConvertBean(@Observes final ProcessProducerMethod<?, ?> ppm) {
+        if (ppm.getAnnotated().isAnnotationPresent(ConfigProperty.class)) {
+            convBean = ppm.getBean();
+        }
+    }
+
+    public void addConverter(@Observes final AfterBeanDiscovery abd, final BeanManager bm) {
+        if(!types.isEmpty() && convBean!=null) {
+            abd.addBean(new BridgingConfigBean(convBean, types));
+        }
+    }
+
+    private Type unwrapType(Type type) {
+        if(type instanceof ParameterizedType) {
+            Type rawType = ((ParameterizedType) type).getRawType();
+            if(rawType == Provider.class || rawType == Instance.class) {
+                return ((ParameterizedType) type).getActualTypeArguments()[0];
+            }
+        }
+        return type;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
new file mode 100644
index 0000000..bae7287
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
@@ -0,0 +1,156 @@
+/*
+ * 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.tamaya.microprofile.cdi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Provider;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Optional;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Producer bean for configuration properties.
+ */
+@ApplicationScoped
+public class MicroprofileConfigurationProducer {
+
+    private static final Logger LOGGER = Logger.getLogger(MicroprofileConfigurationProducer.class.getName());
+
+    @Produces
+    @ConfigProperty
+    public Object resolveAndConvert(final InjectionPoint injectionPoint) {
+        LOGGER.finest( () -> "Inject: " + injectionPoint);
+        final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class);
+        String key = annotation.name();
+        if(key.isEmpty()){
+            key = getDefaultKey(injectionPoint);
+        }
+
+        // unless the extension is not installed, this should never happen because the extension
+        // enforces the resolvability of the config
+
+        String defaultTextValue = annotation.defaultValue().equals(ConfigProperty.UNCONFIGURED_VALUE) ? null : annotation.defaultValue();
+        ConversionContext conversionContext = createConversionContext(key, injectionPoint);
+        Object value = resolveValue(defaultTextValue, conversionContext, injectionPoint);
+        if (value == null) {
+            throw new ConfigException(String.format(
+                    "Can't resolve any of the possible config keys: %s to the required target type: %s, supported formats: %s",
+                    key, conversionContext.getTargetType(), conversionContext.getSupportedFormats().toString()));
+        }
+        LOGGER.finest(String.format("Injecting %s for key %s in class %s", key, value.toString(), injectionPoint.toString()));
+        return value;
+    }
+
+    static String getDefaultKey(InjectionPoint injectionPoint) {
+        Class declaringType = injectionPoint.getMember().getDeclaringClass();
+        return declaringType.getCanonicalName() + "." + injectionPoint.getMember().getName();
+    }
+
+    static ConversionContext createConversionContext(String key, InjectionPoint injectionPoint) {
+        final Type targetType = injectionPoint.getAnnotated().getBaseType();
+        Configuration config = ConfigurationProvider.getConfiguration();
+        ConversionContext.Builder builder = new ConversionContext.Builder(config,
+                ConfigurationProvider.getConfiguration().getContext(), key, TypeLiteral.of(targetType));
+        if(targetType instanceof ParameterizedType){
+            ParameterizedType pt = (ParameterizedType)targetType;
+            if(pt.getRawType().equals(Provider.class)) {
+                builder = new ConversionContext.Builder(config,
+                        ConfigurationProvider.getConfiguration().getContext(), key,
+                        TypeLiteral.of(pt.getActualTypeArguments()[0]));
+            }
+        }
+        if (injectionPoint.getMember() instanceof AnnotatedElement) {
+            AnnotatedElement annotated = (AnnotatedElement)injectionPoint.getMember();
+            if(annotated.isAnnotationPresent(ConfigProperty.class)) {
+                builder.setAnnotatedElement(annotated);
+            }
+        }else if(injectionPoint.getMember() instanceof Method){
+            Method method = (Method)injectionPoint.getMember();
+            for(Type type:method.getParameterTypes()){
+                if(type instanceof AnnotatedElement){
+                    AnnotatedElement annotated = (AnnotatedElement)type;
+                    if(annotated.isAnnotationPresent(ConfigProperty.class)) {
+                        builder.setAnnotatedElement(annotated);
+                    }
+                }
+            }
+        }
+        return builder.build();
+    }
+
+    static Object resolveValue(String defaultTextValue, ConversionContext context, InjectionPoint injectionPoint) {
+        Config config = ConfigProviderResolver.instance().getConfig();
+        String textValue = config.getOptionalValue(context.getKey(), String.class).orElse(defaultTextValue);
+        if(String.class.equals(context.getTargetType().getRawType())){
+            return textValue;
+        }
+        Object value = null;
+        if (textValue != null || Optional.class.equals(context.getTargetType().getRawType())) {
+            LOGGER.log(Level.FINEST, () -> "Converting KEY: " + context.getKey() + "("+context.getTargetType()+"), textValue: " + textValue);
+            List<PropertyConverter> converters = ConfigurationProvider.getConfiguration().getContext()
+                    .getPropertyConverters((TypeLiteral)context.getTargetType());
+            for (PropertyConverter<Object> converter : converters) {
+                try {
+                    value = converter.convert(textValue, context);
+                    if (value != null) {
+                        LOGGER.log(Level.FINEST, "Parsed default value from '" + textValue + "' into " +
+                                injectionPoint);
+                        break;
+                    }
+                } catch (Exception e) {
+                    LOGGER.log(Level.FINEST, "Failed to convert value '" + textValue + "' for " +
+                            injectionPoint, e);
+                }
+            }
+        }
+        return value;
+    }
+
+    @Produces
+    public Config getConfiguration(){
+        return ConfigProvider.getConfig();
+    }
+
+    @Produces
+    public ConfigBuilder getConfigBuilder(){
+        return ConfigProviderResolver.instance().getBuilder();
+    }
+
+
+}


[6/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java
new file mode 100644
index 0000000..1debc71
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java
@@ -0,0 +1,61 @@
+/*
+ * 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.tamaya.microprofile.converter;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import javax.annotation.Priority;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.logging.Logger;
+
+/**
+ * Converter, converting from String to Boolean for 1 = true, otherwise false.
+ */
+@Priority(-1)
+public class BooleanAsIntegerConverterFix implements PropertyConverter<Boolean> {
+
+    private final Logger LOG = Logger.getLogger(getClass().getName());
+
+    @Override
+    public Boolean convert(String value, ConversionContext context) {
+        context.addSupportedFormats(getClass(), "'1' (true), otherwise false.");
+        try{
+            int val = Integer.parseInt(Objects.requireNonNull(value).trim());
+            if(val==1) {
+                return Boolean.TRUE;
+            }
+            return Boolean.FALSE;
+        }catch(Exception e){
+            // OK
+            return Boolean.FALSE;
+        }
+    }
+
+    @Override
+    public boolean equals(Object o){
+        return getClass().equals(o.getClass());
+    }
+
+    @Override
+    public int hashCode(){
+        return getClass().hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java
new file mode 100644
index 0000000..163481d
--- /dev/null
+++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java
@@ -0,0 +1,98 @@
+/*
+ * 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.tamaya.microprofile.converter;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.ConfigQuery;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import javax.annotation.Priority;
+import javax.inject.Provider;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Converter, converting from String to Boolean for 1 = true, otherwise false.
+ */
+@Priority(-1)
+public class ProviderConverter implements PropertyConverter<Provider> {
+
+    private static final Logger LOG = Logger.getLogger(ProviderConverter.class.getName());
+
+    @Override
+    public Provider convert(String value, ConversionContext context) {
+        return () -> {
+            try{
+                Type targetType = context.getTargetType().getType();
+                ConvertQuery converter = new ConvertQuery(value, TypeLiteral.of(targetType));
+                return context.getConfiguration().query(converter);
+            }catch(Exception e){
+                throw new ConfigException("Error evaluating config value.", e);
+            }
+        };
+    }
+
+    @Override
+    public boolean equals(Object o){
+        return getClass().equals(o.getClass());
+    }
+
+    @Override
+    public int hashCode(){
+        return getClass().hashCode();
+    }
+
+    private static final class ConvertQuery<T> implements ConfigQuery<T> {
+
+        private String rawValue;
+        private TypeLiteral<T> type;
+
+        public ConvertQuery(String rawValue, TypeLiteral<T> type) {
+            this.rawValue = Objects.requireNonNull(rawValue);
+            this.type = Objects.requireNonNull(type);
+        }
+
+        @Override
+        public T query(Configuration config) {
+            List<PropertyConverter<T>> converters = config.getContext().getPropertyConverters(type);
+            ConversionContext context = new ConversionContext.Builder(type).setConfigurationContext(config.getContext())
+                    .setConfiguration(config).setKey(ConvertQuery.class.getName()).build();
+            for(PropertyConverter<?> conv: converters) {
+                try{
+                    if(conv instanceof ProviderConverter){
+                        continue;
+                    }
+                    T result = (T)conv.convert(rawValue, context);
+                    if(result!=null){
+                        return result;
+                    }
+                }catch(Exception e){
+                    LOG.log(Level.FINEST,  e, () -> "Converter "+ conv +" failed to convert to " + type);
+                }
+            }
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/modules/microprofile/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..21ec9d5
--- /dev/null
+++ b/modules/microprofile/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.tamaya.microprofile.cdi.MicroprofileCDIExtension
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
new file mode 100644
index 0000000..2205fa2
--- /dev/null
+++ b/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+org.apache.tamaya.microprofile.converter.BooleanAsIntegerConverterFix
+org.apache.tamaya.microprofile.converter.ProviderConverter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
new file mode 100644
index 0000000..585700b
--- /dev/null
+++ b/modules/microprofile/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.tamaya.microprofile.MicroprofileDefaultProperties
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigProviderResolver
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigProviderResolver b/modules/microprofile/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigProviderResolver
new file mode 100644
index 0000000..040f5fd
--- /dev/null
+++ b/modules/microprofile/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigProviderResolver
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.tamaya.microprofile.MicroprofileConfigProviderResolver
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/main/resources/beans.xml
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/main/resources/beans.xml b/modules/microprofile/src/main/resources/beans.xml
new file mode 100644
index 0000000..9b07802
--- /dev/null
+++ b/modules/microprofile/src/main/resources/beans.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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 current 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
+
+
+</beans>
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilderTest.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilderTest.java
new file mode 100644
index 0000000..3250102
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilderTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 24.03.17.
+ */
+public class MicroprofileConfigBuilderTest {
+
+    private ConfigSource testSource = new ConfigSource() {
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String,String> map = new HashMap<>();
+            map.put("timestamp", String.valueOf(System.currentTimeMillis()));
+            return map;
+        }
+
+        @Override
+        public String getValue(String propertyName) {
+            if("timestamp".equals(propertyName)){
+                return String.valueOf(System.currentTimeMillis());
+            }
+            return null;
+        }
+
+        @Override
+        public String getName() {
+            return "test";
+        }
+    };
+
+    @Test
+    public void testBuildEmptyConfig(){
+        ConfigBuilder builder = ConfigProviderResolver.instance().getBuilder();
+        assertNotNull(builder);
+        Config config = builder.build();
+        assertNotNull(config);
+        assertFalse(config.getPropertyNames().iterator().hasNext());
+        assertFalse(config.getConfigSources().iterator().hasNext());
+    }
+
+    @Test
+    public void testBuildConfig(){
+        ConfigBuilder builder = ConfigProviderResolver.instance().getBuilder();
+        assertNotNull(builder);
+        builder.withSources(testSource);
+        Config config = builder.build();
+        assertNotNull(config);
+        assertTrue(config.getPropertyNames().iterator().hasNext());
+        assertTrue(config.getConfigSources().iterator().hasNext());
+        assertNotNull(config.getValue("timestamp", String.class));
+        ConfigSource src = config.getConfigSources().iterator().next();
+        assertNotNull(src);
+        assertEquals(src, testSource);
+    }
+
+    @Test
+    public void testBuildDefaultConfig(){
+        ConfigBuilder builder = ConfigProviderResolver.instance().getBuilder();
+        assertNotNull(builder);
+        builder.addDefaultSources();
+        Config config = builder.build();
+        assertNotNull(config);
+        assertTrue(config.getPropertyNames().iterator().hasNext());
+        assertTrue(config.getConfigSources().iterator().hasNext());
+        assertNotNull(config.getValue("java.home", String.class));
+        ConfigSource src = config.getConfigSources().iterator().next();
+        assertNotNull(src);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolverTest.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolverTest.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolverTest.java
new file mode 100644
index 0000000..9b6b554
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderResolverTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.spi.ConfigBuilder;
+import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+import org.junit.Test;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 24.03.17.
+ */
+public class MicroprofileConfigProviderResolverTest {
+
+    @Test
+    public void testInstance(){
+        assertNotNull(ConfigProviderResolver.instance());
+    }
+
+    @Test
+    public void testGetBuilder(){
+        assertNotNull(ConfigProviderResolver.instance().getBuilder());
+    }
+
+    @Test
+    public void testGetConfig(){
+        assertNotNull(ConfigProviderResolver.instance().getConfig());
+    }
+
+    @Test
+    public void testGetConfig_CL(){
+        assertNotNull(ConfigProviderResolver.instance().getConfig(ClassLoader.getSystemClassLoader()));
+    }
+
+    @Test
+    public void testRegisterAndReleaseConfig(){
+        ClassLoader cl = new URLClassLoader(new URL[]{});
+        Config emptyConfig = ConfigProviderResolver.instance().getBuilder().build();
+        assertNotNull(emptyConfig);
+        Config cfg = ConfigProviderResolver.instance().getConfig(cl);
+        assertNotNull(cfg);
+        ConfigProviderResolver.instance().registerConfig(emptyConfig, cl);
+        cfg = ConfigProviderResolver.instance().getConfig(cl);
+        assertNotNull(cfg);
+        assertEquals(cfg, emptyConfig);
+        ConfigProviderResolver.instance().releaseConfig(emptyConfig);
+        cfg = ConfigProviderResolver.instance().getConfig(cl);
+        assertNotNull(cfg);
+        assertNotSame(cfg, emptyConfig);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderTest.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderTest.java
new file mode 100644
index 0000000..039145d
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigProviderTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Created by atsticks on 24.03.17.
+ */
+public class MicroprofileConfigProviderTest {
+
+    @Test
+    public void testDefaultConfigAccess(){
+        Config config = ConfigProvider.getConfig();
+        assertNotNull(config);
+        Iterable<String> names = config.getPropertyNames();
+        assertNotNull(names);
+        int count = 0;
+        for(String name:names){
+            count++;
+            System.out.println(count + ": " +name);
+        }
+        assertTrue(ConfigurationProvider.getConfiguration().getProperties().size() <= count);
+    }
+
+    @Test
+    public void testClassloaderAccess(){
+        Config config = ConfigProvider.getConfig(Thread.currentThread().getContextClassLoader());
+        assertNotNull(config);
+        Iterable<String> names = config.getPropertyNames();
+        assertNotNull(names);
+        int count = 0;
+        for(String name:names){
+            count++;
+        }
+        assertTrue(count>0);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigTest.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigTest.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigTest.java
new file mode 100644
index 0000000..1c5375a
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileConfigTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.tamaya.microprofile;
+
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.junit.Test;
+
+import java.util.NoSuchElementException;
+import java.util.Optional;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 24.03.17.
+ */
+public class MicroprofileConfigTest {
+
+    @Test
+    public void testDefaultConfigAccess() {
+        Config config = ConfigProvider.getConfig();
+        Iterable<ConfigSource> sources = config.getConfigSources();
+        int count = 0;
+        for (ConfigSource cs : sources) {
+            count++;
+        }
+        assertEquals(3, count);
+    }
+
+    @Test
+    public void testOptionalAccess(){
+        Config config = ConfigProvider.getConfig();
+        int count = 0;
+        for(String key:config.getPropertyNames()){
+            Optional<String> val = config.getOptionalValue(key, String.class);
+            assertNotNull(val);
+            val = config.getOptionalValue(key + System.currentTimeMillis(), String.class);
+            assertNotNull(val);
+            assertFalse(val.isPresent());
+        }
+    }
+
+    @Test
+    public void testGetValue(){
+        Config config = ConfigProvider.getConfig();
+        int count = 0;
+        for(String key:config.getPropertyNames()){
+            String val = config.getValue(key, String.class);
+            assertNotNull(val);
+        }
+    }
+
+    @Test(expected = NoSuchElementException.class)
+    public void testGetValue_NoValue(){
+        Config config = ConfigProvider.getConfig();
+        config.getValue("fooBar", String.class);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetValue_InvalidType(){
+        Config config = ConfigProvider.getConfig();
+        config.getValue("java.version", Integer.class);
+    }
+
+    @Test
+    public void testEmptySystemProperty(){
+        System.setProperty("my.empty.property", "");
+        Config config = ConfigProvider.getConfig();
+        assertEquals("", config.getValue("my.empty.property", String.class));
+    }
+
+    @Test
+    public void testEmptyConfigProperty(){
+        Config config = ConfigProvider.getConfig();
+        assertEquals("", config.getValue("my.empty.property.in.config.file", String.class));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigArchiveProcessor.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigArchiveProcessor.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigArchiveProcessor.java
new file mode 100644
index 0000000..61cd11c
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigArchiveProcessor.java
@@ -0,0 +1,79 @@
+/*
+ * 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.tamaya.microprofile.tck;
+
+import org.apache.tamaya.core.internal.converters.OptionalConverter;
+import org.apache.tamaya.microprofile.MicroprofileAdapter;
+import org.apache.tamaya.microprofile.MicroprofileConfigProviderResolver;
+import org.apache.tamaya.microprofile.cdi.MicroprofileCDIExtension;
+import org.apache.tamaya.microprofile.converter.BooleanAsIntegerConverterFix;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
+import org.jboss.arquillian.test.spi.TestClass;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+
+import javax.enterprise.inject.spi.Extension;
+import java.io.File;
+
+/**
+ * Adds the whole Config implementation classes and resources to the
+ * Arquillian deployment archive. This is needed to have the container
+ * pick up the beans from within the impl for the TCK tests.
+ *
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class TamayaConfigArchiveProcessor implements ApplicationArchiveProcessor {
+
+    @Override
+    public void process(Archive<?> applicationArchive, TestClass testClass) {
+        if (applicationArchive instanceof WebArchive) {
+            File[] coreLibs = Maven.resolver()
+                    .loadPomFromFile("pom.xml").resolve("org.apache.tamaya:tamaya-core")
+                    .withTransitivity().asFile();
+            File[] apiLibs = Maven.resolver()
+                    .loadPomFromFile("pom.xml").resolve("org.apache.tamaya:tamaya-api")
+                    .withTransitivity().asFile();
+            File[] functionsLib = Maven.resolver()
+                    .loadPomFromFile("pom.xml").resolve("org.apache.tamaya.ext:tamaya-functions")
+                    .withTransitivity().asFile();
+
+            JavaArchive configJar = ShrinkWrap
+                    .create(JavaArchive.class, "tamaya-config-impl.jar")
+                    .addPackage(MicroprofileAdapter.class.getPackage())
+                    .addPackage(MicroprofileCDIExtension.class.getPackage())
+                    .addPackage(BooleanAsIntegerConverterFix.class.getPackage())
+                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+                    .addAsServiceProvider(ConfigProviderResolver.class, MicroprofileConfigProviderResolver.class)
+                    .addAsServiceProvider(PropertyConverter.class, BooleanAsIntegerConverterFix.class)
+                    .addAsServiceProvider(PropertyConverter.class, OptionalConverter.class)
+                    .addAsServiceProvider(Extension.class, MicroprofileCDIExtension.class);
+            ((WebArchive) applicationArchive).addAsLibraries(
+                    configJar)
+                    .addAsLibraries(apiLibs)
+                    .addAsLibraries(coreLibs)
+                    .addAsLibraries(functionsLib);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java
new file mode 100644
index 0000000..9c0dfd3
--- /dev/null
+++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/tck/TamayaConfigExtension.java
@@ -0,0 +1,36 @@
+/*
+ * 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.tamaya.microprofile.tck;
+
+import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+
+/**
+ * Arquillian extension to load Tamaya into Arquillian context.
+ * @author <a href="mailto:anatole@apache.org">Anatole Tresch</a>
+ */
+public class TamayaConfigExtension implements LoadableExtension {
+
+    @Override
+    public void register(ExtensionBuilder extensionBuilder) {
+        extensionBuilder.service(
+                ApplicationArchiveProcessor.class,
+                TamayaConfigArchiveProcessor.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/resources/META-INF/beans.xml b/modules/microprofile/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..adee378
--- /dev/null
+++ b/modules/microprofile/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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 current 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
+
+</beans>
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/resources/META-INF/microprofile-config.properties
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/resources/META-INF/microprofile-config.properties b/modules/microprofile/src/test/resources/META-INF/microprofile-config.properties
new file mode 100644
index 0000000..2e63bf8
--- /dev/null
+++ b/modules/microprofile/src/test/resources/META-INF/microprofile-config.properties
@@ -0,0 +1,105 @@
+#
+# Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
+#
+# See the NOTICES file(s) distributed with this work for additional
+# information regarding copyright ownership.
+#
+# Licensed 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.
+#
+
+my.optional.int.property=1234
+my.optional.string.property=hello
+
+tck.config.test.javaconfig.properties.key1=VALue1
+
+
+tck.config.test.overwritten.in.custompropertyfile.key1=value from microprofile-config.properties
+
+
+tck.config.test.javaconfig.converter.integervalue = 1234
+tck.config.test.javaconfig.converter.integervalue.broken = xxx
+
+tck.config.test.javaconfig.converter.longvalue = 1234567890
+tck.config.test.javaconfig.converter.longvalue.broken = xxx
+
+tck.config.test.javaconfig.converter.floatvalue = 12.34
+tck.config.test.javaconfig.converter.floatvalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.doublevalue = 12.34
+tck.config.test.javaconfig.converter.doublevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.durationvalue = PT15M
+tck.config.test.javaconfig.converter.durationvalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.localtimevalue = 10:37
+tck.config.test.javaconfig.converter.localtimevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.localdatevalue = 2017-12-24
+tck.config.test.javaconfig.converter.localdatevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.localdatetimevalue = 2017-12-24T10:25:30
+tck.config.test.javaconfig.converter.localdatetimevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.offsetdatetimevalue = 2007-12-03T10:15:30+01:00
+tck.config.test.javaconfig.converter.offsetdatetimevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.offsettimevalue = 13:45:30.123456789+02:00
+tck.config.test.javaconfig.converter.offsettimevalue.broken = alfasdf
+
+tck.config.test.javaconfig.converter.instantvalue = 2015-06-02T21:34:33.616Z
+tck.config.test.javaconfig.converter.instantvalue.broken = alfasdf
+
+tck.config.test.javaconfig.configvalue.key1=value1
+
+# test BooleanConverter START
+tck.config.test.javaconfig.configvalue.boolean.true=true
+tck.config.test.javaconfig.configvalue.boolean.true_uppercase=TRUE
+tck.config.test.javaconfig.configvalue.boolean.true_mixedcase=TruE
+tck.config.test.javaconfig.configvalue.boolean.false=false
+
+tck.config.test.javaconfig.configvalue.boolean.one=1
+tck.config.test.javaconfig.configvalue.boolean.zero=0
+tck.config.test.javaconfig.configvalue.boolean.seventeen=17
+
+tck.config.test.javaconfig.configvalue.boolean.yes=yes
+tck.config.test.javaconfig.configvalue.boolean.yes_uppercase=YES
+tck.config.test.javaconfig.configvalue.boolean.yes_mixedcase=Yes
+tck.config.test.javaconfig.configvalue.boolean.no=no
+
+tck.config.test.javaconfig.configvalue.boolean.y=y
+tck.config.test.javaconfig.configvalue.boolean.y_uppercase=Y
+tck.config.test.javaconfig.configvalue.boolean.n=n
+
+tck.config.test.javaconfig.configvalue.boolean.on=on
+tck.config.test.javaconfig.configvalue.boolean.on_uppercase=ON
+tck.config.test.javaconfig.configvalue.boolean.on_mixedcase=oN
+tck.config.test.javaconfig.configvalue.boolean.off=off
+
+# test BooleanConverter END
+
+# various other converter
+tck.config.test.javaconfig.configvalue.integer=1234
+tck.config.test.javaconfig.configvalue.long=1234567890123456
+tck.config.test.javaconfig.configvalue.float=12.34
+tck.config.test.javaconfig.configvalue.double=12.34567890123456
+
+# Custom Converter tests
+tck.config.test.javaconfig.converter.duckname=Hannelore
+
+# URL Converter tests
+tck.config.test.javaconfig.converter.urlvalue=http://microprofile.io
+tck.config.test.javaconfig.converter.urlvalue.broken=tt:--location$
+
+# Empty values
+my.empty.property.in.config.file=
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/modules/microprofile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
new file mode 100644
index 0000000..b2af25c
--- /dev/null
+++ b/modules/microprofile/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+org.apache.tamaya.microprofile.tck.TamayaConfigExtension
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/resources/sampleconfig.yaml
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/resources/sampleconfig.yaml b/modules/microprofile/src/test/resources/sampleconfig.yaml
new file mode 100644
index 0000000..27f2392
--- /dev/null
+++ b/modules/microprofile/src/test/resources/sampleconfig.yaml
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2016-2017 Mark Struberg and others
+#
+# Licensed 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.
+#
+# just needed as a trigger for the ConfigSource pickup.
+# Content is hardcoded in SampleYamlConfigSource
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/microprofile/src/test/tck-suite.xml
----------------------------------------------------------------------
diff --git a/modules/microprofile/src/test/tck-suite.xml b/modules/microprofile/src/test/tck-suite.xml
new file mode 100644
index 0000000..84d36ad
--- /dev/null
+++ b/modules/microprofile/src/test/tck-suite.xml
@@ -0,0 +1,27 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<!--
+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 current 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.
+-->
+<suite name="microprofile-config-TCK" verbose="2" configfailurepolicy="continue" >
+        <test name="microprofile-config 1.1 TCK">
+            <packages>
+                <package name="org.eclipse.microprofile.config.tck.*">
+                </package>
+            </packages>
+        </test>
+</suite>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/osgi/common/bnd.bnd b/modules/osgi/common/bnd.bnd
new file mode 100644
index 0000000..e937379
--- /dev/null
+++ b/modules/osgi/common/bnd.bnd
@@ -0,0 +1,33 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - OSGI ConfigurationPlugin
+Bundle-SymbolicName: org.apache.tamaya.osgi
+Bundle-Description: Apacha Tamaya Configuration - OSGI ConfigurationPlugin
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Bundle-Activator: org.apache.tamaya.osgi.Activator
+Export-Package: \
+	org.apache.tamaya.osgi,\
+	org.apache.tamaya.osgi.commands
+Import-Package: \
+    org.osgi.framework,\
+    org.osgi.service.cm,\
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.apache.tamaya.functions,\
+    org.apache.tamaya.spisupport
+Export-Service:   org.apache.tamaya.osgi.commands.TamayaConfigService

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/common/pom.xml b/modules/osgi/common/pom.xml
new file mode 100644
index 0000000..622907b
--- /dev/null
+++ b/modules/osgi/common/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-osgi</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tamaya :: OSGi :: Common</name>
+    <description>Tamaya Based OSGI Common Functionality</description>
+
+    <properties>
+        <osgi.config.version>1.5.0</osgi.config.version>
+        <osgi.tracker.version>1.5.1</osgi.tracker.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.util.tracker</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-api</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-functions</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-spisupport</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <!-- Testing -->
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java
new file mode 100644
index 0000000..aef323d
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Activator.java
@@ -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.
+ */
+package org.apache.tamaya.osgi;
+
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.*;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationPlugin;
+import org.osgi.service.component.annotations.Reference;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.logging.Logger;
+
+/**
+ * Activator that registers the Tamaya based Service Class for {@link ConfigurationAdmin},
+ * using a default service priority of {@code 0}. This behaviour is configurable based on OSGI properties:
+ * <ul>
+ *     <li><p><b>org.tamaya.integration.osgi.cm.ranking, type: int</b> allows to configure the OSGI service ranking for
+ *     Tamaya based ConfigurationAdmin instance. The default ranking used is 10.</p></li>
+ *     <li><p><b>org.tamaya.integration.osgi.cm.override, type: boolean</b> allows to configure if Tamaya should
+ *     register its ConfigAdmin service. Default is true.</p></li>
+ * </ul>
+ */
+public class Activator implements BundleActivator {
+
+    private static final Integer DEFAULT_RANKING = 100000;
+
+    private static final Logger LOG = Logger.getLogger(Activator.class.getName());
+
+    private ServiceRegistration<TamayaConfigService> registration;
+
+    private TamayaConfigPlugin plugin;
+
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        ServiceReference<ConfigurationAdmin> cmRef = context.getServiceReference(ConfigurationAdmin.class);
+        ConfigurationAdmin cm = context.getService(cmRef);
+        Configuration configuration = cm.getConfiguration(TamayaConfigPlugin.COMPONENTID, null);
+        this.plugin = new TamayaConfigPlugin(context);
+        Dictionary<String, Object> props = new Hashtable<>();
+        props.put(Constants.SERVICE_RANKING, DEFAULT_RANKING);
+        LOG.info("Registering Tamaya OSGI Config Service...");
+        registration = context.registerService(
+                TamayaConfigService.class,
+                this.plugin, props);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        if (registration != null) {
+            registration.unregister();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Backups.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Backups.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Backups.java
new file mode 100644
index 0000000..0ae1048
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Backups.java
@@ -0,0 +1,157 @@
+/*
+ * 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.tamaya.osgi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Singleton class to store OSGI configuration backups before change the OSGI
+ * Config with Tamaya settings. This allows to restore the configuration in
+ * case of issues.
+ */
+final class Backups {
+
+    private static final Logger LOG = Logger.getLogger(Backups.class.getName());
+    public static final String TAMAYA_BACKUP = "tamaya.backup";
+    private static Map<String, Hashtable<String,?>> initialConfigState = new ConcurrentHashMap<>();
+
+    private Backups(){}
+
+    /**
+     * Sets the given backup for a PID.
+     * @param pid the PID, not null.
+     * @param config the config to store.
+     */
+    public static void set(String pid, Dictionary<String,?> config){
+        initialConfigState.put(pid, toHashtable(config));
+    }
+
+    /**
+     * Converts the dictionary to a hash table to enabled serialization.
+     * @param dictionary he config, not null.
+     * @return the correspoinding Hashtable
+     */
+    private static Hashtable<String, ?> toHashtable(Dictionary<String, ?> dictionary) {
+        if (dictionary == null) {
+            return null;
+        }
+        if(dictionary instanceof Hashtable){
+            return (Hashtable) dictionary;
+        }
+        Hashtable<String, Object> map = new Hashtable<>(dictionary.size());
+        Enumeration<String> keys = dictionary.keys();
+        while (keys.hasMoreElements()) {
+            String key = keys.nextElement();
+            map.put(key, dictionary.get(key));
+        }
+        return map;
+    }
+
+    /**
+     * Removes a backup.
+     * @param pid the PID, not null.
+     * @return
+     */
+    public static Dictionary<String,?> remove(String pid){
+        return initialConfigState.remove(pid);
+    }
+
+    /**
+     * Removes all backups.
+     */
+    public static void removeAll(){
+        initialConfigState.clear();
+    }
+
+    /**
+     * Get a backup for a PID.
+     * @param pid the PID, not null.
+     * @return the backup found, or null.
+     */
+    public static Dictionary<String,?> get(String pid){
+        return initialConfigState.get(pid);
+    }
+
+    /**
+     * Get all current stored backups.
+     * @return The backups stored, by PID.
+     */
+    public static Map<String,Dictionary<String,?>> get(){
+        return new HashMap<>(initialConfigState);
+    }
+
+    /**
+     * Get all current kjnown PIDs.
+     * @return the PIDs, never null.
+     */
+    public static Set<String> getPids(){
+        return initialConfigState.keySet();
+    }
+
+    /**
+     * Checks if a backup exists for a given PID.
+     * @param pid the pid, not null.
+     * @return
+     */
+    public static boolean contains(String pid){
+        return initialConfigState.containsKey(pid);
+    }
+
+    /**
+     * Saves the bachups into the given config.
+     * @param config the config, not nul.
+     */
+    public static void save(Dictionary<String,Object> config){
+        try{
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(bos);
+            oos.writeObject(initialConfigState);
+            oos.flush();
+            Base64.getEncoder().encode(bos.toByteArray());
+            config.put(TAMAYA_BACKUP, Base64.getEncoder().encodeToString(bos.toByteArray()));
+        }catch(Exception e){
+            LOG.log(Level.SEVERE, "Failed to restore OSGI Backups.", e);
+        }
+    }
+
+    /**
+     * Restores the backups ino the given config.
+     * @param config the config, not null.
+     */
+    public static void restore(Dictionary<String,Object> config){
+        try{
+            String serialized = (String)config.get("tamaya.backup");
+            if(serialized!=null) {
+                ByteArrayInputStream bis = new ByteArrayInputStream(Base64.getDecoder().decode(serialized));
+                ObjectInputStream ois = new ObjectInputStream(bis);
+                initialConfigState = (Map<String, Hashtable<String,?>>) ois.readObject();
+                ois.close();
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to store getConfig change getHistory.", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java
new file mode 100644
index 0000000..0969a59
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigChanger.java
@@ -0,0 +1,215 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Created by atsticks on 19.09.17.
+ */
+final class ConfigChanger {
+
+    private static final Logger LOG = Logger.getLogger(TamayaConfigPlugin.class.getName());
+
+    private BundleContext context;
+    private ConfigurationAdmin cm;
+
+    public ConfigChanger(BundleContext context){
+        this.context = context;
+        ServiceReference<ConfigurationAdmin> cmRef = context.getServiceReference(ConfigurationAdmin.class);
+        this.cm = context.getService(cmRef);
+    }
+
+    public BundleContext getContext(){
+        return context;
+    }
+
+    public ConfigurationAdmin getConfigurationAdmin(){
+        return cm;
+    }
+
+    public Dictionary<String, Object> configure(String pid, Bundle bundle, Policy policy, boolean opModeExplicit, boolean dryRun) {
+        try {
+            String root = '[' + pid + ']';
+            // TODO Check for Bundle.getLocation() usage here...
+            Configuration osgiConfig = cm.getConfiguration(pid, bundle!=null?bundle.getLocation():null);
+            Policy opMode = Objects.requireNonNull(policy);
+            // Check manifest config
+            if(bundle!=null) {
+                if(!opModeExplicit) {
+                    String opVal = bundle.getHeaders().get(TamayaConfigPlugin.TAMAYA_POLICY_MANIFEST);
+                    if (opVal != null) {
+                        opMode = Policy.valueOf(opVal.toUpperCase());
+                    }
+                }
+                String customRoot = bundle.getHeaders().get(TamayaConfigPlugin.TAMAYA_CUSTOM_ROOT_MANIFEST);
+                if(customRoot!=null){
+                    root = customRoot;
+                }
+            }
+            // Check for dynamic OSGI overrides
+            if(osgiConfig!=null){
+                Dictionary<String,Object> props = osgiConfig.getProperties();
+                if(props!=null){
+                    if(!opModeExplicit) {
+                        String opVal = (String) props.get(TamayaConfigPlugin.TAMAYA_POLICY_PROP);
+                        if (opVal != null) {
+                            opMode = Policy.valueOf(opVal.toUpperCase());
+                        }
+                    }
+                    String customRoot = (String)props.get(TamayaConfigPlugin.TAMAYA_CUSTOM_ROOT_PROP);
+                    if(customRoot!=null){
+                        root = customRoot;
+                    }
+                }else{
+                    props = new Hashtable<>();
+                }
+                if(!dryRun && !Backups.contains(pid)){
+                    Backups.set(pid, props);
+                    LOG.finest("Stored OSGI configuration backup for PID: " + pid);
+                }
+                LOG.finest("Evaluating Tamaya Config for PID: " + pid);
+                org.apache.tamaya.Configuration tamayaConfig = getTamayaConfiguration(root);
+                if (tamayaConfig == null) {
+                    LOG.finest("No Tamaya configuration for root: " + root);
+                }else {
+                    if(dryRun){
+                        modifyConfiguration(pid, tamayaConfig, props, opMode);
+                    }else {
+                        try {
+                            if (bundle != null) {
+                                ConfigHistory.configuring(pid, "bundle=" + bundle.getSymbolicName() + ", opMode=" + opMode);
+                            } else {
+                                ConfigHistory.configuring(pid, "trigger=Tamaya, opMode=" + opMode);
+                            }
+                            modifyConfiguration(pid, tamayaConfig, props, opMode);
+                            if (!props.isEmpty()) {
+                                osgiConfig.update(props);
+                                LOG.info("Updated configuration for PID: " + pid + ": " + props);
+                                ConfigHistory.configured(pid, "SUCCESS");
+                            }
+                        }catch(Exception e){
+                            LOG.log(Level.WARNING, "Failed to update configuration for PID: " + pid, e);
+                            ConfigHistory.configured(pid, "FAILED: " + e);
+                        }
+                    }
+                }
+                return props;
+            }
+            return null;
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to initialize configuration for PID: " + pid, e);
+            return null;
+        }
+    }
+
+    public void modifyConfiguration(String pid, org.apache.tamaya.Configuration config, Dictionary<String, Object> dictionary, Policy opMode) {
+        LOG.info(() -> "Updating configuration for PID: " + pid + "...");
+        dictionary.put("tamaya.modified.at", new Date().toString());
+
+        Map<String, Object> dictionaryMap = new HashMap<>();
+        Enumeration<String> keys = dictionary.keys();
+        while (keys.hasMoreElements()) {
+            String key = keys.nextElement();
+            Object value = dictionary.get(key);
+            dictionaryMap.put(key, value);
+        }
+        for (Map.Entry<String, Object> dictEntry : dictionaryMap.entrySet()) {
+            Object configuredValue = config.getOrDefault(dictEntry.getKey(), dictEntry.getValue().getClass(), null);
+            if (configuredValue != null) {
+                if(configuredValue.equals(dictEntry.getValue())){
+                    continue;
+                }
+                switch (opMode) {
+                    case EXTEND:
+                        break;
+                    case OVERRIDE:
+                        LOG.info(() -> "Setting key " + dictEntry.getKey() + " to " + configuredValue);
+                        ConfigHistory.propertySet(pid,dictEntry.getKey(), configuredValue, dictEntry.getValue());
+                        dictionary.put(dictEntry.getKey(), configuredValue);
+                        break;
+                    case UPDATE_ONLY:
+                        LOG.info(() -> "Setting key " + dictEntry.getKey() + " to " + configuredValue);
+                        ConfigHistory.propertySet(pid,dictEntry.getKey(), configuredValue, dictEntry.getValue());
+                        dictionary.put(dictEntry.getKey(), configuredValue);
+                }
+            }
+        }
+        for (Map.Entry<String, String> configEntry : config.getProperties().entrySet()) {
+            Object dictValue = dictionary.get(configEntry.getKey());
+            if(dictValue!=null && dictValue.equals(configEntry.getValue())){
+                continue;
+            }
+            switch (opMode) {
+                case EXTEND:
+                    if(dictValue==null){
+                        LOG.info(() -> "Setting key " + configEntry.getKey() + " to " + configEntry.getValue());
+                        ConfigHistory.propertySet(pid,configEntry.getKey(), configEntry.getValue(), null);
+                        dictionary.put(configEntry.getKey(), configEntry.getValue());
+                    }
+                    break;
+                case OVERRIDE:
+                    LOG.info(() -> "Setting key " + configEntry.getKey() + " to " + configEntry.getValue());
+                    ConfigHistory.propertySet(pid,configEntry.getKey(), configEntry.getValue(), null);
+                    dictionary.put(configEntry.getKey(), configEntry.getValue());
+                    break;
+                case UPDATE_ONLY:
+                    if(dictValue!=null){
+                        LOG.info(() -> "Setting key " + configEntry.getKey() + " to " + configEntry.getValue());
+                        ConfigHistory.propertySet(pid,configEntry.getKey(), configEntry.getValue(), dictValue);
+                        dictionary.put(configEntry.getKey(), configEntry.getValue());
+                    }
+                    break;
+            }
+        }
+    }
+
+    public org.apache.tamaya.Configuration getTamayaConfiguration(String root) {
+        if (root != null) {
+            return ConfigurationProvider.getConfiguration()
+                    .with(ConfigurationFunctions.section(root, true));
+        }
+        return null;
+    }
+
+    public void restoreBackup(String pid, Dictionary<String, Object> config)throws IOException{
+        Configuration osgiConfig = cm.getConfiguration(pid);
+        if(osgiConfig!=null){
+            config.put(TamayaConfigPlugin.TAMAYA_ENABLED_PROP, "false");
+            osgiConfig.update(Objects.requireNonNull(config));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java
new file mode 100644
index 0000000..dc41787
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java
@@ -0,0 +1,268 @@
+/*
+ * 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.tamaya.osgi;
+
+import java.io.*;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Class storing the history of changers done to the OSGI configuration by Tamaya.
+ * This class can be used in the future to restore the previous state, if needed.
+ */
+public final class ConfigHistory implements Serializable{
+
+    private static final long serialVersionUID = 1L;
+    private static final Logger LOG = Logger.getLogger(ConfigHistory.class.getName());
+    /** The key of the plugin OSGI configuration, where the history is stored/retrieved. */
+    private static final String HISTORY_KEY = "tamaya.history";
+
+    public enum TaskType{
+        PROPERTY,
+        BEGIN,
+        END,
+    }
+    /** The max number of changes tracked. */
+    private static int maxHistory = 10000;
+    /** The overall history. */
+    private static List<ConfigHistory> history = new LinkedList<ConfigHistory>();
+
+    /** The entry timestamp. */
+    private long timestamp = System.currentTimeMillis();
+    /** The entry type. */
+    private TaskType type;
+    /** The previous value. */
+    private Object previousValue;
+    /** The current value. */
+    private Object value;
+    /** The key. */
+    private String key;
+    /** The target PID. */
+    private String pid;
+
+    private ConfigHistory(TaskType taskType, String pid){
+        this.type = Objects.requireNonNull(taskType);
+        this.pid = Objects.requireNonNull(pid);
+    }
+
+    /**
+     * Creates and registers an entry when starting to configure a bundle.
+     * @param pid the PID
+     * @param info any info.
+     * @return the entry, never null.
+     */
+    public static ConfigHistory configuring(String pid, String info){
+        ConfigHistory h = new ConfigHistory(TaskType.BEGIN, pid)
+                .setValue(info);
+        synchronized (history){
+            history.add(h);
+            checkHistorySize();
+        }
+        return h;
+    }
+
+    /**
+     * Creates and registers an entry when finished to configure a bundle.
+     * @param pid the PID
+     * @param info any info.
+     * @return the entry, never null.
+     */
+    public static ConfigHistory configured(String pid, String info){
+        ConfigHistory h = new ConfigHistory(TaskType.END, pid)
+                .setValue(info);
+        synchronized (history){
+            history.add(h);
+            checkHistorySize();
+        }
+        return h;
+    }
+
+    /**
+     * Creates and registers an entry when a property has been changed.
+     * @param pid the PID
+     * @param key the key, not null.
+     * @param previousValue the previous value.
+     * @param value the new value.
+     * @return the entry, never null.
+     */
+    public static ConfigHistory propertySet(String pid, String key, Object value, Object previousValue){
+        ConfigHistory h = new ConfigHistory(TaskType.PROPERTY, pid)
+                .setKey(key)
+                .setPreviousValue(previousValue)
+                .setValue(value);
+        synchronized (history){
+            history.add(h);
+            checkHistorySize();
+        }
+        return h;
+    }
+
+    /**
+     * Sets the maximum history size.
+     * @param maxHistory the size
+     */
+    static void setMaxHistory(int maxHistory){
+        ConfigHistory.maxHistory = maxHistory;
+    }
+
+    /**
+     * Get the max history size.
+     * @return the max size
+     */
+    static int getMaxHistory(){
+        return maxHistory;
+    }
+
+    /**
+     * Access the current history.
+     * @return the current history, never null.
+     */
+    static List<ConfigHistory> getHistory(){
+        return getHistory(null);
+    }
+
+    /**
+     * Clears the history.
+     */
+    static void clearHistory(){
+        clearHistory(null);
+    }
+
+    /**
+     * Clears the history for a PID.
+     * @param pid the pid, null clears the full history.
+     */
+    static void clearHistory(String pid){
+        synchronized (history){
+            if("*".equals(pid)) {
+                history.clear();
+            }else{
+                history.removeAll(getHistory(pid));
+            }
+        }
+    }
+
+    /**
+     * Get the history for a PID.
+     * @param pid the pid, null returns the full history.
+     * @return
+     */
+    public static List<ConfigHistory> getHistory(String pid) {
+        if(pid==null || pid.isEmpty()){
+            return new ArrayList<>(history);
+        }
+        synchronized (history) {
+            List<ConfigHistory> result = new ArrayList<>();
+            for (ConfigHistory h : history) {
+                if (h.getPid().startsWith(pid)) {
+                    result.add(h);
+                }
+            }
+            return result;
+        }
+    }
+
+    public TaskType getType(){
+        return type;
+    }
+
+    public String getPid() {
+        return pid;
+    }
+
+    public Object getPreviousValue() {
+        return previousValue;
+    }
+
+    public ConfigHistory setPreviousValue(Object previousValue) {
+        this.previousValue = previousValue;
+        return this;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public ConfigHistory setValue(Object value) {
+        this.value = value;
+        return this;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public ConfigHistory setKey(String key) {
+        this.key = key;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return "ConfigHistory{" +
+                "timestamp=" + timestamp +
+                ", previousValue=" + previousValue +
+                ", value=" + value +
+                ", key='" + key + '\'' +
+                '}';
+    }
+
+
+    /**
+     * This methd saves the (serialized) history in the plugin's OSGI configuration using
+     * the HISTORY_KEY key.
+     * @param osgiConfig the plugin config, not null.
+     */
+    static void save(Dictionary<String,Object> osgiConfig){
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(bos);
+            oos.writeObject(history);
+            oos.flush();
+            osgiConfig.put(HISTORY_KEY, Base64.getEncoder().encodeToString(bos.toByteArray()));
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to store getConfig change history.", e);
+        }
+    }
+
+    /**
+     * Restores the history from the plugin's OSGI configuration.
+     * @param osgiConfig
+     */
+    static void restore(Dictionary<String,Object> osgiConfig){
+        try{
+            String serialized = (String)osgiConfig.get(HISTORY_KEY);
+            if(serialized!=null) {
+                ByteArrayInputStream bis = new ByteArrayInputStream(Base64.getDecoder().decode(serialized));
+                ObjectInputStream ois = new ObjectInputStream(bis);
+                ConfigHistory.history = (List<ConfigHistory>) ois.readObject();
+                ois.close();
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Failed to store getConfig change history.", e);
+        }
+    }
+
+    private static void checkHistorySize(){
+        while(history.size() > maxHistory){
+            history.remove(0);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Policy.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Policy.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Policy.java
new file mode 100644
index 0000000..f19c2d1
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/Policy.java
@@ -0,0 +1,31 @@
+/*
+ * 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.tamaya.osgi;
+
+/**
+ * Operation mode applied to the getConfig read.
+ */
+public enum Policy {
+    /** Only add properties not existing in the getConfig. */
+    EXTEND,
+    /** Override existing properties and add new properties. */
+    OVERRIDE,
+    /** Override existing properties only. */
+    UPDATE_ONLY
+}
\ No newline at end of file


[5/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java
new file mode 100644
index 0000000..e095b14
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java
@@ -0,0 +1,444 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.*;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Tamaya plugin that updates/extends the component configurations managed
+ * by {@link ConfigurationAdmin}, based on the configured {@link Policy}.
+ */
+public class TamayaConfigPlugin implements TamayaConfigService,BundleListener, ServiceListener{
+    static final String COMPONENTID = "TamayaConfigPlugin";
+    /** the logger. */
+    private static final Logger LOG = Logger.getLogger(TamayaConfigPlugin.class.getName());
+
+    public static final String TAMAYA_POLICY_PROP = "tamaya-policy";
+    public static final String TAMAYA_POLICY_MANIFEST = "Tamaya-Policy";
+    public static final String TAMAYA_CUSTOM_ROOT_PROP = "tamaya-config-root";
+    public static final String TAMAYA_CUSTOM_ROOT_MANIFEST = "Tamaya-Config-Root";
+    public static final String TAMAYA_ENABLED_PROP = "tamaya-enabled";
+    public static final String TAMAYA_ENABLED_MANIFEST = "Tamaya-Enabled";
+    public static final String TAMAYA_AUTO_UPDATE_ENABLED_PROP = "tamaya-update-enabled";
+    public static final String TAMAYA_AUTO_UPDATE_ENABLED_MANIFEST = "Tamaya-Update-Enabled";
+    private boolean enabledByDefault = false;
+
+    private Policy defaultPolicy = Policy.OVERRIDE;
+
+    private ConfigChanger configChanger;
+    private boolean autoUpdateEnabled;
+
+    @Override
+    public void serviceChanged(ServiceEvent event) {
+        switch(event.getType()){
+            case ServiceEvent.REGISTERED:
+            case ServiceEvent.MODIFIED:
+                configureService(event);
+                break;
+            case ServiceEvent.UNREGISTERING:
+                // unconfigure...? Currently nothing here.
+                break;
+        }
+    }
+
+
+    /**
+     * Create a new getConfig.
+     * @param context the OSGI context
+     */
+    public TamayaConfigPlugin(BundleContext context) {
+        configChanger = new ConfigChanger(context);
+        Dictionary<String,Object> props = getPluginConfig();
+        Backups.restore(props);
+        ConfigHistory.restore(props);
+        initDefaultEnabled(props);
+        initAutoUpdateEnabled(props);
+        initDefaultOpMode(props);
+        initConfigs();
+    }
+
+    @Override
+    public void setAutoUpdateEnabled(boolean enabled){
+        this.autoUpdateEnabled = enabled;
+        setConfigValue(TAMAYA_AUTO_UPDATE_ENABLED_PROP, enabled);
+    }
+
+    @Override
+    public void setTamayaEnabledByDefault(boolean enabledByDefault){
+        this.enabledByDefault = enabledByDefault;
+        setConfigValue(TAMAYA_ENABLED_PROP, enabledByDefault);
+    }
+
+    @Override
+    public boolean isTamayaEnabledByDefault(){
+        return enabledByDefault;
+    }
+
+    @Override
+    public Policy getDefaultPolicy(){
+        return defaultPolicy;
+    }
+
+    @Override
+    public void setDefaultPolicy(Policy mode){
+        this.defaultPolicy = Objects.requireNonNull(mode);
+        setConfigValue(Policy.class.getSimpleName(), defaultPolicy.toString());
+    }
+
+    @Override
+    public void bundleChanged(BundleEvent event) {
+        switch(event.getType()){
+            case BundleEvent.STARTING:
+            case BundleEvent.LAZY_ACTIVATION:
+                configureBundle(event.getBundle());
+                break;
+        }
+    }
+
+    private void initConfigs() {
+        // Check for matching bundles already installed...
+        for(Bundle bundle:configChanger.getContext().getBundles()){
+            switch(bundle.getState()){
+                case Bundle.ACTIVE:
+                    configureBundle(bundle);
+                    break;
+            }
+        }
+    }
+
+    private void configureService(ServiceEvent event) {
+        // Optional MANIFEST entries
+        Bundle bundle = event.getServiceReference().getBundle();
+        if(!isBundleEnabled(bundle)){
+            return;
+        }
+        String pid = (String)event.getServiceReference().getProperty(Constants.SERVICE_PID);
+        if(pid==null){
+            LOG.finest("No service pid for: " + event.getServiceReference());
+            return;
+        }
+        configChanger.configure(pid, event.getServiceReference().getBundle(), defaultPolicy, false, false);
+        Dictionary<String,Object> props = getPluginConfig();
+        Backups.save(props);
+        ConfigHistory.save(props);
+        setPluginConfig(props);
+    }
+
+    @Override
+    public Dictionary<String,Object> updateConfig(String pid) {
+        return updateConfig(pid, defaultPolicy, false, false);
+    }
+
+    @Override
+    public Dictionary<String,Object> updateConfig(String pid, boolean dryRun) {
+        return updateConfig(pid, defaultPolicy, false, dryRun);
+    }
+
+    @Override
+    public Dictionary<String,Object> updateConfig(String pid, Policy opMode, boolean explicitMode, boolean dryRun) {
+        if(dryRun){
+            return configChanger.configure(pid, null, opMode, explicitMode, true);
+        }else {
+            LOG.fine("Updating getConfig for pid...: " + pid);
+            Dictionary<String,Object> result = configChanger.configure(pid, null, opMode, explicitMode, false);
+            Dictionary<String,Object> props = getPluginConfig();
+            Backups.save(props);
+            ConfigHistory.save(props);
+            setPluginConfig(props);
+            return result;
+        }
+    }
+
+    private void configureBundle(Bundle bundle) {
+        if(!isBundleEnabled(bundle)){
+            return;
+        }
+        String tamayaPid = bundle.getHeaders().get(TAMAYA_CUSTOM_ROOT_MANIFEST);
+        String pid = tamayaPid!=null?tamayaPid:bundle.getSymbolicName();
+        if(pid==null){
+            pid = bundle.getLocation();
+        }
+        if(pid==null){
+            LOG.finest(() -> "No PID/location for bundle " + bundle.getSymbolicName() + '('+bundle.getBundleId()+')');
+            return;
+        }
+        configChanger.configure(pid, bundle, defaultPolicy, false, false);
+        Dictionary<String,Object> props = getPluginConfig();
+        Backups.save(props);
+        ConfigHistory.save(props);
+        setPluginConfig(props);
+    }
+
+    @Override
+    public boolean isBundleEnabled(Bundle bundle){
+        // Optional MANIFEST entries
+        String bundleEnabledVal = bundle.getHeaders().get(TAMAYA_ENABLED_MANIFEST);
+        if(bundleEnabledVal==null && !enabledByDefault){
+            LOG.finest("tamaya.enabled=false: not configuring bundle: " + bundle.getSymbolicName());
+            return false;
+        }
+        if(bundleEnabledVal != null && !Boolean.parseBoolean(bundleEnabledVal)){
+            LOG.finest("Bundle is explcitly disabled for Tamaya: " + bundle.getSymbolicName());
+            return false;
+        }
+        if(bundleEnabledVal != null && Boolean.parseBoolean(bundleEnabledVal)){
+            LOG.finest("Bundle is explicitly enabled for Tamaya: " + bundle.getSymbolicName());
+            return true;
+        }
+        return true;
+    }
+
+    private boolean isAutoUpdateEnabled(Bundle bundle, Dictionary<String,Object> props) {
+        Object enabledVal = props.get(TAMAYA_AUTO_UPDATE_ENABLED_PROP);
+        if(enabledVal!=null){
+            return Boolean.parseBoolean(enabledVal.toString());
+        }
+        if(bundle!=null){
+            enabledVal = bundle.getHeaders().get(TAMAYA_AUTO_UPDATE_ENABLED_MANIFEST);
+            if(enabledVal!=null){
+                return Boolean.parseBoolean(enabledVal.toString());
+            }
+        }
+        return this.autoUpdateEnabled;
+    }
+
+    private void initAutoUpdateEnabled(Dictionary<String,Object> props) {
+        Object enabledVal = props.get(TAMAYA_AUTO_UPDATE_ENABLED_PROP);
+        if(enabledVal==null && System.getProperty(TAMAYA_AUTO_UPDATE_ENABLED_PROP)!=null){
+            enabledVal = Boolean.parseBoolean(System.getProperty(TAMAYA_AUTO_UPDATE_ENABLED_PROP));
+        }
+        if(enabledVal!=null){
+            this.autoUpdateEnabled = Boolean.parseBoolean(enabledVal.toString());
+        }
+        if(this.autoUpdateEnabled) {
+            LOG.info("Tamaya Automatic Config Update is enabled by default.");
+        }else{
+            LOG.info("Tamaya Automatic Config Update is disabled by default.");
+        }
+    }
+
+    private void initDefaultEnabled(Dictionary<String,Object> props) {
+        Object enabledVal = props.get(TAMAYA_ENABLED_PROP);
+        if(enabledVal==null && System.getProperty(TAMAYA_ENABLED_PROP)!=null){
+            enabledVal = Boolean.parseBoolean(System.getProperty(TAMAYA_ENABLED_PROP));
+        }
+        if(enabledVal!=null){
+            this.enabledByDefault = Boolean.parseBoolean(enabledVal.toString());
+        }
+        if(this.enabledByDefault) {
+            LOG.info("Tamaya Config is enabledByDefault by default. Add Tamaya-Enabled to your bundle manifests to enable it.");
+        }else{
+            LOG.info("Tamaya Config is enabled by default. Add Tamaya-Disabled to your bundle manifests to disable it.");
+        }
+    }
+
+    private void initDefaultOpMode(Dictionary<String,Object> props) {
+        String opVal = (String)props.get(Policy.class.getSimpleName());
+        if(opVal!=null){
+            try{
+                defaultPolicy = Policy.valueOf(opVal);
+            }catch(Exception e){
+                LOG.warning("Invalid Policy: " + opVal +", using default: " + defaultPolicy);
+            }
+        }
+    }
+
+    Dictionary<String, Object> getPluginConfig(){
+        Configuration config = null;
+        try {
+            config = configChanger.getConfigurationAdmin().getConfiguration(COMPONENTID);
+            Dictionary<String, Object> props = null;
+            if (config != null
+                    && config.getProperties() != null) {
+                props = config.getProperties();
+            } else {
+                props = new Hashtable<String, Object>();
+            }
+            return props;
+        } catch (IOException e) {
+            throw new IllegalStateException("No Tamaya plugin config.", e);
+        }
+    }
+
+    void setPluginConfig(Dictionary<String, Object> props){
+        Configuration config = null;
+        try {
+            config = configChanger.getConfigurationAdmin().getConfiguration(COMPONENTID);
+            if (config != null) {
+                config.update(props);
+            }
+        } catch (IOException e) {
+            LOG.log(Level.WARNING, "Failed to write Tamaya plugin config.", e);
+        }
+    }
+
+    void setConfigValue(String key, Object value){
+        try {
+            Dictionary<String, Object> props = getPluginConfig();
+            if(props!=null) {
+                props.put(key, value);
+                setPluginConfig(props);
+                LOG.finest("Updated Tamaya Plugin value: " + key + "=" + value);
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Error writing Tamaya config value: " + key, e);
+        }
+    }
+
+    Object getConfigValue(String key){
+        try {
+            Dictionary<String, Object> props = getPluginConfig();
+            if(props!=null){
+                return props.get(key);
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Error reading Tamaya config value.", e);
+        }
+        return null;
+    }
+
+
+    public org.apache.tamaya.Configuration getTamayaConfiguration(String root) {
+        return configChanger.getTamayaConfiguration(root);
+    }
+
+    @Override
+    public boolean isAutoUpdateEnabled() {
+        return this.autoUpdateEnabled;
+    }
+
+    @Override
+    public Dictionary<String, ?> getBackup(String pid) {
+        return Backups.get(pid);
+    }
+
+    @Override
+    public Set<String> getBackupPids() {
+        return Backups.getPids();
+    }
+
+    @Override
+    public boolean restoreBackup(String pid){
+        Dictionary<String,Object> config = (Dictionary<String,Object>) Backups.get(pid);
+        if(config==null){
+            return false;
+        }
+        try {
+            this.configChanger.restoreBackup(pid, config);
+            return true;
+        } catch (IOException e) {
+            LOG.log(Level.WARNING, "Error restoring backup for PID: " + pid, e);
+            return false;
+        }
+    }
+
+    @Override
+    public boolean createBackup(String pid) {
+        if(!Backups.contains(pid)) {
+            Backups.set(pid, getOSGIConfiguration(pid, null));
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean deleteBackup(String pid) {
+        if(Backups.contains(pid)) {
+            Backups.remove(pid);
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public void setMaxHistorySize(int maxHistory) {
+        ConfigHistory.setMaxHistory(maxHistory);
+    }
+
+    @Override
+    public int getMaxHistorySize() {
+        return ConfigHistory.getMaxHistory();
+    }
+
+    @Override
+    public List<ConfigHistory> getHistory() {
+        return ConfigHistory.getHistory();
+    }
+
+    @Override
+    public void clearHistory() {
+        ConfigHistory.clearHistory();
+    }
+
+    @Override
+    public void clearHistory(String pid) {
+        ConfigHistory.clearHistory(pid);
+    }
+
+    @Override
+    public List<ConfigHistory> getHistory(String pid) {
+        return ConfigHistory.getHistory(pid);
+    }
+
+    @Override
+    public Dictionary<String, Object> getOSGIConfiguration(String pid, String section) {
+        try {
+            Configuration config = configChanger.getConfigurationAdmin().getConfiguration(pid);
+            Dictionary<String, Object> props = null;
+            if (config == null
+                    || config.getProperties() == null) {
+                return null;
+            }
+            props = config.getProperties();
+            if(section!=null){
+                return filter(props, section);
+            }
+            return props;
+        } catch (IOException e) {
+            LOG.log(Level.WARNING, "Error reading OSGI config for PID: " + pid, e);
+            return null;
+        }
+    }
+
+    @Override
+    public boolean containsBackup(String pid) {
+        return Backups.contains(pid);
+    }
+
+    private Dictionary<String, Object> filter(Dictionary<String, Object> props, String section) {
+        Hashtable<String, Object> result = new Hashtable<>();
+        Enumeration<String> keys = props.keys();
+        while(keys.hasMoreElements()){
+            String key = keys.nextElement();
+            if(key.startsWith(section)){
+                result.put(key, props.get(key));
+            }
+        }
+        return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/BackupCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/BackupCommands.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/BackupCommands.java
new file mode 100644
index 0000000..d8734f7
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/BackupCommands.java
@@ -0,0 +1,135 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+
+/**
+ * Utility class implementing the available backup related commands.
+ */
+public final class BackupCommands {
+
+    /** Singleton constructor. */
+    private BackupCommands(){}
+
+    public static String createBackup(TamayaConfigService service, ConfigurationAdmin cm, String pid, boolean force) throws IOException {
+        Configuration cfg = cm.getConfiguration(pid);
+        if(cfg!=null){
+            Dictionary<String,?> props = cfg.getProperties();
+            if(props!=null){
+                if(force && service.getBackup(pid)!=null) {
+                    service.deleteBackup(pid);
+                }
+                if(service.createBackup(pid)){
+                    return "Backup created, PID = " + pid + '\n' +  printProps(props);
+                }else{
+                    return "Creating backup failed. Backup already existing, PID = " + pid;
+                }
+            }
+        }
+        return "Creating backup failed. No Config found, PID = " + pid;
+    }
+
+    public static String deleteBackup(TamayaConfigService service, String pid) throws IOException {
+        if("*".equals(pid)){
+            for(String current: service.getBackupPids()){
+                service.deleteBackup(current);
+            }
+            return "All Backups deleted.";
+        }else {
+            service.deleteBackup(pid);
+            return "Backup deleted: " + pid;
+        }
+    }
+
+    public static String restoreBackup(TamayaConfigService plugin, String pid) throws IOException {
+        StringBuilder b = new StringBuilder("Restored Configurations:\n")
+                .append("------------------------\n");
+        if("*".equals(pid)){
+            for(String current: plugin.getBackupPids()){
+                try{
+                    if(plugin.restoreBackup(current)){
+                        b.append(current).append(" -> restored.\n");
+                    }else{
+                        b.append(current).append(" -> no backup found.\n");
+                    }
+                }catch(Exception e){
+                    b.append(current).append(" -> failed: ").append(e).append('\n');
+                }
+            }
+            return b.toString();
+        }else {
+            try{
+                if(plugin.restoreBackup(pid)){
+                    return "Backup restored for PID: "+pid+"\n";
+                }else{
+                    return "Backup restore failed for PID "+pid+": no backup found.\n";
+                }
+            }catch(Exception e){
+                return "Backup restore failed for PID "+pid+", error: " + e + '\n';
+            }
+        }
+    }
+
+    public static String listBackup(TamayaConfigService plugin, String pid) throws IOException {
+        if(pid!=null){
+            Dictionary<String, ?> props = plugin.getBackup(pid);
+            if(props==null){
+                return "No backup found: " + pid;
+            }else{
+                return "PID: " + pid + '\n' +
+                        printProps(props);
+            }
+        }else {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            for(String current: plugin.getBackupPids()){
+                pw.println("PID: " + current);
+                pw.println(printProps(plugin.getBackup(current)));
+            }
+            return sw.toString();
+        }
+    }
+
+    public static String printProps(Dictionary<String, ?> props) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        pw.println(StringUtil.format("  Key", 50));
+        pw.println(StringUtil.format("  Value", 50));
+        pw.println("  " + StringUtil.printRepeat("-", 100));
+        Enumeration<String> keys = props.keys();
+        while(keys.hasMoreElements()){
+            String key = keys.nextElement();
+            pw.print("  " + StringUtil.format(key, 50));
+            pw.println("  " + StringUtil.format(String.valueOf(props.get(key)), 50));
+        }
+        pw.println();
+        pw.flush();
+        return sw.toString();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/ConfigCommands.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/ConfigCommands.java
new file mode 100644
index 0000000..cccbf9d
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/ConfigCommands.java
@@ -0,0 +1,245 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.functions.ConfigurationFunctions;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.*;
+
+/**
+ * Utility class implementing the available configuration related commands.
+ */
+public final class ConfigCommands {
+
+    /** Singleton constructor. */
+    private ConfigCommands(){}
+
+    public static String getInfo(TamayaConfigService configPlugin) throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        return config.toString() + "\n\n"
+                + StringUtil.format("Default Policy:", 30) + configPlugin.getDefaultPolicy() + '\n'
+                + StringUtil.format("Default Enabled: ", 30) + configPlugin.isTamayaEnabledByDefault();
+    }
+
+    public static String readTamayaConfig(String section, String filter) {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        if(section!=null){
+            config = config
+                    .with(ConfigurationFunctions.section(section, true));
+        }
+        if(filter!=null){
+            config = config.with(ConfigurationFunctions.section(filter, false));
+        }
+        return "Tamaya Configuration\n" +
+                "--------------------\n" +
+                "Section:     "+section +"\n" +
+                (filter!=null?"Filter:      "+filter + "\n":"") +
+                config.query(ConfigurationFunctions.textInfo());
+    }
+
+    public static String readTamayaConfig4PID(String pid, String filter) {
+        return readTamayaConfig("["+pid+"]", filter);
+    }
+
+    public static String applyTamayaConfiguration(TamayaConfigService configPlugin, String pid, String operationMode, boolean dryRun){
+        Dictionary<String,Object> config = null;
+        if(operationMode!=null){
+            config = configPlugin.updateConfig(pid, Policy.valueOf(operationMode), true, dryRun);
+            return  "Applied Configuration\n" +
+                    "------------------\n" +
+                    "PID           : " + pid + "\n" +
+                    "Policy : "+ operationMode + "\n" +
+                    "Dryrun       : " + dryRun + "\n" +
+                    printOSGIConfig(pid, config);
+        }else{
+            config = configPlugin.updateConfig(pid, dryRun);
+            return  "Applied Configuration\n" +
+                    "------------------\n" +
+                    "PID           : " + pid + "\n" +
+                    "Policy : "+ configPlugin.getDefaultPolicy() + "\n" +
+                    "Dryrun       : " + dryRun + "\n" +
+                    printOSGIConfig(pid, config);
+        }
+    }
+
+    public static String readOSGIConfiguration(TamayaConfigService configPlugin, String pid, String section) {
+        Dictionary<String,Object> config = configPlugin.getOSGIConfiguration(pid, section);
+        return printOSGIConfig(pid, config);
+    }
+
+    private static String printOSGIConfig(String pid, Dictionary<String,Object> config){
+        if(config.isEmpty()){
+            return "No Config present for PID: " + pid;
+        }
+        StringBuilder b = new StringBuilder();
+        b.append("OSGI Configuration for PID: ").append(pid).append('\n');
+        b.append("-----------------------------------------------------\n");
+        TreeMap<String,String> result = new TreeMap<>();
+        Enumeration<String> keys = config.keys();
+        while(keys.hasMoreElements()){
+            String key = keys.nextElement();
+            result.put(key, String.valueOf(config.get(key)));
+        }
+        for(Map.Entry<String,String> en:result.entrySet()){
+            b.append(StringUtil.format(en.getKey(), 40));
+            b.append(StringUtil.format(en.getValue(), 40));
+            b.append('\n');
+        }
+        return b.toString();
+    }
+
+    public static String getDefaultOpPolicy(TamayaConfigService configPlugin) throws IOException {
+        return String.valueOf(configPlugin.getDefaultPolicy());
+    }
+
+    public static String setDefaultOpPolicy(TamayaConfigService configPlugin, String policy) throws IOException {
+        Policy opMode = Policy.valueOf(policy);
+        configPlugin.setDefaultPolicy(opMode);
+        return "Policy="+opMode.toString();
+    }
+
+    public static String getProperty(String propertysource, String key, boolean extended) throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        if(propertysource!=null){
+            PropertySource ps = config.getContext().getPropertySource(propertysource);
+            if(ps==null){
+                return "ERR: No such Property Source: " + propertysource;
+            }else {
+                PropertyValue val = ps.get(key);
+                if(val==null){
+                    return "ERR: Property Source: " + propertysource + " - undefined key: " + key;
+                }else {
+                    if(extended) {
+                        return StringUtil.format("Property Source", 25) + StringUtil.format("Value", 25) + '\n' +
+                                StringUtil.printRepeat("-", 50) + '\n' +
+                                StringUtil.format(propertysource, 25) + StringUtil.format(val.getValue(), 55);
+                    }else{
+                        return val.getValue();
+                    }
+                }
+            }
+        }else{
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            pw.println(StringUtil.format("Property Source", 25) + StringUtil.format("Value", 25));
+            for(PropertySource ps:config.getContext().getPropertySources()){
+                PropertyValue val = ps.get(key);
+                if(val!=null){
+                    if(extended) {
+                        pw.println(StringUtil.format("", 25) + StringUtil.format(val.toString(), 55));
+                    }else{
+                        pw.println(StringUtil.format("", 25) + StringUtil.format(val.getValue(), 55));
+                    }
+                }
+            }
+            pw.flush();
+            return sw.toString();
+        }
+    }
+
+    public static String getPropertySource(String propertysource) throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        if(propertysource!=null){
+            PropertySource ps = config.getContext().getPropertySource(propertysource);
+            if(ps==null){
+                return "No such Property Source: " + propertysource;
+            }else {
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw);
+                pw.println("Property Source");
+                pw.println("---------------");
+                pw.println(StringUtil.format("ID:", 20) + ps.getName());
+                pw.println(StringUtil.format("Ordinal:", 20) + ps.getOrdinal());
+                pw.println(StringUtil.format("Class:", 20) + ps.getClass().getName());
+                pw.println("Properties:");
+                pw.print(StringUtil.format("  Key", 20));
+                pw.print(StringUtil.format("Value", 20));
+                pw.print(StringUtil.format("Source", 20));
+                pw.println(StringUtil.format("Meta-Entries", 20));
+                pw.println("  " + StringUtil.printRepeat("-", 80));
+                for(PropertyValue pv:ps.getProperties().values()) {
+                    pw.print("  " + StringUtil.format(pv.getKey(), 20));
+                    pw.print(StringUtil.format(pv.getValue(), 20));
+                    pw.print(StringUtil.format(pv.getSource(), 20));
+                    pw.println(StringUtil.format(pv.getMetaEntries().toString(), 80));
+                }
+                pw.flush();
+                return sw.toString();
+            }
+        }
+        // Get a name of existing propertysources
+        List<String> result = new ArrayList<>();
+        for(PropertySource ps:config.getContext().getPropertySources()){
+            result.add(ps.getName());
+        }
+        StringBuilder b = new StringBuilder("Please select a property source:\n");
+        for(String name:result){
+            b.append(name).append('\n');
+        }
+        return b.toString();
+    }
+
+    public static String getPropertySourceOverview() throws IOException {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        pw.println("Property Sources");
+        pw.println("----------------");
+        pw.print(StringUtil.format("ID", 30));
+        pw.print(StringUtil.format("Ordinal", 20));
+        pw.print(StringUtil.format("Class", 40));
+        pw.println(StringUtil.format("Size", 5));
+        pw.println(StringUtil.printRepeat("-", 80));
+        for(PropertySource ps:config.getContext().getPropertySources()){
+            pw.print(StringUtil.format(ps.getName(), 30));
+            pw.print(StringUtil.format(String.valueOf(ps.getOrdinal()), 20));
+            pw.print(StringUtil.format(ps.getClass().getName(), 40));
+            pw.println(StringUtil.format(String.valueOf(ps.getProperties().size()), 5));
+            pw.println("---");
+        }
+        pw.flush();
+        return sw.toString();
+    }
+
+    public static String setDefaultEnabled(TamayaConfigService configPlugin, boolean enabled) throws IOException {
+        configPlugin.setTamayaEnabledByDefault(enabled);
+        return TamayaConfigService.TAMAYA_ENABLED_PROP+"="+enabled;
+    }
+
+    public static String getDefaultEnabled(TamayaConfigService configPlugin) {
+        return String.valueOf(configPlugin.isTamayaEnabledByDefault());
+    }
+
+    public static String setAutoUpdateEnabled(TamayaConfigService configPlugin, boolean enabled) {
+        configPlugin.setAutoUpdateEnabled(enabled);
+        return TamayaConfigService.TAMAYA_AUTO_UPDATE_ENABLED_PROP+"="+enabled;
+    }
+
+    public static String getAutoUpdateEnabled(TamayaConfigService configPlugin) {
+        return String.valueOf(configPlugin.isAutoUpdateEnabled());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/HistoryCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/HistoryCommands.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/HistoryCommands.java
new file mode 100644
index 0000000..7323dbd
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/HistoryCommands.java
@@ -0,0 +1,101 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.apache.tamaya.osgi.ConfigHistory;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * Utility class implementing the available change getHistory related commands.
+ */
+public final class HistoryCommands{
+
+    /** Singleton constructor. */
+    private HistoryCommands(){}
+
+    public static String clearHistory(TamayaConfigService service, String pid) throws IOException {
+        int size = service.getHistory(pid).size();
+        if(pid!=null){
+            service.clearHistory(pid);
+            return "Deleted Config Change History for PID: " + pid;
+        }else{
+            service.clearHistory();
+            return "Deleted complete Config Change History.";
+        }
+
+    }
+
+    public static String getHistory(TamayaConfigService service, String pid, String... events) throws IOException {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        List<ConfigHistory> history = service.getHistory(pid);
+        history = filterTypes(history, events);
+        pw.print(StringUtil.format("Type", 10));
+        pw.print(StringUtil.format("PID", 30));
+        pw.print(StringUtil.format("Key", 30));
+        pw.print(StringUtil.format("Value", 40));
+        pw.println(StringUtil.format("Previous Value", 40));
+        pw.println(StringUtil.printRepeat("-", 140));
+        for(ConfigHistory h:history){
+            pw.print(StringUtil.format(h.getType().toString(), 10));
+            pw.print(StringUtil.format(h.getPid(), 30));
+            pw.print(StringUtil.format(h.getKey(), 30));
+            pw.print(StringUtil.format(String.valueOf(h.getValue()), 40));
+            pw.println(String.valueOf(h.getPreviousValue()));
+        }
+        pw.flush();
+        return sw.toString();
+    }
+
+    public static String getMaxHistorySize(TamayaConfigService service){
+        return String.valueOf(service.getMaxHistorySize());
+    }
+
+    public static String setMaxHistorySize(TamayaConfigService service, int maxSize){
+        service.setMaxHistorySize(maxSize);
+        return "tamaya-max-getHistory-size="+maxSize;
+    }
+
+    private static List<ConfigHistory> filterTypes(List<ConfigHistory> history, String... eventTypes) {
+        if(eventTypes==null || eventTypes.length==0){
+            return history;
+        }
+        List<ConfigHistory> result = new ArrayList<>();
+        Set<ConfigHistory.TaskType> types = new HashSet<>();
+        for(String tt:eventTypes) {
+            types.add(ConfigHistory.TaskType.valueOf(tt));
+        }
+        for(ConfigHistory h:history){
+            if(types.contains(h.getType())){
+                result.add(h);
+            }
+        }
+        return result;
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/StringUtil.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/StringUtil.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/StringUtil.java
new file mode 100644
index 0000000..f7b29ac
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/StringUtil.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+/**
+ * Some String related helper methods.
+ */
+public final class StringUtil {
+
+    private StringUtil(){}
+
+    public static String format(String in, int length){
+        if(in==null){
+            in = "";
+        }
+        int count = length - in.length();
+        if(count<0){
+            return in.substring(0,length-3) + "...";
+        }
+        return in + printRepeat(" ", count);
+    }
+
+    public static String printRepeat(String s, int times) {
+        StringBuilder b = new StringBuilder();
+        for(int i=0;i<times;i++){
+            b.append(s);
+        }
+        return b.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/TamayaConfigService.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/TamayaConfigService.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/TamayaConfigService.java
new file mode 100644
index 0000000..99cd5fb
--- /dev/null
+++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/commands/TamayaConfigService.java
@@ -0,0 +1,206 @@
+/*
+ * 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.tamaya.osgi.commands;
+
+import org.apache.tamaya.osgi.ConfigHistory;
+import org.apache.tamaya.osgi.Policy;
+import org.osgi.framework.Bundle;
+
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Service exposing the Tamaya OSGI configuration logic.
+ */
+public interface TamayaConfigService{
+    /** The system/config property to set Tamaya's {@link Policy}. */
+    String TAMAYA_POLICY_PROP = "tamaya-policy";
+    /** The MANIFEST property to set Tamaya's {@link Policy}. */
+    String TAMAYA_POLICY_MANIFEST = "Tamaya-Policy";
+    /** The system/config property to define a customized Tamaya's configuration root, replacing the {@code [PID]} default
+     * prefix used. */
+    String TAMAYA_CUSTOM_ROOT_PROP = "tamaya-config-root";
+    /** The MANIFEST property to define a customized Tamaya's configuration root, replacing the {@code [PID]} default
+     * prefix used. */
+    String TAMAYA_CUSTOM_ROOT_MANIFEST = "Tamaya-Config-Root";
+    /** The system/config property to enable Tamaya. */
+    String TAMAYA_ENABLED_PROP = "tamaya-enabled";
+    /** The MANIFEST property to enable Tamaya. */
+    String TAMAYA_ENABLED_MANIFEST = "Tamaya-Enabled";
+    /** The system/config property to enable Tamaya automatic updates (requires Tamaya's Updater plugin to be loaded as well). */
+    String TAMAYA_AUTO_UPDATE_ENABLED_PROP = "tamaya-update-enabled";
+    /** The MANIFEST property to enable Tamaya automatic updates (requires Tamaya's Updater plugin to be loaded as well). */
+    String TAMAYA_AUTO_UPDATE_ENABLED_MANIFEST = "Tamaya-Update-Enabled";
+
+    /**
+     * Enables/disables automatic updates (requires Tamaya's Updater plugin to be loaded as well).
+     * @param enabled set to true to enable updates.
+     */
+    void setAutoUpdateEnabled(boolean enabled);
+
+    /**
+     * Enables/disables Tamaya config by default.
+     * @param enabled set to true to enable Tamaya for all bundles by default.
+     */
+    void setTamayaEnabledByDefault(boolean enabled);
+
+    /**
+     * Get the flag, if Tamaya is enabled by default for all bundles.
+     * @return true if Tamaya is enabled.
+     */
+    boolean isTamayaEnabledByDefault();
+
+    /**
+     * Get the default policy Tamaya is using for adapting OSGI configuration.
+     * @return the default policy, never null.
+     */
+    Policy getDefaultPolicy();
+
+    /**
+     * Set the default policy Tamaya is using for adapting OSGI configuration.
+     * @param policy the policy, not null.
+     */
+    void setDefaultPolicy(Policy policy);
+
+    /**
+     * Updates the given OSGI configuration with Tamaya configuration.
+     * @param pid the target PID, not null.
+     * @return the new configuration.
+     */
+    Dictionary<String,Object> updateConfig(String pid);
+
+    /**
+     * Updates the given OSGI configuration with Tamaya configuration.
+     * @param pid the target PID, not null.
+     * @param dryRun if true, the changes will not be applied to the OSGI configuration.
+     * @return the configuration that would be applied, has been applied.
+     */
+    Dictionary<String,Object> updateConfig(String pid, boolean dryRun);
+
+    /**
+     * Updates the given OSGI configuration with Tamaya configuration.
+     * @param pid the target PID, not null.
+     * @param policy the updating policy to be used, by default.
+     * @param forcePolicy if set to true, the given policy will be used, even if an alternate policy is configured
+     *                    for the given PID.
+     * @param dryRun if true, the changes will not be applied to the OSGI configuration.
+     * @return the configuration that would be applied, has been applied.
+     */
+    Dictionary<String,Object> updateConfig(String pid, Policy policy, boolean forcePolicy, boolean dryRun);
+
+    /**
+     * Checks if a bundle is enabled for Tamaya configuration.
+     * @param bundle the bundle, not null.
+     * @return true, if the bundle is enabled.
+     */
+    boolean isBundleEnabled(Bundle bundle);
+
+    /**
+     * Get the flag if automatic updates for config changes are enabled.
+     * @return true, if automatic updates for config changes are enabled.
+     */
+    boolean isAutoUpdateEnabled();
+
+    /**
+     * Get the backup written for a PID.
+     * @param pid the pid, not null.
+     * @return the backup, or null, if no backup is present.
+     */
+    Dictionary<String,?> getBackup(String pid);
+
+    /**
+     * Get all current known PIDs for which backups are registered.
+     * @return all known PIDs for which backups are registered.
+     */
+    Set<String> getBackupPids();
+
+    /**
+     * Restores a backup, replacing the current OSGI configuration with the backup and
+     * disabling Tamaya for this PID.
+     * @param pid the PID, not null.
+     * @return true, if a backup has been restored successfully.
+     */
+    boolean restoreBackup(String pid);
+
+    /**
+     * Stores the current OSGI configuration as a backup (only if no backup is existing).
+     * @param pid the target PID, not null.
+     * @return true, if a backup has been stored successfully.
+     */
+    boolean createBackup(String pid);
+
+    /**
+     * Deletes a backup, if existing.
+     * @param pid the target PID, not null.
+     * @return true, if a backup has been restored successfully.
+     */
+    boolean deleteBackup(String pid);
+
+    /**
+     * Sets the maximum getHistory size.
+     * @param maxHistory the max getHistory size. {@code 0} disables the getHistory function.
+     */
+    void setMaxHistorySize(int maxHistory);
+
+    /**
+     * Get the max getHistory size.
+     * @return the max getHistory size. {@code 0} means the getHistory function is disabled.
+     */
+    int getMaxHistorySize();
+
+    /**
+     * Access the current (full) change getHistory.
+     * @return the current getHistory, never null.
+     */
+    List<ConfigHistory> getHistory();
+
+    /**
+     * Clears the getHistory.
+     */
+    void clearHistory();
+
+    /**
+     * Clears the getHistory for a PID.
+     * @param pid the target PID, not null.
+     */
+    void clearHistory(String pid);
+
+    /**
+     * Get the getHistory for a PID.
+     * @param pid the target PID, not null.
+     * @return the PID's getHistory, never null.
+     */
+    List<ConfigHistory> getHistory(String pid);
+
+    /**
+     * Access the current OSGI configuration for a PID.
+     * @param pid the target PID, not null.
+     * @param section a subsection to be filter (using startsWith).
+     * @return the (optionally filtered) OSGI configuration.
+     */
+    Dictionary<String,Object> getOSGIConfiguration(String pid, String section);
+
+    /**
+     * Checks if a backup exists.
+     * @param pid the target PID, not null.
+     * @return true, if a backup exists.
+     */
+    boolean containsBackup(String pid);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/AbstractOSGITest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/AbstractOSGITest.java
new file mode 100644
index 0000000..20f6fea
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/AbstractOSGITest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.junit.Before;
+import org.mockito.Mock;
+import org.mockito.stubbing.Answer;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+/**
+ * Created by atsticks on 27.09.17.
+ */
+public abstract class AbstractOSGITest {
+
+    private Map<String,Hashtable<String, Object>> properties = new ConcurrentHashMap<>();
+
+    @Mock
+    protected BundleContext bundleContext;
+
+    @Mock
+    protected ConfigurationAdmin cm;
+
+    @Mock
+    private ServiceReference<ConfigurationAdmin> cmRef;
+    @Mock
+    private ServiceReference<TamayaConfigPlugin> tamayaRef;
+
+    protected TamayaConfigService tamayaConfigPlugin;
+
+    protected Dictionary<String,Object> getProperties(String pid){
+        return this.properties.get(pid);
+    }
+
+    @Before
+    public void setup()throws Exception{
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any());
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any(), any());
+        doReturn(new Bundle[0]).when(bundleContext).getBundles();
+        doReturn(cmRef).when(bundleContext).getServiceReference(ConfigurationAdmin.class);
+        doReturn(cm).when(bundleContext).getService(cmRef);
+        doReturn(tamayaRef).when(bundleContext).getServiceReference(TamayaConfigPlugin.class);
+        tamayaConfigPlugin = new TamayaConfigPlugin(bundleContext);
+        doReturn(tamayaConfigPlugin).when(bundleContext).getService(tamayaRef);
+    }
+
+    protected Configuration initConfigurationMock(final String pid)throws Exception{
+        Configuration config = mock(Configuration.class);
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            props.clear();
+            props.putAll((Map<? extends String, ?>) invocation.getArguments()[0]);
+            return null;
+        }).when(config).update(any(Dictionary.class));
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            if(props==null){
+                props = new Hashtable<>();
+                properties.put(pid, props);
+                for(Map.Entry en:System.getProperties().entrySet()){
+                    props.put(en.getKey().toString(), en.getValue());
+                }
+            }
+            return new Hashtable<>(props);
+        }).when(config).getProperties();
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ActivatorTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ActivatorTest.java
new file mode 100644
index 0000000..c1510f8
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ActivatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 29.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ActivatorTest extends AbstractOSGITest{
+
+    @Test
+    public void startStop() throws Exception {
+        Activator activator = new Activator();
+        activator.start(super.bundleContext);
+        verify(bundleContext).registerService(eq(TamayaConfigService.class), anyObject(), anyObject());
+        activator.stop(super.bundleContext);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/BackupsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/BackupsTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/BackupsTest.java
new file mode 100644
index 0000000..9039332
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/BackupsTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.junit.Test;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Created by atsticks on 26.09.17.
+ */
+public class BackupsTest {
+
+
+    private Dictionary<String,Object> createConfig(String pid){
+        Hashtable<String,Object> config = new Hashtable<>();
+        config.put("test.id", pid);
+        return config;
+    }
+    @Test
+    public void setGet() throws Exception {
+        Dictionary<String,Object> cfg = createConfig("set");
+        Backups.set("set", cfg);
+        assertEquals(Backups.get("set"), cfg);
+    }
+
+    @Test
+    public void remove() throws Exception {
+        Dictionary<String,Object> cfg = createConfig("remove");
+        Backups.set("remove", cfg);
+        assertEquals(Backups.get("remove"), cfg);
+        Backups.remove("remove");
+        assertEquals(Backups.get("remove"), null);
+    }
+
+    @Test
+    public void removeAll() throws Exception {
+        Dictionary<String,Object> cfg = createConfig("remove");
+        Backups.set("remove", cfg);
+        assertEquals(Backups.get("remove"), cfg);
+        Backups.removeAll();
+        assertEquals(Backups.get("remove"), null);
+    }
+
+    @Test
+    public void get1() throws Exception {
+    }
+
+    @Test
+    public void getPids() throws Exception {
+        Dictionary<String,Object> cfg = createConfig("getPids");
+        Backups.set("getPids", cfg);
+        Set<String> pids = Backups.getPids();
+        assertNotNull(pids);
+        assertTrue(pids.contains("getPids"));
+        Backups.removeAll();
+        pids = Backups.getPids();
+        assertNotNull(pids);
+        assertTrue(pids.isEmpty());
+    }
+
+    @Test
+    public void contains() throws Exception {
+        Dictionary<String,Object> cfg = createConfig("contains");
+        Backups.set("contains", cfg);
+        assertTrue(Backups.contains("contains"));
+        assertFalse(Backups.contains("foo"));
+        Backups.removeAll();
+        assertFalse(Backups.contains("contains"));
+        assertFalse(Backups.contains("foo"));
+    }
+
+    @Test
+    public void saveRestore() throws Exception {
+        Dictionary<String,Object> store = new Hashtable<>();
+        Dictionary<String,Object> cfg = createConfig("contains");
+        Backups.set("saveRestore", cfg);
+        Backups.save(store);
+        Backups.removeAll();
+        assertFalse(Backups.contains("saveRestore"));
+        Backups.restore(store);
+        assertTrue(Backups.contains("saveRestore"));
+        assertEquals(Backups.get("saveRestore"), cfg);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ConfigHistoryTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ConfigHistoryTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ConfigHistoryTest.java
new file mode 100644
index 0000000..a829f7b
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/ConfigHistoryTest.java
@@ -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.tamaya.osgi;
+
+import org.junit.Test;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Created by atsticks on 26.09.17.
+ */
+public class ConfigHistoryTest {
+    @Test
+    public void configuring() throws Exception {
+        ConfigHistory en = ConfigHistory.configuring("configuring", "configuring_test");
+        assertNotNull(en);
+        assertEquals(en.getPid(), "configuring");
+        assertEquals(en.getType(), ConfigHistory.TaskType.BEGIN);
+        assertEquals(en.getValue(), "configuring_test");
+    }
+
+    @Test
+    public void configured() throws Exception {
+        ConfigHistory en = ConfigHistory.configured("configured", "configured_test");
+        assertNotNull(en);
+        assertEquals(en.getPid(), "configured");
+        assertEquals(en.getType(), ConfigHistory.TaskType.END);
+        assertEquals(en.getValue(), "configured_test");
+    }
+
+    @Test
+    public void propertySet() throws Exception {
+        ConfigHistory en = ConfigHistory.propertySet("propertySet", "propertySet.key", "new", "prev");
+        assertNotNull(en);
+        assertEquals(en.getPid(), "propertySet");
+        assertEquals(en.getType(), ConfigHistory.TaskType.PROPERTY);
+        assertEquals(en.getKey(), "propertySet.key");
+        assertEquals(en.getPreviousValue(), "prev");
+        assertEquals(en.getValue(),"new");
+    }
+
+    @Test
+    public void setGetMaxHistory() throws Exception {
+        ConfigHistory.setMaxHistory(1000);
+        assertEquals(ConfigHistory.getMaxHistory(),1000);
+    }
+
+    @Test
+    public void history() throws Exception {
+        for(int i=0;i<100;i++){
+            ConfigHistory.propertySet("getHistory", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        List<ConfigHistory> hist = ConfigHistory.getHistory();
+        assertNotNull(hist);
+        assertTrue(hist.size()>=100);
+    }
+
+    @Test
+    public void history_pid() throws Exception {
+        ConfigHistory.configuring("history1", "history_pid");
+        for(int i=0;i<100;i++){
+            ConfigHistory.propertySet("history1", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        ConfigHistory.configured("history1", "history_pid");
+        for(int i=0;i<100;i++){
+            ConfigHistory.propertySet("history2", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        List<ConfigHistory> hist = ConfigHistory.getHistory("history1");
+        assertNotNull(hist);
+        assertTrue(hist.size()==102);
+        hist = ConfigHistory.getHistory("history2");
+        assertNotNull(hist);
+        assertTrue(hist.size()==100);
+        hist = ConfigHistory.getHistory(null);
+        assertNotNull(hist);
+        assertTrue(hist.size()>=202);
+    }
+
+    @Test
+    public void clearHistory() throws Exception {
+        for(int i=0;i<100;i++){
+            ConfigHistory.propertySet("history3", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        for(int i=0;i<100;i++){
+            ConfigHistory.propertySet("history4", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        List<ConfigHistory> hist = ConfigHistory.getHistory("history3");
+        assertNotNull(hist);
+        assertTrue(hist.size()==100);
+        assertEquals(ConfigHistory.getHistory("history4").size(), 100);
+        ConfigHistory.clearHistory("history3");
+        assertEquals(ConfigHistory.getHistory("history3").size(), 0);
+        assertEquals(ConfigHistory.getHistory("history4").size(), 100);
+        ConfigHistory.clearHistory(null);
+        assertEquals(ConfigHistory.getHistory().size(), 0);
+        assertEquals(ConfigHistory.getHistory("history4").size(), 0);
+    }
+
+
+    @Test
+    public void setPreviousValue() throws Exception {
+    }
+
+    @Test
+    public void getValue() throws Exception {
+    }
+
+    @Test
+    public void getKey() throws Exception {
+    }
+
+    @Test
+    public void saveRestore() throws Exception {
+        for(int i=0;i<10;i++){
+            ConfigHistory.propertySet("save", "getHistory"+i, "prev"+i, "new"+i);
+        }
+        assertEquals(ConfigHistory.getHistory("save").size(), 10);
+        Dictionary<String,Object> config = new Hashtable<>();
+        ConfigHistory.save(config);
+        assertEquals(ConfigHistory.getHistory("save").size(), 10);
+        ConfigHistory.clearHistory();
+        assertEquals(ConfigHistory.getHistory("save").size(), 0);
+        ConfigHistory.restore(config);
+        assertEquals(ConfigHistory.getHistory("save").size(), 10);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/TamayaConfigPluginTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/TamayaConfigPluginTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/TamayaConfigPluginTest.java
new file mode 100644
index 0000000..d597557
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/TamayaConfigPluginTest.java
@@ -0,0 +1,290 @@
+/*
+ * 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.tamaya.osgi;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 10.12.16.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class TamayaConfigPluginTest extends  AbstractOSGITest{
+
+    @Test
+    public void pluginLoaded() throws Exception {
+        assertNotNull(bundleContext.getService(bundleContext.getServiceReference(TamayaConfigPlugin.class)));
+    }
+
+    @Test
+    public void testOperationMode() throws Exception {
+        Policy om = tamayaConfigPlugin.getDefaultPolicy();
+        tamayaConfigPlugin.setDefaultPolicy(Policy.EXTEND);
+        assertEquals(Policy.EXTEND, tamayaConfigPlugin.getDefaultPolicy());
+        tamayaConfigPlugin.setDefaultPolicy(Policy.OVERRIDE);
+    }
+
+    @Test
+    public void testAutoUpdate() throws Exception {
+        boolean autoUpdate = tamayaConfigPlugin.isAutoUpdateEnabled();
+        tamayaConfigPlugin.setAutoUpdateEnabled(!autoUpdate);
+        assertEquals(tamayaConfigPlugin.isAutoUpdateEnabled(),!autoUpdate);
+        tamayaConfigPlugin.setAutoUpdateEnabled(autoUpdate);
+        assertEquals(tamayaConfigPlugin.isAutoUpdateEnabled(),autoUpdate);
+    }
+
+    @Test
+    public void testDefaulEnabled() throws Exception {
+        boolean enabled = tamayaConfigPlugin.isTamayaEnabledByDefault();
+        tamayaConfigPlugin.setTamayaEnabledByDefault(!enabled);
+        assertEquals(tamayaConfigPlugin.isTamayaEnabledByDefault(),!enabled);
+        tamayaConfigPlugin.setTamayaEnabledByDefault(enabled);
+        assertEquals(tamayaConfigPlugin.isTamayaEnabledByDefault(),enabled);
+    }
+
+    @Test
+    public void testSetPluginConfig() throws Exception {
+        Dictionary<String,Object> config = new Hashtable<>();
+        ((TamayaConfigPlugin)tamayaConfigPlugin).setPluginConfig(config);
+        assertEquals(((TamayaConfigPlugin)tamayaConfigPlugin).getPluginConfig(), config);
+    }
+
+    @Test
+    public void testSetGetConfigValue() throws Exception {
+        Dictionary<String,Object> config = new Hashtable<>();
+        String val = (String)((TamayaConfigPlugin)tamayaConfigPlugin).getConfigValue("foo");
+        ((TamayaConfigPlugin)tamayaConfigPlugin).setConfigValue("bar", "foo");
+        assertEquals(((TamayaConfigPlugin)tamayaConfigPlugin).getConfigValue("bar"), "foo");
+    }
+
+    @Test
+    public void getTMUpdateConfig() throws Exception {
+        org.apache.tamaya.Configuration config = ((TamayaConfigPlugin)tamayaConfigPlugin).getTamayaConfiguration("java.");
+        assertNotNull(config);
+        assertNull(config.get("jlkjllj"));
+        assertEquals(config.get("home"),System.getProperty("java.home"));
+    }
+
+    @Test
+    public void getUpdateConfig() throws Exception {
+        Dictionary<String, Object> config = tamayaConfigPlugin.updateConfig(TamayaConfigPlugin.COMPONENTID);
+        assertNotNull(config);
+        assertEquals(config.get("java.home"), System.getProperty("java.home"));
+    }
+
+    @Test
+    public void getUpdateConfig_DryRun() throws Exception {
+        Dictionary<String, Object> config = tamayaConfigPlugin.updateConfig(TamayaConfigPlugin.COMPONENTID, true);
+        assertNotNull(config);
+        assertEquals(config.get("java.home"), System.getProperty("java.home"));
+    }
+
+    @Test
+    public void getUpdateConfig_Explicit_DryRun() throws Exception {
+        Dictionary<String, Object> config = tamayaConfigPlugin.updateConfig(TamayaConfigPlugin.COMPONENTID, Policy.EXTEND, true, true);
+        assertNotNull(config);
+        assertEquals(config.get("java.home"), System.getProperty("java.home"));
+    }
+
+    @Test
+    public void getPluginConfig() throws Exception {
+        Dictionary<String, Object> config = ((TamayaConfigPlugin)tamayaConfigPlugin).getPluginConfig();
+        assertNotNull(config);
+        assertEquals(config, super.getProperties(TamayaConfigPlugin.COMPONENTID));
+    }
+
+    @Test
+    public void getDefaultOperationMode() throws Exception {
+        Policy om = tamayaConfigPlugin.getDefaultPolicy();
+        assertNotNull(om);
+        Dictionary<String,Object> pluginConfig = super.getProperties(TamayaConfigPlugin.COMPONENTID);
+        pluginConfig.put(Policy.class.getSimpleName(), Policy.UPDATE_ONLY.toString());
+        TamayaConfigPlugin plugin = new TamayaConfigPlugin(bundleContext);
+        om = plugin.getDefaultPolicy();
+        assertNotNull(om);
+        assertEquals(om, Policy.UPDATE_ONLY);
+        pluginConfig.put(Policy.class.getSimpleName(), Policy.OVERRIDE.toString());
+        plugin = new TamayaConfigPlugin(bundleContext);
+        om = plugin.getDefaultPolicy();
+        assertNotNull(om);
+        assertEquals(om, Policy.OVERRIDE);
+    }
+
+    @Test
+    public void testConfiguration_Override() throws Exception {
+        assertNotNull(cm);
+        tamayaConfigPlugin.updateConfig("tamaya", Policy.OVERRIDE, true, false);
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        // Override should add additional values
+        assertEquals(config.getProperties().get("my.testProperty1"), "success1");
+        assertEquals(config.getProperties().get("my.testProperty2"), "success2");
+        assertEquals(config.getProperties().get("my.testProperty3"), "success3");
+        assertEquals(config.getProperties().get("my.testProperty4"), "success4");
+        // Extend should also update any existing values...
+        assertEquals(config.getProperties().get("java.version"), "Java2000");
+        tamayaConfigPlugin.restoreBackup("tamaya");
+    }
+
+    @Test
+    public void testConfiguration_Override_ImplicitlyConfigured() throws Exception {
+        assertNotNull(cm);
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        Dictionary<String,Object> props = config.getProperties();
+        props.put(TamayaConfigPlugin.TAMAYA_POLICY_PROP, "OVERRIDE");
+        config.update(props);
+        tamayaConfigPlugin.updateConfig("tamaya", Policy.UPDATE_ONLY, false, false);
+        config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        // Override should add additional values
+        assertEquals(config.getProperties().get("my.testProperty1"), "success1");
+        assertEquals(config.getProperties().get("my.testProperty2"), "success2");
+        assertEquals(config.getProperties().get("my.testProperty3"), "success3");
+        assertEquals(config.getProperties().get("my.testProperty4"), "success4");
+        // Extend should also update any existing values...
+        assertEquals(config.getProperties().get("java.version"), "Java2000");
+        tamayaConfigPlugin.restoreBackup("tamaya");
+    }
+
+    @Test
+    public void testConfiguration_Extend() throws Exception {
+        assertNotNull(cm);
+        tamayaConfigPlugin.updateConfig("tamaya", Policy.EXTEND, true, false);
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        assertEquals(config.getProperties().get("my.testProperty1"), "success1");
+        assertEquals(config.getProperties().get("my.testProperty2"), "success2");
+        assertEquals(config.getProperties().get("my.testProperty3"), "success3");
+        assertEquals(config.getProperties().get("my.testProperty4"), "success4");
+        // Extend should not update any existing values...
+        assertEquals(config.getProperties().get("java.version"), System.getProperty("java.version"));
+        tamayaConfigPlugin.restoreBackup("tamaya");
+    }
+
+    @Test
+    public void testConfiguration_Update_Only() throws Exception {
+        assertNotNull(cm);
+        tamayaConfigPlugin.updateConfig("tamaya", Policy.UPDATE_ONLY, true, false);
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        assertEquals(config.getProperties().get("my.testProperty1"), null);
+        assertEquals(config.getProperties().get("my.testProperty2"), null);
+        assertEquals(config.getProperties().get("my.testProperty3"), null);
+        assertEquals(config.getProperties().get("my.testProperty4"), null);
+        // Update only should update any existing values...
+        assertEquals(config.getProperties().get("java.version"), "Java2000");
+        tamayaConfigPlugin.restoreBackup("tamaya");
+    }
+
+    @Test
+    public void testConfiguration_Override_Dryrun() throws Exception {
+        assertNotNull(cm);
+        Dictionary<String,Object> result = tamayaConfigPlugin.updateConfig("tamaya", Policy.OVERRIDE, true, true);
+        assertNotNull(result);
+        // Override should add additional values
+        assertEquals(result.get("my.testProperty1"), "success1");
+        assertEquals(result.get("my.testProperty2"), "success2");
+        assertEquals(result.get("my.testProperty3"), "success3");
+        assertEquals(result.get("my.testProperty4"), "success4");
+        // Extend should also update any existing values...
+        assertEquals(result.get("java.version"), "Java2000");
+
+        // DryRun: should not have been changged anything on OSGI level...
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        assertEquals(config.getProperties().get("my.testProperty1"), null);
+        assertEquals(config.getProperties().get("my.testProperty2"), null);
+        assertEquals(config.getProperties().get("my.testProperty3"), null);
+        assertEquals(config.getProperties().get("my.testProperty4"), null);
+        assertEquals(config.getProperties().get("java.version"), System.getProperty("java.version"));
+    }
+
+    @Test
+    public void testConfiguration_Extend_Dryrun() throws Exception {
+        assertNotNull(cm);
+        Dictionary<String,Object> result = tamayaConfigPlugin.updateConfig("tamaya", Policy.EXTEND, true, true);
+        assertNotNull(result);
+        assertEquals(result.get("my.testProperty1"), "success1");
+        assertEquals(result.get("my.testProperty2"), "success2");
+        assertEquals(result.get("my.testProperty3"), "success3");
+        assertEquals(result.get("my.testProperty4"), "success4");
+        // Extend should not update any existing values...
+        assertEquals(result.get("java.version"), System.getProperty("java.version"));
+
+        // DryRun: should not have been changged anything on OSGI level...
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        assertEquals(config.getProperties().get("my.testProperty1"), null);
+        assertEquals(config.getProperties().get("my.testProperty2"), null);
+        assertEquals(config.getProperties().get("my.testProperty3"), null);
+        assertEquals(config.getProperties().get("my.testProperty4"), null);
+        assertEquals(config.getProperties().get("java.version"), System.getProperty("java.version"));
+    }
+
+    @Test
+    public void testConfiguration_Update_Only_Dryrun() throws Exception {
+        assertNotNull(cm);
+        Dictionary<String,Object> result = tamayaConfigPlugin.updateConfig("tamaya", Policy.UPDATE_ONLY, true, true);
+        assertNotNull(result);
+        assertTrue(result.size() > 4);
+        assertEquals(result.get("my.testProperty1"), null);
+        assertEquals(result.get("my.testProperty2"), null);
+        assertEquals(result.get("my.testProperty3"), null);
+        assertEquals(result.get("my.testProperty4"), null);
+        // Update only should update any existing values...
+        assertEquals(result.get("java.version"), "Java2000");
+
+        // DryRun: should not have been changged anything on OSGI level...
+        org.osgi.service.cm.Configuration config = cm.getConfiguration("tamaya");
+        assertNotNull(config);
+        assertNotNull(config.getProperties());
+        assertFalse(config.getProperties().isEmpty());
+        assertTrue(config.getProperties().size() > 4);
+        assertEquals(config.getProperties().get("my.testProperty1"), null);
+        assertEquals(config.getProperties().get("my.testProperty2"), null);
+        assertEquals(config.getProperties().get("my.testProperty3"), null);
+        assertEquals(config.getProperties().get("my.testProperty4"), null);
+        assertEquals(config.getProperties().get("java.version"), System.getProperty("java.version"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/BackupCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/BackupCommandsTest.java b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/BackupCommandsTest.java
new file mode 100644
index 0000000..20d2a78
--- /dev/null
+++ b/modules/osgi/common/src/test/java/org/apache/tamaya/osgi/commands/BackupCommandsTest.java
@@ -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.tamaya.osgi.commands;
+
+import org.apache.tamaya.osgi.AbstractOSGITest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.Hashtable;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class BackupCommandsTest extends AbstractOSGITest {
+    @Test
+    public void createBackup() throws Exception {
+        String result = BackupCommands.createBackup(tamayaConfigPlugin, cm, "createBackup", false);
+        assertNotNull(result);
+        assertTrue(result.contains("createBackup"));
+        assertTrue(result.contains("Backup created"));
+        assertTrue(tamayaConfigPlugin.containsBackup("createBackup"));
+        // A backup with the given name already exists, so it fails
+        result = BackupCommands.createBackup(tamayaConfigPlugin, cm, "createBackup", false);
+        assertNotNull(result);
+        assertTrue(result.contains("createBackup"));
+        assertTrue(result.contains("Creating backup failed"));
+        assertTrue(result.contains("already existing"));
+        assertTrue(tamayaConfigPlugin.containsBackup("createBackup"));
+        // any existing backups gets overridden
+        result = BackupCommands.createBackup(tamayaConfigPlugin, cm, "createBackup", true);
+        assertNotNull(result);
+        assertTrue(result.contains("createBackup"));
+        assertTrue(result.contains("Backup created"));
+        assertTrue(tamayaConfigPlugin.containsBackup("createBackup"));
+    }
+
+    @Test
+    public void deleteBackup() throws Exception {
+        BackupCommands.createBackup(tamayaConfigPlugin, cm, "deleteBackup", false);
+        assertTrue(tamayaConfigPlugin.containsBackup("deleteBackup"));
+        String result = BackupCommands.deleteBackup(tamayaConfigPlugin, "deleteBackup");
+        assertNotNull(result);
+        assertTrue(result.contains("deleteBackup"));
+        assertTrue(result.contains("Backup deleted"));
+        assertFalse(tamayaConfigPlugin.containsBackup("deleteBackup"));
+    }
+
+    @Test
+    public void restoreBackup() throws Exception {
+        BackupCommands.createBackup(tamayaConfigPlugin, cm, "restoreBackup", false);
+        assertTrue(tamayaConfigPlugin.containsBackup("restoreBackup"));
+        String result = BackupCommands.restoreBackup(tamayaConfigPlugin, "restoreBackup");
+        assertNotNull(result);
+        assertTrue(result.contains("restoreBackup"));
+        assertTrue(result.contains("Backup restored"));
+        BackupCommands.deleteBackup(tamayaConfigPlugin, "restoreBackup");
+        assertFalse(tamayaConfigPlugin.containsBackup("restoreBackup"));
+        result = BackupCommands.restoreBackup(tamayaConfigPlugin, "restoreBackup");
+        assertTrue(result.contains("Backup restore failed"));
+        assertTrue(result.contains("no backup found"));
+    }
+
+    @Test
+    public void listBackup() throws Exception {
+        BackupCommands.createBackup(tamayaConfigPlugin, cm, "listBackup", false);
+        String result = BackupCommands.listBackup(tamayaConfigPlugin, "listBackup");
+        result.concat("listBackup");
+        result.contains("pid");
+    }
+
+    @Test
+    public void printProps() throws Exception {
+        Hashtable<String,Object> props = new Hashtable<>();
+        props.put("k1", "v1");
+        props.put("k2", "v2");
+        String result = BackupCommands.printProps(props);
+        assertTrue(result.contains("k1"));
+        assertTrue(result.contains("k2"));
+        assertTrue(result.contains("v1"));
+        assertTrue(result.contains("v2"));
+    }
+
+}
\ No newline at end of file


[2/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improver coverage.

Posted by an...@apache.org.
TAMAYA-300 Added tests to improver coverage.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/a91e434e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/a91e434e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/a91e434e

Branch: refs/heads/master
Commit: a91e434ecac4cb96aba287d260741271d0e3c005
Parents: 1e8ac05
Author: Anatole Tresch <an...@apache.org>
Authored: Mon Oct 16 17:17:51 2017 +0200
Committer: Anatole Tresch <an...@apache.org>
Committed: Mon Oct 16 17:17:51 2017 +0200

----------------------------------------------------------------------
 modules/osgi/gogo-shell/bnd.bnd                 |  34 +++++++
 modules/osgi/gogo-shell/pom.xml                 |  71 +++++++++++++
 .../org/apache/tamaya/gogo/shell/Activator.java |  92 +++++++++++++++++
 .../tamaya/gogo/shell/BackupCommands.java       |  78 ++++++++++++++
 .../tamaya/gogo/shell/ConfigCommands.java       |  89 ++++++++++++++++
 .../tamaya/gogo/shell/HistoryCommands.java      |  89 ++++++++++++++++
 .../tamaya/gogo/shell/SettingsCommands.java     |  83 +++++++++++++++
 .../tamaya/gogo/shell/AbstractOSGITest.java     | 101 +++++++++++++++++++
 .../apache/tamaya/gogo/shell/ActivatorTest.java |  46 +++++++++
 .../tamaya/gogo/shell/BackupCommandsTest.java   |  71 +++++++++++++
 .../tamaya/gogo/shell/ConfigCommandsTest.java   |  90 +++++++++++++++++
 .../tamaya/gogo/shell/HistoryCommandsTest.java  |  73 ++++++++++++++
 .../tamaya/gogo/shell/SettingsCommandsTest.java |  78 ++++++++++++++
 13 files changed, 995 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/bnd.bnd
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/bnd.bnd b/modules/osgi/gogo-shell/bnd.bnd
new file mode 100644
index 0000000..67e951a
--- /dev/null
+++ b/modules/osgi/gogo-shell/bnd.bnd
@@ -0,0 +1,34 @@
+-buildpath: \
+	osgi.annotation; version=6.0.0,\
+	osgi.core; version=6.0,\
+	osgi.cmpn; version=6.0
+
+-testpath: \
+	${junit}
+
+javac.source: 1.8
+javac.target: 1.8
+
+Bundle-Activator: org.apache.tamaya.gogo.shell.Activator
+Bundle-Version: ${version}.${tstamp}
+Bundle-Name: Apache Tamaya - Felix Shell Commands
+Bundle-SymbolicName: org.apache.tamaya.osgi.gogo.shell
+Bundle-Description: Apacha Tamaya Configuration - Gogo Shell Extensions
+Bundle-Category: Implementation
+Bundle-Copyright: (C) Apache Foundation
+Bundle-License: Apache Licence version 2
+Bundle-Vendor: Apache Software Foundation
+Bundle-ContactAddress: dev-tamaya@incubator.apache.org
+Bundle-DocURL: http://tamaya.apache.org
+Export-Package: \
+	org.apache.tamaya.gogo.shell
+Import-Package: \
+    org.osgi.service.cm,\
+    org.osgi.framework,\
+    org.apache.tamaya,\
+    org.apache.tamaya.spi,\
+    org.apache.tamaya.functions,\
+    org.apache.tamaya.spisupport,\
+    org.apache.tamaya.osgi,\
+    org.apache.tamaya.osgi.commands,\
+    org.apache.felix.service.command

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/pom.xml b/modules/osgi/gogo-shell/pom.xml
new file mode 100644
index 0000000..ba9fa64
--- /dev/null
+++ b/modules/osgi/gogo-shell/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-osgi-gogo-shell</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tamaya :: OSGI :: Gogo :: Shell</name>
+    <description>Tamaya Gogo Shell Commands</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-osgi</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.gogo.runtime</artifactId>
+            <version>1.0.8</version>
+        </dependency>
+
+        <!-- Testing -->
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
new file mode 100644
index 0000000..f7a2aa9
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/Activator.java
@@ -0,0 +1,92 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.logging.Logger;
+
+/**
+ * Activator that registers the Tamaya commands for the Felix Gogo console used
+ * in Apache Felix and Equinox.
+ */
+public class Activator implements BundleActivator {
+
+    private static final Logger LOG = Logger.getLogger(Activator.class.getName());
+
+    private ServiceRegistration<HistoryCommands> histReg;
+    private ServiceRegistration<ConfigCommands> configReg;
+    private ServiceRegistration<BackupCommands> backupReg;
+    private ServiceRegistration<SettingsCommands> settingsReg;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        LOG.finest("Registering Tamaya commands...");
+        Dictionary<String, Object> props = new Hashtable<>();
+        props.put("osgi.command.scope", "tamaya");
+        props.put("osgi.command.function",
+                new String[] {"tm_config", "tm_property",
+                        "tm_propertysource","tm_propertysources"});
+        configReg = context.registerService(
+                ConfigCommands.class,
+                new ConfigCommands(context), props);
+        props.put("osgi.command.function",
+                new String[] {"tm_history","tm_history_delete","tm_history_delete_all",
+                "tm_history_maxsize", "tm_history_maxsize_set"});
+        histReg = context.registerService(
+                HistoryCommands.class,
+                new HistoryCommands(context), props);
+        props.put("osgi.command.function",
+                new String[] {"tm_backup_create","tm_backup_delete",
+                        "tm_backup","tm_backup_restore"});
+        backupReg = context.registerService(
+                BackupCommands.class,
+                new BackupCommands(context), props);
+        props.put("osgi.command.function",
+                new String[] {"tm_enable","tm_enabled", "tm_policy",
+                "tm_policy_set","tm_info", "tm_propagate_updates",
+                "tm_propagate_updates_set"});
+        settingsReg = context.registerService(
+                SettingsCommands.class,
+                new SettingsCommands(context), props);
+        LOG.info("Registered Tamaya commands.");
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        LOG.info("Unregistering Tamaya commands.");
+        if (histReg != null) {
+            histReg.unregister();
+        }
+        if (configReg != null) {
+            configReg.unregister();
+        }
+        if (backupReg != null) {
+            backupReg.unregister();
+        }
+        if (settingsReg != null) {
+            settingsReg.unregister();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
new file mode 100644
index 0000000..67c7b66
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/BackupCommands.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.apache.felix.service.command.Descriptor;
+import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+import java.util.Objects;
+
+public class BackupCommands {
+
+    private BundleContext context;
+
+    public BackupCommands(BundleContext context){
+        this.context = Objects.requireNonNull(context);
+    }
+
+    private <T> T getService(Class<T> type){
+        ServiceReference<T> cmRef = context.getServiceReference(type);
+        return context.getService(cmRef);
+    }
+
+
+    @Descriptor("Creates an OSGI ConfigAdmin configuration backup for a PID.")
+    public void tm_backup_create(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                                  @Descriptor("The PID (requred)") String pid,
+                                 @Parameter(absentValue = Parameter.UNSPECIFIED, names={"-f", "--force"})
+                                  @Descriptor("If set any existing backup will be overriden, default is false.") Boolean force) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.createBackup(
+                getService(TamayaConfigService.class),
+                getService(ConfigurationAdmin.class), pid, force));
+    }
+
+    @Descriptor("Deletes an OSGI ConfigAdmin configuration backup for a PID.")
+    public void tm_backup_delete(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                                  @Descriptor("The target PID") String pid) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.deleteBackup(
+                getService(TamayaConfigService.class),
+                pid));
+    }
+
+    @Descriptor("Restores an OSGI ConfigAdmin configuration backup for a PID and disabled Tamaya for the given PID.")
+    public void tm_backup_restore(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                                 @Descriptor("The target PID") String pid) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.restoreBackup(
+                getService(TamayaConfigService.class), pid));
+    }
+
+    @Descriptor("Shows the contents of the OSGI ConfigAdmin configuration backup for a PID.")
+    public void tm_backup_get(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                               @Descriptor("The PID (requred)") String pid) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.BackupCommands.listBackup(
+                getService(TamayaConfigService.class),
+                Objects.requireNonNull(pid)));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
new file mode 100644
index 0000000..8926ede
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java
@@ -0,0 +1,89 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.apache.felix.service.command.Descriptor;
+import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import java.io.IOException;
+import java.util.Objects;
+
+public class ConfigCommands {
+
+    private BundleContext context;
+
+    private <T> T getService(Class<T> type){
+        ServiceReference<T> cmRef = context.getServiceReference(type);
+        return context.getService(cmRef);
+    }
+
+    public ConfigCommands(BundleContext context){
+        this.context = Objects.requireNonNull(context);
+    }
+
+    @Descriptor("Shows the current Tamaya configuration.")
+    public void tm_config(@Parameter(absentValue = "", names={"-s", "--section"})
+                       @Descriptor("The section start expression to filter.") String section,
+                       @Parameter(absentValue = "", names={"-p", "--pid"})
+                       @Descriptor("The pid to filter (required).") String pid) throws IOException {
+        if(pid.isEmpty()){
+            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readTamayaConfig(section, null));
+        }else {
+            System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.readTamayaConfig4PID(pid, section));
+        }
+    }
+
+    public void tm_apply_config(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                                @Descriptor("The target OSGI component PID.")
+                                        String pid,
+                                @Parameter(absentValue = "OVERRIDE", names={"-m", "--opmode"})
+                                @Descriptor("Explicitly set (override) the operation mode to use, one of: EXTEND, OVERRIDE, UPDATE_ONLY")
+                                        Policy policy,
+                                @Parameter(absentValue = "false", names={"-d", "--dryrun"})
+                                @Descriptor("If set to true no OSGI configuration gets changed.")
+                                        boolean dryRun){
+        System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.applyTamayaConfiguration(
+                getService(TamayaConfigService.class), pid, policy.toString(), dryRun));
+    }
+
+    @Descriptor("Gets the detailed property values.")
+    public void tm_property(@Parameter(absentValue = "", names={"-ps", "--propertysource"})
+                                 @Descriptor("The property source name")String propertysource,
+                             @Parameter(absentValue = Parameter.UNSPECIFIED, names={"-k", "--key"})
+                                @Descriptor("The property key")String key,
+                             @Parameter(absentValue = "false", names={"-e", "--extended"})
+                                 @Descriptor("Show extended info, default=false")Boolean extended) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.getProperty(propertysource, key, extended.booleanValue()));
+    }
+
+    @Descriptor("Get details of a property source.")
+    public void tm_propertysource(@Parameter(absentValue = "", names={"-ps", "--propertysource"})
+                                       @Descriptor("The property source name, empty returns a list of possible values")String propertysource) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.getPropertySource(propertysource));
+    }
+
+    @Descriptor("Show details of all registered property sources.")
+    public void tm_propertysources() throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.getPropertySourceOverview());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/HistoryCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/HistoryCommands.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/HistoryCommands.java
new file mode 100644
index 0000000..906f471
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/HistoryCommands.java
@@ -0,0 +1,89 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.apache.felix.service.command.Descriptor;
+import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import java.io.IOException;
+import java.util.Objects;
+
+public class HistoryCommands {
+
+    private BundleContext context;
+
+    private <T> T getService(Class<T> type){
+        ServiceReference<T> cmRef = context.getServiceReference(type);
+        return context.getService(cmRef);
+    }
+
+    public HistoryCommands(BundleContext context){
+        this.context = Objects.requireNonNull(context);
+    }
+
+    @Descriptor("Deletes the getHistory of configuration changes.")
+    public void tm_history_delete(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--pid"})
+                                   @Descriptor("The PID.") String pid) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.HistoryCommands.clearHistory(
+                getService(TamayaConfigService.class),
+                pid));
+    }
+
+    @Descriptor("Deletes the full getHistory of configuration changes.")
+    public void tm_history_delete_all() throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.HistoryCommands.clearHistory(
+                getService(TamayaConfigService.class),
+                null));
+    }
+
+    @Descriptor("Read the getHistory of configuration changes.")
+    public void tm_history_get(@Parameter(absentValue = "", names={"-p", "--pid"})
+                                @Descriptor("The PID.")String pid,
+                            @Parameter(absentValue = "", names={"-t", "--eventtypes"})
+                            @Descriptor("The comma separated Event types to filter, valid types are " +
+                            "PROPERTY,BEGIN,END")String eventTypes) throws IOException {
+        if(eventTypes.isEmpty()){
+            System.out.println(org.apache.tamaya.osgi.commands.HistoryCommands.getHistory(
+                    getService(TamayaConfigService.class),
+                    pid, null));
+        }else {
+            System.out.println(org.apache.tamaya.osgi.commands.HistoryCommands.getHistory(
+                    getService(TamayaConfigService.class),
+                    pid, eventTypes.split(",")));
+        }
+    }
+
+    @Descriptor("Get the maximum configuration change getHistory size.")
+    public void tm_history_maxsize() throws IOException {
+        System.out.println(String.valueOf(org.apache.tamaya.osgi.commands.HistoryCommands.getMaxHistorySize(
+                getService(TamayaConfigService.class))));
+    }
+
+    @Descriptor("Sets the maximum configuration change getHistory size.")
+    public void tm_history_maxsize_set(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-s", "--size"})
+                                   @Descriptor("The maximum size of getHistory entries stored.")int maxSize) throws IOException {
+        System.out.println(org.apache.tamaya.osgi.commands.HistoryCommands.setMaxHistorySize(
+                getService(TamayaConfigService.class),
+                maxSize));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
new file mode 100644
index 0000000..cf79f0a
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/SettingsCommands.java
@@ -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.
+ */
+package org.apache.tamaya.gogo.shell;
+
+import org.apache.felix.service.command.Descriptor;
+import org.apache.felix.service.command.Parameter;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import java.io.IOException;
+import java.util.Objects;
+
+public class SettingsCommands {
+
+    private BundleContext context;
+
+    public SettingsCommands(BundleContext context){
+        this.context = Objects.requireNonNull(context);
+    }
+
+    private <T> T getService(Class<T> type){
+        ServiceReference<T> cmRef = context.getServiceReference(type);
+        return context.getService(cmRef);
+    }
+
+    @Descriptor("Allows to disable/enable Tamaya configuration by default.")
+    public void tm_enable(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-e", "--enable"})
+                                   @Descriptor("if true Tamaya is enabled by default (default=false)") boolean enabled) throws IOException {
+        System.out.println(ConfigCommands.setDefaultEnabled(getService(TamayaConfigService.class), enabled));
+    }
+
+    @Descriptor("Access if Tamaya is currently enabled by default to change OSGI configuration.")
+    public void tm_enabled(){
+        System.out.println(ConfigCommands.getDefaultEnabled(getService(TamayaConfigService.class)));
+    }
+
+    @Descriptor("Get the default Tamaya configuration policy.")
+    public void tm_policy() throws IOException {
+        System.out.println(ConfigCommands.getDefaultOpPolicy(getService(TamayaConfigService.class)));
+    }
+
+    @Descriptor("Set the default Tamaya configuration policy.")
+    public void tm_policy_set(@Parameter(absentValue = Parameter.UNSPECIFIED, names={"-p", "--policy"})
+                                      @Descriptor("The policy to apply (required), one of: EXTEND, OVERRIDE, UPDATE_ONLY") Policy policy) throws IOException {
+        System.out.println(ConfigCommands.setDefaultOpPolicy(getService(TamayaConfigService.class), policy.toString()));
+    }
+
+    @Descriptor("Get info about the current Tamaya configuration settings.")
+    public void tm_info() throws IOException {
+        System.out.println(ConfigCommands.getInfo(getService(TamayaConfigService.class)));
+    }
+
+    @Descriptor("Flag if Tamaya is automatically triggering OSGI config updates, when according " +
+            "Tamaya configuration changes.")
+    public void tm_propagate_updates() throws IOException {
+        System.out.println(getService(TamayaConfigService.class).isAutoUpdateEnabled());
+    }
+
+    @Descriptor("Configure if Tamaya is automatically triggering OSGI config updates, when according " +
+            "Tamaya configuration changes.")
+    public void tm_propagate_updates_set(boolean enabled) throws IOException {
+        System.out.println(ConfigCommands.setAutoUpdateEnabled(getService(TamayaConfigService.class), enabled));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
new file mode 100644
index 0000000..d33e7e0
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/AbstractOSGITest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.junit.Before;
+import org.mockito.Mock;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+/**
+ * Created by atsticks on 27.09.17.
+ */
+public abstract class AbstractOSGITest {
+
+    private Map<String,Hashtable<String, Object>> properties = new ConcurrentHashMap<>();
+
+    @Mock
+    protected BundleContext bundleContext;
+
+    @Mock
+    protected ConfigurationAdmin cm;
+
+    @Mock
+    private ServiceReference<ConfigurationAdmin> cmRef;
+    @Mock
+    private ServiceReference<TamayaConfigService> tamayaRef;
+
+    @Mock
+    protected TamayaConfigService tamayaConfigPlugin;
+
+    protected Dictionary<String,Object> getProperties(String pid){
+        return this.properties.get(pid);
+    }
+
+    @Before
+    public void setup()throws Exception{
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any());
+        doAnswer(invocation -> {
+            return initConfigurationMock((String)invocation.getArguments()[0]);
+        }).when(cm).getConfiguration(any(), any());
+        doReturn(new Bundle[0]).when(bundleContext).getBundles();
+        doReturn(cmRef).when(bundleContext).getServiceReference(ConfigurationAdmin.class);
+        doReturn(cm).when(bundleContext).getService(cmRef);
+        doReturn(tamayaRef).when(bundleContext).getServiceReference(TamayaConfigService.class);
+//        tamayaConfigPlugin = new TamayaConfigPlugin(bundleContext);
+        doReturn(tamayaConfigPlugin).when(bundleContext).getService(tamayaRef);
+    }
+
+    protected Configuration initConfigurationMock(final String pid)throws Exception{
+        Configuration config = mock(Configuration.class);
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            props.clear();
+            props.putAll((Map<? extends String, ?>) invocation.getArguments()[0]);
+            return null;
+        }).when(config).update(any(Dictionary.class));
+        doAnswer(invocation -> {
+            Hashtable<String,Object> props = properties.get(pid);
+            if(props==null){
+                props = new Hashtable<>();
+                properties.put(pid, props);
+                for(Map.Entry en:System.getProperties().entrySet()){
+                    props.put(en.getKey().toString(), en.getValue());
+                }
+            }
+            return new Hashtable<>(props);
+        }).when(config).getProperties();
+        return config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ActivatorTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ActivatorTest.java
new file mode 100644
index 0000000..03608c3
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ActivatorTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ActivatorTest extends AbstractOSGITest{
+
+    @Test
+    public void startStop() throws Exception {
+        Activator activator = new Activator();
+        activator.start(super.bundleContext);
+        verify(bundleContext).registerService(eq(BackupCommands.class), anyObject(), anyObject());
+        verify(bundleContext).registerService(eq(ConfigCommands.class), anyObject(), anyObject());
+        verify(bundleContext).registerService(eq(HistoryCommands.class), anyObject(), anyObject());
+        verify(bundleContext).registerService(eq(SettingsCommands.class), anyObject(), anyObject());
+        activator.stop(super.bundleContext);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
new file mode 100644
index 0000000..8478cb1
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/BackupCommandsTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class BackupCommandsTest extends AbstractOSGITest{
+
+    private BackupCommands commands;
+
+    @Before
+    public void setupCommands(){
+        commands = new BackupCommands(bundleContext);
+    }
+
+
+    @Test
+    public void testBackup_Create() throws Exception {
+        commands.tm_backup_create("testBackup_Create1",false);
+        verify(tamayaConfigPlugin).createBackup("testBackup_Create1");
+        commands.tm_backup_create("testBackup_Create2",true);
+        verify(tamayaConfigPlugin).createBackup("testBackup_Create2");
+    }
+
+    @Test
+    public void testBackup_Delete() throws Exception {
+        commands.tm_backup_delete("testBackup_Delete");
+        verify(tamayaConfigPlugin).deleteBackup("testBackup_Delete");
+    }
+
+    @Test
+    public void testBackup_Get() throws Exception {
+        commands.tm_backup_get("testBackup_Get");
+        verify(tamayaConfigPlugin).getBackup("testBackup_Get");
+    }
+
+    @Test
+    public void testBackup_Restore() throws Exception {
+        commands.tm_backup_restore("testBackup_Restore");
+        verify(tamayaConfigPlugin).restoreBackup("testBackup_Restore");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
new file mode 100644
index 0000000..5926029
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/ConfigCommandsTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.apache.tamaya.osgi.Policy;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigCommandsTest extends AbstractOSGITest{
+
+    private ConfigCommands commands;
+
+    @Before
+    public void setupCommands(){
+        commands = new ConfigCommands(bundleContext);
+    }
+
+
+    @Test
+    public void testPropertySources() throws Exception {
+        commands.tm_propertysources();
+    }
+
+    @Test
+    public void testProperty_Default() throws Exception {
+        commands.tm_property("system-properties", "java.version", false);
+    }
+
+    @Test
+    public void testProperty_Extended() throws Exception {
+        commands.tm_property("system-properties", "java.version", true);
+    }
+
+    @Test
+    public void testPropertsource() throws Exception {
+        commands.tm_propertysource("system-properties");
+    }
+
+    @Test
+    public void testConfig() throws Exception {
+        Dictionary<String,Object> testConfig = new Hashtable<>();
+        testConfig.put("test","testVal");
+        doReturn(testConfig).when(tamayaConfigPlugin).getOSGIConfiguration(any(),any());
+        commands.tm_config(null,"testConfig");
+        commands.tm_config("java","testConfig");
+    }
+
+    @Test
+    public void testApplyConfig() throws Exception {
+        Dictionary<String,Object> testConfig = new Hashtable<>();
+        testConfig.put("test","testVal");
+        doReturn(testConfig).when(tamayaConfigPlugin).updateConfig(any(),any(), anyBoolean(), anyBoolean());
+        commands.tm_apply_config("testApplyConfig", Policy.EXTEND, true);
+        verify(tamayaConfigPlugin).updateConfig("testApplyConfig", Policy.EXTEND, true, true);
+        commands.tm_apply_config("testApplyConfig", Policy.OVERRIDE, false);
+        verify(tamayaConfigPlugin).updateConfig("testApplyConfig", Policy.OVERRIDE, true, false);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
new file mode 100644
index 0000000..1d129a0
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/HistoryCommandsTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class HistoryCommandsTest extends AbstractOSGITest{
+
+    private HistoryCommands commands;
+
+    @Before
+    public void setupCommands(){
+        commands = new HistoryCommands(bundleContext);
+    }
+
+
+    @Test
+    public void testDeleteHistory() throws Exception {
+        commands.tm_history_delete("testDeleteHistory");
+        verify(tamayaConfigPlugin).clearHistory("testDeleteHistory");
+    }
+
+    @Test
+    public void testDeleteHistory_All() throws Exception {
+        commands.tm_history_delete_all();
+        verify(tamayaConfigPlugin).clearHistory();
+    }
+
+    @Test
+    public void testHisatory_Get() throws Exception {
+        commands.tm_history_get("testHisatory_Get", "");
+        verify(tamayaConfigPlugin).getHistory("testHisatory_Get");
+    }
+
+    @Test
+    public void testHistoryMaxSize() throws Exception {
+        commands.tm_history_maxsize();
+        verify(tamayaConfigPlugin).getMaxHistorySize();
+    }
+
+    @Test
+    public void testHistoryMaxSizeSet() throws Exception {
+        commands.tm_history_maxsize_set(30);
+        verify(tamayaConfigPlugin).setMaxHistorySize(30);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a91e434e/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
----------------------------------------------------------------------
diff --git a/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
new file mode 100644
index 0000000..fa4e3aa
--- /dev/null
+++ b/modules/osgi/gogo-shell/src/test/java/org/apache/tamaya/gogo/shell/SettingsCommandsTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.tamaya.gogo.shell;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.mockito.Mockito.verify;
+
+/**
+ * Created by atsti on 30.09.2017.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SettingsCommandsTest extends AbstractOSGITest{
+
+    private SettingsCommands commands;
+
+    @Before
+    public void setupCommands(){
+        commands = new SettingsCommands(bundleContext);
+    }
+
+
+    @Test
+    public void testEnable() throws Exception {
+        commands.tm_enable(true);
+        verify(tamayaConfigPlugin).setTamayaEnabledByDefault(true);
+        commands.tm_enable(false);
+        verify(tamayaConfigPlugin).setTamayaEnabledByDefault(false);
+    }
+
+    @Test
+    public void testEnabled() throws Exception {
+        commands.tm_enabled();
+        verify(tamayaConfigPlugin).isTamayaEnabledByDefault();
+    }
+
+    @Test
+    public void testInfo() throws Exception {
+        commands.tm_info();
+        verify(tamayaConfigPlugin).isTamayaEnabledByDefault();
+        verify(tamayaConfigPlugin).getDefaultPolicy();
+    }
+
+    @Test
+    public void testPropagateUpdates() throws Exception {
+        commands.tm_propagate_updates();
+        verify(tamayaConfigPlugin).isAutoUpdateEnabled();
+    }
+
+    @Test
+    public void testPropagateUpdatesSet() throws Exception {
+        commands.tm_propagate_updates_set(true);
+        verify(tamayaConfigPlugin).setAutoUpdateEnabled(true);
+        commands.tm_propagate_updates_set(false);
+        verify(tamayaConfigPlugin).setAutoUpdateEnabled(false);
+    }
+
+}
\ No newline at end of file


[3/7] incubator-tamaya-extensions git commit: TAMAYA-300 Added tests to improve mutation coverage. Movewd OSGI and MP to extensions.

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/pom.xml b/modules/osgi/karaf-shell/pom.xml
new file mode 100644
index 0000000..119b264
--- /dev/null
+++ b/modules/osgi/karaf-shell/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-osgi-all</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tamaya-osgi-karaf-shell</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tamaya :: OSGI :: Karaf :: Shell</name>
+    <description>Tamaya Karaf Shell Commands</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tamaya.ext</groupId>
+            <artifactId>tamaya-osgi</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
+            <version>${dependency.karaf.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>${dependency.karaf.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/ApplyTamayaConfigCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/ApplyTamayaConfigCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/ApplyTamayaConfigCommand.java
new file mode 100644
index 0000000..d6b13c6
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/ApplyTamayaConfigCommand.java
@@ -0,0 +1,56 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.TamayaConfigPlugin;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_apply_config", description="Show the current Tamaya configuration.")
+@Service
+public class ApplyTamayaConfigCommand implements Action{
+
+    @Argument(index = 0, name = "pid", description = "The target OSGI component PID.",
+            required = true, multiValued = false)
+    String pid = null;
+
+    @Option(name = "operationMode", aliases={"-m","--opmode"}, description = "Explicitly set (override) the operation mode to use.",
+            required = false, multiValued = false)
+    String opMode = null;
+
+    @Option(name = "dryRun", aliases={"-d","--dryrun"}, description = "If set to true no OSGI configuration gets changed.",
+            required = false, multiValued = false)
+    boolean dryRun = false;
+
+    @org.apache.karaf.shell.api.action.lifecycle.Reference
+    TamayaConfigService configPlugin;
+
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.applyTamayaConfiguration(configPlugin, pid, opMode, dryRun));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupCreateCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupCreateCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupCreateCommand.java
new file mode 100644
index 0000000..dda367a
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupCreateCommand.java
@@ -0,0 +1,56 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.BackupCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_backup_create", description="Creates a backup of a current OSGI configuration.")
+@Service
+public class BackupCreateCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "pid", description = "The target pid to backup.",
+            required = true, multiValued = false)
+    String pid;
+
+    @Option(name = "--force", aliases = "-f", description = "Forces to (over)write a backup, even if one already exists.",
+            required = false, multiValued = false)
+    boolean replace;
+
+    @org.apache.karaf.shell.api.action.lifecycle.Reference
+    ConfigurationAdmin cm;
+
+    @Override
+    public Object execute() throws IOException {
+        return(BackupCommands.createBackup(configPlugin, cm, pid, replace));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupDeleteCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupDeleteCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupDeleteCommand.java
new file mode 100644
index 0000000..f8fe5fe
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupDeleteCommand.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.BackupCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_backup_delete", description="Deletes the OSGI configuration backup  of Tamya.")
+@Service
+public class BackupDeleteCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "pid", description = "Allows to filter on the given PID. '*' removes all backups.",
+            required = true, multiValued = false)
+    String pid;
+
+    @Override
+    public Object execute() throws IOException {
+        return(BackupCommands.deleteBackup(configPlugin, pid));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupListCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupListCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupListCommand.java
new file mode 100644
index 0000000..edc5e88
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupListCommand.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.BackupCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_backup_list", description="List the backed-up OSGI configuration before Tamya applied changes.")
+@Service
+public class BackupListCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "pid", description = "Allows to filter on the given PID.",
+            required = false, multiValued = false)
+    String pid;
+
+    @Override
+    public Object execute() throws IOException {
+        return(BackupCommands.listBackup(configPlugin, pid));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupRestoreCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupRestoreCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupRestoreCommand.java
new file mode 100644
index 0000000..e053bd2
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/BackupRestoreCommand.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.BackupCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_backup_restore", description="Restores the OSGI configuration backup of Tamya and disabled the PID for Tamaya configuration.")
+@Service
+public class BackupRestoreCommand implements Action{
+
+    @Argument(index = 0, name = "pid", description = "The target PID. '*' restores all backups.",
+            required = true, multiValued = false)
+    String pid;
+
+    @org.apache.karaf.shell.api.action.lifecycle.Reference
+    TamayaConfigService configPlugin;
+
+    @Override
+    public Object execute() throws IOException {
+        return(BackupCommands.restoreBackup(configPlugin, pid));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java
new file mode 100644
index 0000000..1a7ebcf
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java
@@ -0,0 +1,67 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+import java.util.List;
+
+@Command(scope = "tamaya", name = "tm_enable", description="Enables or disable Tamaya by default for all bundles/services (default: enabled=false)." +
+        " Disabling still allows to explicitly enable bundles using 'tamaya-enable' manifest or OSGI config entries.")
+@Service
+public class DefaultEnableCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "enabled", description = "The boolean value to enabled/disable Tamaya by default.",
+            required = true, multiValued = false)
+    boolean enabled;
+
+    @Override
+    public Object execute() throws IOException {
+        return(ConfigCommands.setDefaultEnabled(configPlugin, enabled));
+    }
+
+    @Service
+    public static final class OperationModeCompleter implements Completer {
+
+        @Override
+        public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+            StringsCompleter delegate = new StringsCompleter();
+            for(Policy mode: Policy.values()) {
+                delegate.getStrings().add(mode.toString());
+            }
+            return delegate.complete(session, commandLine, candidates);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnabledCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnabledCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnabledCommand.java
new file mode 100644
index 0000000..7b29af7
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnabledCommand.java
@@ -0,0 +1,62 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+import java.util.List;
+
+@Command(scope = "tamaya", name = "tm_enabled", description="Check if Tamaya is currently by default enabled for all bundles/services (default: enabled=false)." +
+        " If disabled still Tamaya allows to explicitly enable bundles using 'tamaya-enable' manifest or OSGI config entries.")
+@Service
+public class DefaultEnabledCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public Object execute() throws IOException {
+        return(ConfigCommands.getDefaultEnabled(configPlugin));
+    }
+
+    @Service
+    public static final class OperationModeCompleter implements Completer {
+
+        @Override
+        public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+            StringsCompleter delegate = new StringsCompleter();
+            for(Policy mode: Policy.values()) {
+                delegate.getStrings().add(mode.toString());
+            }
+            return delegate.complete(session, commandLine, candidates);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/GetPolicyCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/GetPolicyCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/GetPolicyCommand.java
new file mode 100644
index 0000000..71830ca
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/GetPolicyCommand.java
@@ -0,0 +1,42 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_policy", description="Get the current Tamaya overriding policy.")
+@Service
+public class GetPolicyCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public Object execute() throws IOException {
+        return ConfigCommands.getDefaultOpPolicy(configPlugin);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteAllCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteAllCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteAllCommand.java
new file mode 100644
index 0000000..cca7c4c
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteAllCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.HistoryCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_history_delete_all", description="Deletes the full getHistory of changes Tamaya applied to the OSGI configuration.")
+@Service
+public class HistoryDeleteAllCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public String execute() throws IOException {
+        return HistoryCommands.clearHistory(configPlugin, null);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteCommand.java
new file mode 100644
index 0000000..d9df7e0
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryDeleteCommand.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.*;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.HistoryCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_history_delete", description="Deletes the getHistory of changes Tamaya applied to the OSGI configuration.")
+@Service
+public class HistoryDeleteCommand implements Action{
+
+    @Argument(index = 0, name = "pid", description = "Allows to filter on the given PID.",
+            required = true, multiValued = false)
+    String pid;
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public String execute() throws IOException {
+        return HistoryCommands.clearHistory(configPlugin, pid);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryGetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryGetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryGetCommand.java
new file mode 100644
index 0000000..ec221fc
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryGetCommand.java
@@ -0,0 +1,69 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.*;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+import org.apache.tamaya.osgi.ConfigHistory;
+import org.apache.tamaya.osgi.commands.HistoryCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+import java.util.List;
+
+@Command(scope = "tamaya", name = "tm_history", description="Gets the getHistory of changes Tamaya applied to the OSGI configuration.")
+@Service
+public class HistoryGetCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "pid", description = "Allows to filter on the given PID.",
+            required = false, multiValued = false)
+    String pid;
+
+    @Option(name = "--type", aliases = "-t", description = "Allows to filter the events types shown.",
+            required = false, multiValued = true)
+    @Completion(FilterCompleter.class)
+    private String[] eventTypes;
+
+    @Override
+    public String execute() throws IOException {
+        return HistoryCommands.getHistory(configPlugin, pid, eventTypes);
+    }
+
+    @Service
+    public static final class FilterCompleter implements Completer {
+
+        @Override
+        public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+            StringsCompleter delegate = new StringsCompleter();
+            for(ConfigHistory.TaskType taskType:ConfigHistory.TaskType.values()) {
+                delegate.getStrings().add(taskType.toString());
+            }
+            return delegate.complete(session, commandLine, candidates);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeCommand.java
new file mode 100644
index 0000000..f736e4b
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeCommand.java
@@ -0,0 +1,41 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.*;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.HistoryCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_history_maxsize", description="Gets the maximal size of stored getHistory entries.")
+@Service
+public class HistoryMaxsizeCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public Object execute() throws IOException {
+        return(HistoryCommands.getMaxHistorySize(configPlugin));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeSetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeSetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeSetCommand.java
new file mode 100644
index 0000000..91f09ee
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/HistoryMaxsizeSetCommand.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.HistoryCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_history_maxsize_set", description="Sets the maximal size of Tamaya getHistory entries.")
+@Service
+public class HistoryMaxsizeSetCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "size", description = "The maximum number of entries in the getHistory.",
+            required = true, multiValued = false)
+    int maxSize;
+
+    @Override
+    public Object execute() throws IOException {
+        return(HistoryCommands.setMaxHistorySize(configPlugin, maxSize));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/InfoCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/InfoCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/InfoCommand.java
new file mode 100644
index 0000000..cb8f826
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/InfoCommand.java
@@ -0,0 +1,41 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import java.io.IOException;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+@Command(scope = "tamaya", name = "tm_info", description="Show he current Tamaya status.")
+@Service
+public class InfoCommand  implements Action {
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.getInfo(configPlugin));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/OSGIConfigCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/OSGIConfigCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/OSGIConfigCommand.java
new file mode 100644
index 0000000..128aa78
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/OSGIConfigCommand.java
@@ -0,0 +1,51 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_osgi_config", description="Show the current OSGI configuration.")
+@Service
+public class OSGIConfigCommand implements Action{
+
+    @Option(name = "section", aliases={"-s","--section"}, description = "A starting expression selecting the keys to be filtered.",
+            required = false, multiValued = false)
+    String section = null;
+
+    @Argument(index = 0, name = "pid", description = "The target OSGI component PID.",
+            required = true, multiValued = false)
+    String pid = null;
+
+    @org.apache.karaf.shell.api.action.lifecycle.Reference
+    TamayaConfigService configPlugin;
+
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.readOSGIConfiguration(configPlugin, pid, section));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicyGetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicyGetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicyGetCommand.java
new file mode 100644
index 0000000..e38e017
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicyGetCommand.java
@@ -0,0 +1,42 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_policy", description="Gets the current Tamaya operation policy.")
+@Service
+public class PolicyGetCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Override
+    public Object execute() throws IOException {
+        return(ConfigCommands.getDefaultOpPolicy(configPlugin));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicySetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicySetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicySetCommand.java
new file mode 100644
index 0000000..10e317f
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PolicySetCommand.java
@@ -0,0 +1,68 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+import org.apache.tamaya.osgi.Policy;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+import java.util.List;
+
+@Command(scope = "tamaya", name = "tm_policy_set", description="Sets the current Tamaya operation policy.")
+@Service
+public class PolicySetCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "tm_policy_set", description = "The operation policy how Tamaya intercepts OSGI configuration.",
+            required = true, multiValued = false)
+    @Completion(OperationModeCompleter.class)
+    String policy = null;
+
+    @Override
+    public Object execute() throws IOException {
+        return(ConfigCommands.setDefaultOpPolicy(configPlugin, policy));
+    }
+
+    @Service
+    public static final class OperationModeCompleter implements Completer {
+
+        @Override
+        public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+            StringsCompleter delegate = new StringsCompleter();
+            for(Policy mode: Policy.values()) {
+                delegate.getStrings().add(mode.toString());
+            }
+            return delegate.complete(session, commandLine, candidates);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesCommand.java
new file mode 100644
index 0000000..129e9fc
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesCommand.java
@@ -0,0 +1,44 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_propagate_updates",
+        description="Flag if Tamaya is automatically triggering OSGI config updates, when according " +
+                "Tamaya configuration changes.")
+@Service
+public class PropagateUpdatesCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+
+    @Override
+    public Object execute() throws IOException {
+        return(configPlugin.isAutoUpdateEnabled());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesSetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesSetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesSetCommand.java
new file mode 100644
index 0000000..ff5dc95
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropagateUpdatesSetCommand.java
@@ -0,0 +1,49 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_propagate_updates_set",
+        description="Configure if Tamaya is automatically triggering OSGI config updates, when according " +
+                "Tamaya configuration changes.")
+@Service
+public class PropagateUpdatesSetCommand implements Action{
+
+    @Reference
+    private TamayaConfigService configPlugin;
+
+    @Argument(index = 0, name = "enabled", description = "Set to true to enable Tamaya's updating trigger.",
+            required = true, multiValued = false)
+    boolean enabled;
+
+    @Override
+    public Object execute() throws IOException {
+        return(ConfigCommands.setAutoUpdateEnabled(configPlugin, enabled));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java
new file mode 100644
index 0000000..72f5b4a
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java
@@ -0,0 +1,49 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_property", description="Get a Tamaya property.")
+@Service
+public class PropertyGetCommand implements Action{
+
+    @Argument(index = 0, name = "key", description = "The target property source id.",
+            required = false, multiValued = false)
+    String key = null;
+
+    @Option(name="extended", aliases = "e", description = "Also print extended property value attributes.")
+    boolean extended;
+
+    @Option(name = "propertysource", aliases = "ps", description = "The target property source id.",
+            required = false, multiValued = false)
+    String propertysource = null;
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.getProperty(propertysource, key, extended));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
new file mode 100644
index 0000000..97ff4ae
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourceCommand.java
@@ -0,0 +1,41 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_propertysource", description="Show the current Tamaya entries of a propertysource.")
+@Service
+public class PropertySourceCommand implements Action{
+
+    @Argument(index = 0, name = "propertysource", description = "The target property source id.",
+            required = false, multiValued = false)
+    String propertysource = null;
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.getPropertySource(propertysource));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
new file mode 100644
index 0000000..7aa660d
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java
@@ -0,0 +1,39 @@
+/*
+ * 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.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.spi.PropertySource;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_propertysources", description="Get a list of currently registered propertysources.")
+@Service
+public class PropertySourcesCommand implements Action{
+
+    public Object execute() throws IOException {
+        return(ConfigCommands.getPropertySourceOverview());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/TamayaConfigCommand.java
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/TamayaConfigCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/TamayaConfigCommand.java
new file mode 100644
index 0000000..e66d27b
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/TamayaConfigCommand.java
@@ -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.
+ */
+package org.apache.tamaya.karaf.shell;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.tamaya.osgi.commands.ConfigCommands;
+import org.apache.tamaya.osgi.commands.TamayaConfigService;
+
+import java.io.IOException;
+
+@Command(scope = "tamaya", name = "tm_config", description="Show the current Tamaya configuration.")
+@Service
+public class TamayaConfigCommand implements Action{
+
+    @Option(name = "section", aliases={"-s","--section"}, description = "A starting expression selecting the section to be filtered.",
+            required = false, multiValued = false)
+    String section = null;
+
+    @Option(name = "pid", aliases={"-p","--pid"}, description = "Apply filtering for the given OSGI component PID.",
+            required = false, multiValued = false)
+    String pid = null;
+
+    @org.apache.karaf.shell.api.action.lifecycle.Reference
+    TamayaConfigService configPlugin;
+
+
+    public Object execute() throws IOException {
+        if(pid!=null){
+            return(ConfigCommands.readTamayaConfig4PID(pid, section));
+        }
+        return(ConfigCommands.readTamayaConfig(section, null));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
----------------------------------------------------------------------
diff --git a/modules/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands b/modules/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
new file mode 100644
index 0000000..0876782
--- /dev/null
+++ b/modules/osgi/karaf-shell/src/main/resources/META-INF/services/org/apache/tamaya/karaf/shell/commands
@@ -0,0 +1,44 @@
+#
+# 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 current 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.
+#
+org.apache.tamaya.karaf.shell.ApplyTamayaConfig
+org.apache.tamaya.karaf.shell.PropagateUpdatesCommand
+org.apache.tamaya.karaf.shell.PropagateUpdatesSetCommand
+org.apache.tamaya.karaf.shell.BackupCreateCommand
+org.apache.tamaya.karaf.shell.BackupDeleteCommand
+org.apache.tamaya.karaf.shell.BackupListCommand
+org.apache.tamaya.karaf.shell.BackupRestoreCommand
+org.apache.tamaya.karaf.shell.DefaultEnableCommand
+org.apache.tamaya.karaf.shell.DefaultEnabledCommand
+org.apache.tamaya.karaf.shell.GetPolicyCommand
+org.apache.tamaya.karaf.shell.HistoryDeleteAllCommand
+org.apache.tamaya.karaf.shell.HistoryDeleteCommand
+org.apache.tamaya.karaf.shell.HistoryGetCommand
+org.apache.tamaya.karaf.shell.HistoryMaxsizeCommand
+org.apache.tamaya.karaf.shell.HistoryMaxsizeSetCommand
+org.apache.tamaya.karaf.shell.InfoCommand
+org.apache.tamaya.karaf.shell.OSGIConfigCommand
+org.apache.tamaya.karaf.shell.PolicyGetCommand
+org.apache.tamaya.karaf.shell.PolicySetCommand
+org.apache.tamaya.karaf.shell.PropertyGetCommand
+org.apache.tamaya.karaf.shell.PropertySourceCommand
+org.apache.tamaya.karaf.shell.PropertySourcesCommand
+org.apache.tamaya.karaf.shell.TamayaConfigCommand
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
new file mode 100644
index 0000000..0bcc741
--- /dev/null
+++ b/modules/osgi/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tamaya.ext</groupId>
+        <artifactId>tamaya-extensions</artifactId>
+        <version>0.4-incubating-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <artifactId>tamaya-osgi-all</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Tamaya :: OSGi Integration :: ALL</name>
+    <description>Tamaya OSGI Integration</description>
+
+    <properties>
+        <osgi.config.version>1.5.0</osgi.config.version>
+        <osgi.tracker.version>1.5.1</osgi.tracker.version>
+
+        <dependency.base.version>1.5.0</dependency.base.version>
+        <dependency.mockito.version>1.9.5</dependency.mockito.version>
+        <dependency.asm.version>3.0</dependency.asm.version>
+        <dependency.atinject.version>1.0</dependency.atinject.version>
+        <dependency.karaf.version>4.0.7</dependency.karaf.version>
+        <dependency.felix.version>5.6.1</dependency.felix.version>
+        <dependency.logback.version>1.0.7</dependency.logback.version>
+    </properties>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <version>${dependency.karaf.version}</version>
+                    <extensions>true</extensions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18</version>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.osgi</groupId>
+                <artifactId>org.osgi.service.cm</artifactId>
+                <version>${osgi.config.version}</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.osgi</groupId>
+                <artifactId>org.osgi.core</artifactId>
+                <version>${osgi.version}</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.osgi</groupId>
+                <artifactId>org.osgi.compendium</artifactId>
+                <version>${osgi.compendium.version}</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.osgi</groupId>
+                <artifactId>org.osgi.util.tracker</artifactId>
+                <version>${osgi.tracker.version}</version>
+                <scope>provided</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <modules>
+        <module>common</module>
+        <module>updater</module>
+        <module>karaf-shell</module>
+        <module>karaf-features</module>
+        <module>gogo-shell</module>
+        <module>injection</module>
+    </modules>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/a1cd433a/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
index 95feb73..fafe1f9 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -45,6 +45,8 @@ under the License.
         <module>resources</module>
         <module>spring</module>
         <module>jndi</module>
+        <module>osgi</module>
+        <module>microprofile</module>
     </modules>
 
 </project>