Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/master 3aa3145e2 -> eeab5ce02


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/eeab5ce0/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
----------------------------------------------------------------------
diff --git 
a/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java 
b/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
deleted file mode 100644
index 68e9bcb..0000000
--- 
a/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/EventListener.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-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-sandbox/blob/eeab5ce0/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
----------------------------------------------------------------------
diff --git 
a/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
 
b/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
deleted file mode 100644
index adca9f3..0000000
--- 
a/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/AbstractOSGITest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tamaya.osgi.updater;
-
-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-sandbox/blob/eeab5ce0/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
----------------------------------------------------------------------
diff --git 
a/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java 
b/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
deleted file mode 100644
index 5e1f614..0000000
--- 
a/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-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-sandbox/blob/eeab5ce0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5c4b2d5..a41d4d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -747,10 +747,8 @@ under the License.
         <module>camel</module>
         <module>propertysources</module>
         <!--<module>ui</module>-->
-        <module>osgi</module>
         <module>management</module>
         <module>metamodel</module>
-        <module>microprofile</module>
         <module>uom</module>
         <module>vertx</module>
     </modules>

Reply via email to