You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/15 17:26:36 UTC
[19/24] incubator-tamaya git commit: Removed all modules from the
main repository. They will be reborn in separate ASF repository.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
----------------------------------------------------------------------
diff --git a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener b/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
deleted file mode 100644
index f9942c1..0000000
--- a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
+++ /dev/null
@@ -1,19 +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 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.events.internal.DefaultConfigurationContextChangeListener
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.spi.ConfigEventManagerSpi
----------------------------------------------------------------------
diff --git a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.spi.ConfigEventManagerSpi b/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.spi.ConfigEventManagerSpi
deleted file mode 100644
index d45dc43..0000000
--- a/modules/events/src/main/resources/META-INF/services/org.apache.tamaya.events.spi.ConfigEventManagerSpi
+++ /dev/null
@@ -1,19 +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 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.events.internal.DefaultConfigEventManagerSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
deleted file mode 100644
index 0384064..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
+++ /dev/null
@@ -1,62 +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.events;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * PropertySource implementation that accesses properties that are statically stored.
- */
-public class ChangeableGlobalPropertySource extends BasePropertySource{
-
- private static final Map<String,String> STORED_ENTRIES = new ConcurrentHashMap<>();
-
- @Override
- public String getName() {
- return getClass().getSimpleName();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return null;
- }
-
- /**
- * Put a value (globally) into this property source.
- * @param key the key, not null
- * @param value the value, not null
- * @return the entry replaced, or null.
- */
- public static String put(String key, String value){
- return STORED_ENTRIES.put(key,value);
- }
-
- /**
- * Put all the properties, overriding any existing ones with the same key.
- * @param properties the properties, not null.
- */
- public static void putAll(Map<String,String> properties){
- STORED_ENTRIES.putAll(properties);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
deleted file mode 100644
index cc6c812..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
+++ /dev/null
@@ -1,57 +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.events;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * PropertySource implementation that accesses properties that are stored on ThreadLocal level, e.g. good to use for
- * testing..
- */
-public class ChangeableThreadLocalPropertySource extends BasePropertySource{
-
- private static final ThreadLocal<Map<String,String>> STORED_ENTRIES = new ThreadLocal<Map<String,String>>(){
- protected Map<String,String> initialValue(){
- return new HashMap<>();
- }
- };
-
- @Override
- public String getName() {
- return getClass().getSimpleName();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return null;
- }
-
- public static String put(String key, String value){
- return STORED_ENTRIES.get().put(key,value);
- }
-
- public static void putAll(Map<String,String> properties){
- STORED_ENTRIES.get().putAll(properties);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/ConfigEventManagerTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigEventManagerTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigEventManagerTest.java
deleted file mode 100644
index b56407c..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ConfigEventManagerTest.java
+++ /dev/null
@@ -1,66 +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.events;
-
-import org.junit.Test;
-
-import java.util.UUID;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link ConfigEventManager}.
- */
-public class ConfigEventManagerTest {
-
- private Object testAddListenerValue;
-
- @Test
- public void testAddRemoveListener() throws Exception {
- ConfigEventListener testListener = new ConfigEventListener() {
- @Override
- public void onConfigEvent(ConfigEvent<?> event) {
- testAddListenerValue = event.getResource();
- }
- };
- ConfigEventManager.addListener(testListener);
- ConfigEventManager.fireEvent(new SimpleEvent("Event1"));
- assertEquals(testAddListenerValue, "Event1");
- ConfigEventManager.removeListener(testListener);
- ConfigEventManager.fireEvent(new SimpleEvent("Event2"));
- assertEquals(testAddListenerValue, "Event1");
- }
-
- @Test
- public void testFireEvent() throws Exception {
- ConfigEventListener testListener = new ConfigEventListener() {
- @Override
- public void onConfigEvent(ConfigEvent<?> event) {
- testAddListenerValue = event.getResource();
- }
- };
- ConfigEventManager.addListener(testListener);
- ConfigEventManager.fireEvent(new SimpleEvent("Event1"));
- assertEquals(testAddListenerValue, "Event1");
- ConfigEventManager.removeListener(testListener);
- ConfigEventManager.fireEvent(new SimpleEvent("Event2"));
- assertEquals(testAddListenerValue, "Event1");
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java b/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
deleted file mode 100644
index 1431228..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
+++ /dev/null
@@ -1,106 +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.events;
-
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link org.apache.tamaya.events.FrozenPropertySource}.
- */
-public class FrozenPropertySourceTest {
-
- private static final PropertySource myPS = new SystemPropertySource();
-
- @Test
- public void testOf() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- assertNotNull(ps);
- }
-
- @Test
- public void testGetName() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- String name = ps.getName();
- assertNotNull(name);
- assertEquals(name, ps.getName());
- }
-
- @Test
- public void testGetOrdinal() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- assertEquals(myPS.getOrdinal(), ps.getOrdinal());
- }
-
- @Test
- public void testGet() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- assertNotNull(ps);
- for (Map.Entry<String, String> e : myPS.getProperties().entrySet()) {
- assertEquals(ps.get(e.getKey()).getValue(), e.getValue());
- }
- }
-
- @Test
- public void testGetProperties() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- assertNotNull(ps);
- assertNotNull(ps.getProperties());
- assertFalse(ps.getProperties().isEmpty());
- }
-
- @Test
- public void testEquals() throws Exception {
- PropertySource ps1 = FrozenPropertySource.of(myPS);
- PropertySource ps2 = FrozenPropertySource.of(myPS);
- assertEquals(ps1.getName(), ps2.getName());
- assertEquals(ps1.getProperties().size(), ps2.getProperties().size());
- }
-
- @Test
- public void testHashCode() throws Exception {
- boolean alwaysDifferent = true;
- for(int i=0;i<10;i++){
- PropertySource ps1 = FrozenPropertySource.of(myPS);
- PropertySource ps2 = FrozenPropertySource.of(myPS);
- // sometimes not same, because frozenAt in ms maybe different
- if(ps1.hashCode()==ps2.hashCode()){
- alwaysDifferent=false;
- break;
- }
- }
- if(alwaysDifferent){
- fail("HashCode should be same if frozenAt is in the same ms...");
- }
- }
-
- @Test
- public void testToString() throws Exception {
- PropertySource ps = FrozenPropertySource.of(myPS);
- String toString = ps.toString();
- assertNotNull(toString);
- assertTrue(toString.contains("FrozenPropertySource"));
- assertTrue(toString.contains(myPS.getName()));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
deleted file mode 100644
index 0cd9e2b..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
+++ /dev/null
@@ -1,69 +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.events;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test (currently manual) to test configuration changes.
- */
-public class ObservedConfigTest {
-
- @Test
- @Ignore // reactivate later...
- public void testChangingConfig() throws IOException {
- Configuration config = ConfigurationProvider.getConfiguration().with(TestConfigView.of());
-
- Map<String, String> props = config.getProperties();
- assertEquals(props.get("test"), "test2");
- assertEquals(props.get("testValue1"), "value");
- assertNull(props.get("testValue2"));
-
- //insert a new properties file into the tempdirectory
- FileUtils.writeStringToFile(
- new File(TestObservingProvider.propertyLocation.toFile(), "test2.properties"),
- "testValue2=anotherValue");
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- config = ConfigurationProvider.getConfiguration().with(TestConfigView.of());
-
- props = config.getProperties();
-
- assertEquals(props.get("test"), "test2");
- assertEquals(props.get("testValue1"), "value");
- assertEquals(props.get("testValue2"), "anotherValue");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
deleted file mode 100644
index dead0d9..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
+++ /dev/null
@@ -1,66 +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.events;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * PropertySource that provides a randome entry, different on each access!
- */
-public class RandomPropertySource implements PropertySource{
-
- private Map<String, String> data = new HashMap<>();
-
- @Override
- public int getOrdinal() {
- return 0;
- }
-
- @Override
- public String getName() {
- return "random";
- }
-
- @Override
- public PropertyValue get(String key) {
- if(key.equals("random.new")){
- return PropertyValue.of(key, String.valueOf(Math.random()),getName());
- }
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- synchronized(data) {
- data.put("random.new", String.valueOf(Math.random()));
- data.put("_random.new.source", getName());
- data.put("_random.new.timestamp", String.valueOf(System.currentTimeMillis()));
- return new HashMap<>(data);
- }
- }
-
- @Override
- public boolean isScannable() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/SimpleEvent.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/SimpleEvent.java b/modules/events/src/test/java/org/apache/tamaya/events/SimpleEvent.java
deleted file mode 100644
index 5017aa1..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/SimpleEvent.java
+++ /dev/null
@@ -1,32 +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.events;
-
-import org.apache.tamaya.events.spi.BaseConfigEvent;
-
-/**
- * Simple test event for testing only.
- */
-public class SimpleEvent extends BaseConfigEvent<String> {
-
- public SimpleEvent(String paylod) {
- super(paylod, String.class);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java b/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
deleted file mode 100644
index 8e5b397..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/TestConfigView.java
+++ /dev/null
@@ -1,156 +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.events;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigOperator;
-import org.apache.tamaya.ConfigQuery;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Created by Anatole on 24.03.2015.
- */
-public class TestConfigView implements ConfigOperator{
-
- private static final TestConfigView INSTANCE = new TestConfigView();
-
- private TestConfigView(){}
-
- public static ConfigOperator of(){
- return INSTANCE;
- }
-
- @Override
- public Configuration operate(final Configuration config) {
- return new Configuration() {
- @Override
- public Map<String, String> getProperties() {
- Map<String, String> result = new HashMap<>();
- for (Map.Entry<String, String> en : config.getProperties().entrySet()) {
- if (en.getKey().startsWith("test")) {
- result.put(en.getKey(), en.getValue());
- }
- }
- return result;
-// return config.getProperties().entrySet().stream().filter(e -> e.getKey().startsWith("test")).collect(
-// Collectors.toMap(en -> en.getKey(), en -> en.getValue()));
- }
-
- @Override
- public Configuration with(ConfigOperator operator) {
- return null;
- }
-
- @Override
- public <T> T query(ConfigQuery<T> query) {
- return null;
- }
-
- @Override
- public ConfigurationContext getContext() {
- return config.getContext();
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public String getOrDefault(String key, String defaultValue) {
- String val = get(key);
- if(val==null){
- return defaultValue;
- }
- return val;
- }
-
- @Override
- public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
- T val = get(key, type);
- if(val==null){
- return defaultValue;
- }
- return val;
- }
-
- @Override
- public <T> T get(String key, Class<T> type) {
- return (T) get(key, TypeLiteral.of(type));
- }
-
- /**
- * Accesses the current String value for the given key and tries to convert it
- * using the {@link org.apache.tamaya.spi.PropertyConverter} instances provided by the current
- * {@link org.apache.tamaya.spi.ConfigurationContext}.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @param <T> the value type
- * @return the converted value, never null.
- */
- @Override
- public <T> T get(String key, TypeLiteral<T> type) {
- String value = get(key);
- if (value != null) {
- List<PropertyConverter<T>> converters = ConfigurationProvider.getConfigurationContext()
- .getPropertyConverters(type);
- ConversionContext context = new ConversionContext.Builder(
- key,type).build();
- for (PropertyConverter<T> converter : converters) {
- try {
- T t = converter.convert(value, context);
- if (t != null) {
- return t;
- }
- } catch (Exception e) {
- Logger.getLogger(getClass().getName())
- .log(Level.FINEST, "PropertyConverter: " + converter + " failed to convert value: "
- + value, e);
- }
- }
- throw new ConfigException("Unparseable config value for type: " + type.getRawType().getName() + ": "
- + key + ", supportedFormats: " + context.getSupportedFormats());
- }
- return null;
- }
-
- @Override
- public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
- T val = get(key, type);
- if(val==null){
- return defaultValue;
- }
- return val;
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/TestObservingProvider.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/TestObservingProvider.java b/modules/events/src/test/java/org/apache/tamaya/events/TestObservingProvider.java
deleted file mode 100644
index 2685d3e..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/TestObservingProvider.java
+++ /dev/null
@@ -1,92 +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.events;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.tamaya.events.folderobserver.ObservingPropertySourceProvider;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Test configuration property source provider that observes a directory and updated the config if necessary.
- */
-public class TestObservingProvider extends ObservingPropertySourceProvider{
-
- public static Path propertyLocation;
-
- static{
- try {
- // create some temporary config
- Path tempDir = Files.createTempDirectory("observedFolder");
-
- TestObservingProvider.propertyLocation = tempDir;
-
- FileUtils.copyInputStreamToFile(
- TestObservingProvider.class.getResourceAsStream("/test.properties"),
- new File(tempDir.toFile(), "test.properties"));
-
- Runtime.getRuntime().addShutdownHook(new Thread(){
- @Override
- public void run(){
- try{
- // cleanup directory
- Files.deleteIfExists(getTargetFile("test1.properties"));
- Files.deleteIfExists(getTargetFile("test2.properties"));
- Files.deleteIfExists(getTargetFile("test3.properties"));
- }
- catch(Exception e){
- Logger.getLogger("TestObservingProvider").log(Level.WARNING,
- "Failed to cleanup config test dir", e);
- }
- }
- });
- }
- catch(Exception e){
- Logger.getLogger("TestObservingProvider").log(Level.WARNING, "Failed to init config test dir", e);
- }
- }
-
- private static Path getTargetFile(String name) {
- File testFile = new File(TestObservingProvider.getTestDirectory(), name);
- return Paths.get(testFile.toURI());
- }
-
- public TestObservingProvider(){
- super(propertyLocation);
- Logger.getLogger(getClass().getName()).info("Using test directory: " + getTestPath());
- }
-
- public static File getTestDirectory(){
- String tempDir = System.getProperty("java.io.tmpdir");
- File dir = new File(tempDir, "tamaya-events-testdir");
- if(!dir.exists()){
- dir.mkdirs();
- }
- return dir;
- }
-
- private static String getTestPath(){
- return getTestDirectory().getAbsolutePath();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
deleted file mode 100644
index b20ebef..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationChangeTest.java
+++ /dev/null
@@ -1,163 +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.events.delta;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.events.ConfigurationChange;
-import org.apache.tamaya.events.ConfigurationChangeBuilder;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class for {@link ConfigurationChange}.
- */
-public class ConfigurationChangeTest {
-
- @Test
- public void testEmptyChangeSet() throws Exception {
- ConfigurationChange change = ConfigurationChange.emptyChangeSet(ConfigurationProvider.getConfiguration());
- assertNotNull(change);
- assertTrue(change.isEmpty());
- }
-
- @Test
- public void testGetConfiguration() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
- assertNotNull(change);
- assertTrue(change.getUpdatedSize()==0);
- assertTrue(change.getAddedSize()==0);
- assertTrue(change.getRemovedSize()==0);
- assertTrue(change.getChanges().size()==0);
- for (Map.Entry<String, String> en : config.getProperties().entrySet()) {
- if (!"[meta]frozenAt".equals(en.getKey())) {
- if(en.getKey().contains("random.new")){ // dynamic generated value!
- continue;
- }
- assertEquals("Error for " + en.getKey(), en.getValue(), change.getResource().get(en.getKey()));
- }
- }
- }
-
- @Test
- public void testGetVersion() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
- assertNotNull(change.getVersion());
- change = ConfigurationChangeBuilder.of(config).setVersion("version2").build();
- assertNotNull(change.getVersion());
- assertEquals("version2", change.getVersion());
- }
-
- @Test
- public void testGetTimestamp() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
- assertTrue((System.currentTimeMillis() - change.getTimestamp()) <= 10L);
- change = ConfigurationChangeBuilder.of(config).setTimestamp(10L).build();
- assertEquals(10L, change.getTimestamp());
- }
-
- @Test
- public void testGetEvents() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("key1", "key2").build();
- assertTrue(change.getChanges().size() == 2);
- change = ConfigurationChangeBuilder.of(config).addChange("key1Added", "value1Added").build();
- assertTrue(change.getChanges().size() == 1);
- }
-
- @Test
- public void testGetRemovedSize() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("java.version", "key2").build();
- assertTrue(change.getRemovedSize() == 2);
- assertTrue(change.getAddedSize() == 0);
- }
-
- @Test
- public void testGetAddedSize() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
- assertTrue(change.getAddedSize() == 1);
- assertTrue(change.getRemovedSize() == 0);
- }
-
- @Test
- public void testGetUpdatedSize() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("java.version", "1.8").build();
- assertTrue(change.getUpdatedSize() == 1);
- }
-
- @Test
- public void testIsRemoved() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
- assertTrue(change.isRemoved("java.version"));
- }
-
- @Test
- public void testIsAdded() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
- assertTrue(change.isAdded("key1"));
- }
-
- @Test
- public void testIsUpdated() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("java.version", "1.8").build();
- assertTrue(change.isUpdated("java.version"));
- }
-
- @Test
- public void testContainsKey() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
- assertTrue(change.isKeyAffected("key1"));
- assertFalse(change.isKeyAffected("key2"));
- change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
- assertFalse(change.isKeyAffected("java.version"));
- assertFalse(change.isKeyAffected("key2"));
- }
-
- @Test
- public void testIsEmpty() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
- assertTrue(change.isEmpty());
- }
-
- @Test
- public void testToString() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
- change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
- assertTrue(change.toString().contains("timestamp"));
- assertTrue(change.toString().contains("version"));
- assertTrue(change.toString().contains("configuration"));
- assertFalse(change.toString().contains("key1"));
- assertFalse(change.toString().contains("key2"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationContextChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationContextChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationContextChangeTest.java
deleted file mode 100644
index ee631ce..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/delta/ConfigurationContextChangeTest.java
+++ /dev/null
@@ -1,138 +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.events.delta;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.events.ChangeType;
-import org.apache.tamaya.events.ConfigurationContextChange;
-import org.apache.tamaya.events.ConfigurationContextChangeBuilder;
-import org.apache.tamaya.events.PropertySourceChangeBuilder;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class for {@link ConfigurationContextChange}.
- */
-public class ConfigurationContextChangeTest {
-
- @Test
- public void testEmptyChangeSet() throws Exception {
- ConfigurationContextChange change = ConfigurationContextChange.emptyChangeSet(
- ConfigurationProvider.getConfigurationContext());
- assertNotNull(change);
- assertTrue(change.isEmpty());
- }
-
- @Test
- public void testGetVersion() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertNotNull(change.getVersion());
- change = ConfigurationContextChangeBuilder.of().setVersion("version2").build();
- assertNotNull(change.getVersion());
- assertEquals("version2", change.getVersion());
- }
-
- @Test
- public void testGetTimestamp() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue((System.currentTimeMillis() - change.getTimestamp()) <= 10L);
- change = ConfigurationContextChangeBuilder.of().setTimestamp(10L).build();
- assertEquals(10L, change.getTimestamp());
- }
-
- @Test
- public void testGetPropertySourceChanges() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- }
-
- @Test
- public void testGetPropertySourceUpdates() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceUpdates(). isEmpty());
- }
-
- @Test
- public void testGetRemovedPropertySources() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getRemovedPropertySources(). isEmpty());
- }
-
- @Test
- public void testGetAddedPropertySources() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getAddedPropertySources().isEmpty());
- }
-
- @Test
- public void testGetUpdatedPropertySources() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getPropertySourceChanges(). isEmpty());
- change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.getUpdatedPropertySources().isEmpty());
- }
-
- @Test
- public void testIsAffected() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- PropertySource ps = new SystemPropertySource();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().changedPropertySource(
- PropertySourceChangeBuilder.of(ps, ChangeType.UPDATED).build()
- ).build();
- String toString = change.toString();
- assertTrue(change.isAffected(ps));
- }
-
- @Test
- public void testIsEmpty() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().build();
- assertTrue(change.isEmpty());
- change = ConfigurationContextChangeBuilder.of().newPropertySource(new SystemPropertySource()).build();
- assertFalse(change.isEmpty());
- }
-
- @Test
- public void testToString() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- ConfigurationContextChange change = ConfigurationContextChangeBuilder.of().newPropertySource(new SystemPropertySource()).build();
- String toString = change.toString();
- assertNotNull(toString);
- assertTrue(toString.contains(new SystemPropertySource().getName()));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/delta/PropertySourceChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/delta/PropertySourceChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/delta/PropertySourceChangeTest.java
deleted file mode 100644
index 0dcdfba..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/delta/PropertySourceChangeTest.java
+++ /dev/null
@@ -1,209 +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.events.delta;
-
-import org.apache.tamaya.core.propertysource.EnvironmentPropertySource;
-import org.apache.tamaya.core.propertysource.SimplePropertySource;
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.events.ChangeType;
-import org.apache.tamaya.events.PropertySourceChange;
-import org.apache.tamaya.events.PropertySourceChangeBuilder;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link PropertySourceChange} and its builder.
- */
-public class PropertySourceChangeTest {
-
- private static final PropertySource myPS = new SystemPropertySource();
-
- @Test
- public void testGetChangeType() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED).build();
- assertEquals(change.getChangeType(), ChangeType.DELETED);
- change = PropertySourceChangeBuilder.of(myPS, ChangeType.UPDATED).build();
- assertEquals(change.getChangeType(), ChangeType.UPDATED);
- }
-
- @Test
- public void testGetPropertySource() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED).build();
- assertEquals(change.getResource().getName(), myPS.getName());
- }
-
- @Test
- public void testGetVersion() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED)
- .setVersion("myVersion1").build();
- assertEquals(change.getVersion(), "myVersion1");
- }
-
- @Test
- public void testGetTimestamp() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED)
- .setTimestamp(111L).build();
- assertEquals(change.getTimestamp(), 111L);
- }
-
- @Test
- public void testGetEvents() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED)
- .addChanges(
- new EnvironmentPropertySource()
- ).build();
- assertTrue(change.getChanges().size()>0);
- }
-
- @Test
- public void testGetRemovedSize() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.UPDATED)
- .addChanges(
- new EnvironmentPropertySource()
- ).build();
- assertTrue(change.getRemovedSize()>0);
- }
-
- @Test
- public void testGetAddedSize() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED)
- .addChanges(
- new EnvironmentPropertySource()
- ).build();
- assertTrue(change.getAddedSize()>0);
- }
-
- @Test
- public void testGetUpdatedSize() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(myPS, ChangeType.DELETED)
- .addChanges(
- new EnvironmentPropertySource()
- ).build();
- assertTrue(change.getUpdatedSize()==0);
- }
-
- @Test
- public void testIsRemoved() throws Exception {
- Map<String, String> testData = new HashMap<>();
- testData.put("key1", "value1");
- testData.put("key2", "value2");
- PropertySource ps1 = new SimplePropertySource("test", testData);
- testData = new HashMap<>();
- testData.put("key1", "value2");
- testData.put("key3", "value3");
- PropertySource ps2 = new SimplePropertySource("test", testData);
- PropertySourceChange change = PropertySourceChangeBuilder.of(ps1, ChangeType.UPDATED)
- .addChanges(
- ps2
- ).build();
- assertFalse(change.isRemoved("key1"));
- assertTrue(change.isRemoved("key2"));
- assertFalse(change.isRemoved("key3"));
- }
-
- @Test
- public void testIsAdded() throws Exception {
- Map<String, String> testData = new HashMap<>();
- testData.put("key1", "value1");
- testData.put("key2", "value2");
- PropertySource ps1 = new SimplePropertySource("test", testData);
- testData = new HashMap<>();
- testData.put("key1", "value2");
- testData.put("key3", "value3");
- PropertySource ps2 = new SimplePropertySource("test", testData);
- PropertySourceChange change = PropertySourceChangeBuilder.of(ps1, ChangeType.UPDATED)
- .addChanges(
- ps2
- ).build();
- assertTrue(change.isAdded("key3"));
- assertFalse(change.isAdded("key2"));
- assertFalse(change.isAdded("key1"));
- }
-
- @Test
- public void testIsUpdated() throws Exception {
- Map<String, String> testData = new HashMap<>();
- testData.put("key1", "value1");
- testData.put("key2", "value2");
- PropertySource ps1 = new SimplePropertySource("test", testData);
- testData = new HashMap<>();
- testData.put("key1", "value2");
- testData.put("key3", "value3");
- PropertySource ps2 = new SimplePropertySource("test", testData);
- PropertySourceChange change = PropertySourceChangeBuilder.of(ps1, ChangeType.UPDATED)
- .addChanges(
- ps2
- ).build();
- assertTrue(change.isUpdated("key1"));
- assertFalse(change.isUpdated("key2"));
- assertFalse(change.isUpdated("key3"));
- }
-
- @Test
- public void testContainsKey() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource(), ChangeType.DELETED)
- .addChanges(
- myPS
- ).build();
- assertTrue(change.isKeyAffected("java.version"));
- }
-
- @Test
- public void testIsEmpty() throws Exception {
- PropertySourceChange change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource(), ChangeType.DELETED)
- .build();
- assertTrue(change.isEmpty());
- change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource(), ChangeType.DELETED)
- .addChanges(
- myPS
- ).build();
- assertFalse(change.isEmpty());
- }
-
- @Test
- public void testOfAdded() throws Exception {
- PropertySourceChange change = PropertySourceChange.ofAdded(myPS);
- assertNotNull(change);
- assertEquals(change.getChangeType(), ChangeType.NEW);
- }
-
- @Test
- public void testOfDeleted() throws Exception {
- PropertySourceChange change = PropertySourceChange.ofDeleted(myPS);
- assertNotNull(change);
- assertEquals(change.getChangeType(), ChangeType.DELETED);
- }
-
- @Test
- public void testToString() throws Exception {
- PropertySourceChange change = PropertySourceChange.ofAdded(myPS);
- String toString = change.toString();
- assertNotNull(toString);
- assertTrue(toString.contains(myPS.getName()));
- change = PropertySourceChange.ofDeleted(myPS);
- toString = change.toString();
- assertNotNull(toString);
- assertTrue(toString.contains(myPS.getName()));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigEventManagerSpiTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigEventManagerSpiTest.java b/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigEventManagerSpiTest.java
deleted file mode 100644
index d54a66e..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/internal/DefaultConfigEventManagerSpiTest.java
+++ /dev/null
@@ -1,66 +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.events.internal;
-
-import org.apache.tamaya.events.ConfigEvent;
-import org.apache.tamaya.events.ConfigEventListener;
-import org.apache.tamaya.events.SimpleEvent;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for {@link DefaultConfigEventManagerSpi}.
- */
-public class DefaultConfigEventManagerSpiTest {
-
- private final DefaultConfigEventManagerSpi spi = new DefaultConfigEventManagerSpi();
- private Object testAddListenerValue;
-
- @Test
- public void testAddListener() throws Exception {
- ConfigEventListener testListener = new ConfigEventListener() {
- @Override
- public void onConfigEvent(ConfigEvent<?> event) {
- testAddListenerValue = event.getResource();
- }
- };
- spi.addListener(testListener);
- spi.fireEvent(new SimpleEvent("Event1"));
- assertEquals(testAddListenerValue, "Event1");
- spi.removeListener(testListener);
- spi.fireEvent(new SimpleEvent("Event2"));
- assertEquals(testAddListenerValue, "Event1");
-
- }
-
- @Test
- public void testRemoveListener() throws Exception {
- ConfigEventListener testListener = new ConfigEventListener() {
-
- @Override
- public void onConfigEvent(ConfigEvent<?> event) {
- testAddListenerValue = event;
- }
- };
- spi.removeListener(testListener);
- spi.removeListener(testListener);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
deleted file mode 100644
index f675fd6..0000000
--- a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.events.ConfigEventListener
+++ /dev/null
@@ -1,19 +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 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.events.internal.DefaultConfigurationContextChangeListener
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 9c2b9f6..0000000
--- a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,19 +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 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.events.RandomPropertySource
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index d34b4a2..0000000
--- a/modules/events/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /dev/null
@@ -1,19 +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 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.events.TestObservingProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/data/test1.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/data/test1.properties b/modules/events/src/test/resources/data/test1.properties
deleted file mode 100644
index 0df3bd1..0000000
--- a/modules/events/src/test/resources/data/test1.properties
+++ /dev/null
@@ -1,20 +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 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.
-#
-1=val1
-3=val3
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/data/test1b.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/data/test1b.properties b/modules/events/src/test/resources/data/test1b.properties
deleted file mode 100644
index ec57163..0000000
--- a/modules/events/src/test/resources/data/test1b.properties
+++ /dev/null
@@ -1,20 +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 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.
-#
-1b=val1
-7=val7
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/data/test2.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/data/test2.properties b/modules/events/src/test/resources/data/test2.properties
deleted file mode 100644
index 0643c1d..0000000
--- a/modules/events/src/test/resources/data/test2.properties
+++ /dev/null
@@ -1,20 +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 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.
-#
-4=val4
-6=val6
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/data/test3.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/data/test3.properties b/modules/events/src/test/resources/data/test3.properties
deleted file mode 100644
index bb856c7..0000000
--- a/modules/events/src/test/resources/data/test3.properties
+++ /dev/null
@@ -1,20 +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 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.
-#
-2=val2
-5=val5
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/events/src/test/resources/test.properties
----------------------------------------------------------------------
diff --git a/modules/events/src/test/resources/test.properties b/modules/events/src/test/resources/test.properties
deleted file mode 100644
index af06631..0000000
--- a/modules/events/src/test/resources/test.properties
+++ /dev/null
@@ -1,21 +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 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.
-#
-testValue1=value
-test=test2
-a=b
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/filter/pom.xml
----------------------------------------------------------------------
diff --git a/modules/filter/pom.xml b/modules/filter/pom.xml
deleted file mode 100644
index d9d4854..0000000
--- a/modules/filter/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?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.
--->
-<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.3-incubating-SNAPSHOT</version>
- </parent>
-
- <artifactId>tamaya-filter</artifactId>
- <name>Apache Tamaya Modules - Adaptive Configuration Filtering</name>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.filter,
- </Export-Package>
- <!--<Private-Package>-->
- <!--org.apache.tamaya.events.internal-->
- <!--</Private-Package>-->
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
----------------------------------------------------------------------
diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
deleted file mode 100644
index c2739a1..0000000
--- a/modules/filter/src/main/java/org/apache/tamaya/filter/ConfigurationFilter.java
+++ /dev/null
@@ -1,121 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-
-/**
- * Hereby
- * <ul>
- * <li><b>Single</b> filters are applied only when values are explicitly accessed. This is useful, e.g. for
- * filtering passwords into clear text variants. Nevertheless metadata keys hidden on map level must be
- * accessible (=not filtered) when accessed as single values.</li>
- * <li><b>Map</b> filters are applied when values are filtered as part of a full properties access.
- * Often filtering in these cases is more commonly applied, e.g. you dont want to show up all kind of metadata.
- * </li>
- * </ul>
- * For both variants individual filter rules can be applied here. All filters configured are managed on a
- * thread-local level, so this class is typically used to temporarely filter out some values. Do not forget to
- * restore its state, when not using a thread anymore (especially important in multi-threaded environments), not
- * doing so will create nasty side effects of configuration not being visisble depending on the thread
- * active.
- */
-public final class ConfigurationFilter implements PropertyFilter{
-
- static final ThreadLocal<Boolean> THREADED_METADATA_FILTERED = new ThreadLocal<Boolean>(){
- @Override
- protected Boolean initialValue() {
- return Boolean.TRUE;
- }
- };
-
- private static final ThreadLocal<ProgrammableFilter> THREADED_MAP_FILTERS = new ThreadLocal<ProgrammableFilter>(){
- @Override
- protected ProgrammableFilter initialValue() {
- return new ProgrammableFilter();
- }
- };
-
- private static final ThreadLocal<ProgrammableFilter> THREADED_SINGLE_FILTERS = new ThreadLocal<ProgrammableFilter>(){
- @Override
- protected ProgrammableFilter initialValue() {
- return new ProgrammableFilter();
- }
- };
-
- /**
- * Flag if metadata entries (starting with an '_') are filtered out on when accessing multiple properties, default
- * is {@code true}.
- * @return true, if metadata entries (starting with an '_') are to be filtered.
- */
- public static boolean isMetadataFiltered(){
- return THREADED_METADATA_FILTERED.get();
- }
-
- /**
- * Seactivates metadata filtering also on global map access for this thread.
- * @see #clearFilters()
- * @param filtered true,to enable metadata filtering (default).
- */
- public static void setMetadataFiltered(boolean filtered){
- THREADED_METADATA_FILTERED.set(filtered);
- }
-
- /**
- * Access the filtering configuration that is used for filtering single property values accessed.
- * @return the filtering config, never null.
- */
- public static ProgrammableFilter getSingleFilters(){
- return THREADED_SINGLE_FILTERS.get();
- }
-
- /**
- * Access the filtering configuration that is used for filtering configuration properties accessed as full
- * map.
- * @return the filtering config, never null.
- */
- public static ProgrammableFilter getMapFilters(){
- return THREADED_MAP_FILTERS.get();
- }
-
- /**
- * Removes all programmable filters active on the current thread.
- */
- public static void clearFilters(){
- THREADED_MAP_FILTERS.get().clearFilters();
- THREADED_SINGLE_FILTERS.get().clearFilters();
- THREADED_METADATA_FILTERED.set(true);
- }
-
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context) {
- if(context.isSinglePropertyScoped()){
- for(PropertyFilter pred: THREADED_SINGLE_FILTERS.get().getFilters()){
- valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
- }
- }else{
- for(PropertyFilter pred: THREADED_MAP_FILTERS.get().getFilters()){
- valueToBeFiltered = pred.filterProperty(valueToBeFiltered, context);
- }
- }
- return valueToBeFiltered;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
----------------------------------------------------------------------
diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
deleted file mode 100644
index ec6040c..0000000
--- a/modules/filter/src/main/java/org/apache/tamaya/filter/ProgrammableFilter.java
+++ /dev/null
@@ -1,118 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A set of property filter and accessor methods.
- */
-public final class ProgrammableFilter implements PropertyFilter{
- /** The filters. */
- private List<PropertyFilter> filters = new ArrayList<>();
-
- /**
- * Add a filter.
- * @param filter the filter.
- */
- public void addFilter(PropertyFilter filter){
- filters.add(filter);
- }
-
- /**
- * Adds a filter at given position.
- * @param pos the position.
- * @param filter the filter.
- */
- public void addFilter(int pos, PropertyFilter filter){
- filters.add(pos, filter);
- }
-
- /**
- * Removes a filter at a given position.
- * @param pos the position.
- * @return the filter removed, or null.
- */
- public PropertyFilter removeFilter(int pos){
- return filters.remove(pos);
- }
-
- /**
- * Removes a filter.
- * @param filter the filter to be removed, not null.
- */
- public void removeFilter(PropertyFilter filter) {
- filters.remove(filter);
- }
-
- /**
- * Clears all filters.
- */
- public void clearFilters(){
- filters.clear();
- }
-
- /**
- * Set the filters.
- * @param filters the filters to be applied.
- */
- public void setFilters(PropertyFilter... filters){
- setFilters(Arrays.asList(filters));
- }
-
- /**
- * Set the filters.
- * @param filters the filters to be applied.
- */
- public void setFilters(Collection<PropertyFilter> filters) {
- this.filters.clear();
- this.filters.addAll(filters);
- }
-
- /**
- * Get all filters.
- * @return all filters.
- */
- public List<PropertyFilter> getFilters(){
- return Collections.unmodifiableList(filters);
- }
-
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context) {
- for(PropertyFilter filter:filters){
- valueToBeFiltered = filter.filterProperty(valueToBeFiltered, context);
- }
- return valueToBeFiltered;
- }
-
- @Override
- public String toString() {
- return "ProgrammableFilter{" +
- "filters=" + filters +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
----------------------------------------------------------------------
diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
deleted file mode 100644
index 1ed43ba..0000000
--- a/modules/filter/src/main/java/org/apache/tamaya/filter/RegexPropertyFilter.java
+++ /dev/null
@@ -1,56 +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.filter;
-
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import java.util.Objects;
-
-/**
- * Predicate filtering using a regex expression operating on the key.
- */
-public final class RegexPropertyFilter implements PropertyFilter{
- /** The expression used to filter. */
- private String expression;
-
- /**
- * Creates a new regex filter expression.
- * @param expression the reged expression, not null.
- */
- public RegexPropertyFilter(String expression){
- this.expression = Objects.requireNonNull(expression);
- }
-
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context) {
- if(context.getKey().matches(expression)){
- return null;
- }
- return valueToBeFiltered;
- }
-
- @Override
- public String toString() {
- return "RegexPropertyFilter{" +
- "expression='" + expression + '\'' +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/359d3e4a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
----------------------------------------------------------------------
diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
deleted file mode 100644
index 95e9d25..0000000
--- a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
+++ /dev/null
@@ -1,43 +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.filter.internal;
-
-import org.apache.tamaya.filter.ConfigurationFilter;
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-/**
- * Default property filter that hides metadta entries starting with an '_', similar ti {@code etcd}.
- */
-public final class DefaultMetadataFilter implements PropertyFilter{
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context) {
- if(context.isSinglePropertyScoped()){
- // When accessing keys explicitly, do not hide anything.
- return valueToBeFiltered;
- }
- if(ConfigurationFilter.isMetadataFiltered()) {
- if (context.getKey().startsWith("_")) {
- // Hide metadata entries.
- return null;
- }
- }
- return valueToBeFiltered;
- }
-}