You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by st...@apache.org on 2015/01/07 23:21:38 UTC
[5/9] incubator-tamaya git commit: TAMAYA-49 move api and core to
java8 module
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
deleted file mode 100644
index b6acae5..0000000
--- a/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ /dev/null
@@ -1,183 +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.core.internal;
-
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.ServiceContext;
-
-import javax.annotation.Priority;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.StampedLock;
-
-/**
- * Default Implementation of a simple ConfigurationContext.
- */
-public class DefaultConfigurationContext implements ConfigurationContext {
- /**
- * Cubcomponent handling {@link org.apache.tamaya.spi.PropertyConverter} instances.
- */
- private PropertyConverterManager propertyConverterManager = new PropertyConverterManager();
-
- /**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertySource} instances.
- */
- private List<PropertySource> immutablePropertySources;
-
- /**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertyFilter} instances.
- */
- private List<PropertyFilter> immutablePropertyFilters;
-
- /**
- * Lock for internal synchronization.
- */
- private StampedLock propertySourceLock = new StampedLock();
-
-
- /**
- * The first time the Configuration system gets invoked we do initialize
- * all our {@link org.apache.tamaya.spi.PropertySource}s and
- * {@link org.apache.tamaya.spi.PropertyFilter}s which are known at startup.
- */
- public DefaultConfigurationContext() {
- List<PropertySource> propertySources = new ArrayList<>();
-
- // first we load all PropertySources which got registered via java.util.ServiceLoader
- propertySources.addAll(ServiceContext.getInstance().getServices(PropertySource.class));
-
- // after that we add all PropertySources which get dynamically registered via their PropertySourceProviders
- propertySources.addAll(evaluatePropertySourcesFromProviders());
-
- // now sort them according to their ordinal values
- Collections.sort(propertySources, this::comparePropertySources);
-
- immutablePropertySources = Collections.unmodifiableList(propertySources);
-
- // as next step we pick up the PropertyFilters pretty much the same way
- List<PropertyFilter> propertyFilters = new ArrayList<>();
- propertyFilters.addAll(ServiceContext.getInstance().getServices(PropertyFilter.class));
- Collections.sort(propertyFilters, this::comparePropertyFilters);
-
- immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
- }
-
- /**
- * Pick up all {@link org.apache.tamaya.spi.PropertySourceProvider}s and return all the
- * {@link org.apache.tamaya.spi.PropertySource}s they like to register.
- */
- private Collection<? extends PropertySource> evaluatePropertySourcesFromProviders() {
- List<PropertySource> propertySources = new ArrayList<>();
- List<PropertySourceProvider> propertySourceProviders = ServiceContext.getInstance().getServices(PropertySourceProvider.class);
- for (PropertySourceProvider propertySourceProvider : propertySourceProviders) {
- propertySources.addAll(propertySourceProvider.getPropertySources());
- }
-
- return propertySources;
- }
-
- @Override
- public void addPropertySources(PropertySource... propertySourcesToAdd) {
- Lock writeLock = propertySourceLock.asWriteLock();
- try {
- writeLock.lock();
- List<PropertySource> newPropertySources = new ArrayList<>(this.immutablePropertySources);
- newPropertySources.addAll(Arrays.asList(propertySourcesToAdd));
- Collections.sort(newPropertySources, this::comparePropertySources);
-
- this.immutablePropertySources = Collections.unmodifiableList(newPropertySources);
- } finally {
- writeLock.unlock();
- }
- }
-
- /**
- * Order property source reversely, the most important come first.
- *
- * @param source1 the first PropertySource
- * @param source2 the second PropertySource
- * @return the comparison result.
- */
- private int comparePropertySources(PropertySource source1, PropertySource source2) {
- if (source1.getOrdinal() < source2.getOrdinal()) {
- return 1;
- } else if (source1.getOrdinal() > source2.getOrdinal()) {
- return -1;
- } else {
- return source2.getClass().getName().compareTo(source1.getClass().getName());
- }
- }
-
- /**
- * Compare 2 filters for ordering the filter chain.
- *
- * @param filter1 the first filter
- * @param filter2 the second filter
- * @return the comparison result
- */
- private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter filter2) {
- Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
- Priority prio2 = filter2.getClass().getAnnotation(Priority.class);
- int ord1 = prio1 != null ? prio1.value() : 0;
- int ord2 = prio2 != null ? prio2.value() : 0;
-
- if (ord1 < ord2) {
- return -1;
- } else if (ord1 > ord2) {
- return 1;
- } else {
- return filter1.getClass().getName().compareTo(filter2.getClass().getName());
- }
- }
-
- @Override
- public List<PropertySource> getPropertySources() {
- return immutablePropertySources;
- }
-
- @Override
- public <T> void addPropertyConverter(Class<T> typeToConvert, PropertyConverter<T> propertyConverter) {
- propertyConverterManager.register(typeToConvert, propertyConverter);
- }
-
- @Override
- public Map<Class<?>, List<PropertyConverter<?>>> getPropertyConverters() {
- return propertyConverterManager.getPropertyConverters();
- }
-
- @Override
- public <T> List<PropertyConverter<T>> getPropertyConverters(Class<T> targetType) {
- return propertyConverterManager.getPropertyConverters(targetType);
- }
-
- @Override
- public List<PropertyFilter> getPropertyFilters() {
- return immutablePropertyFilters;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java b/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
deleted file mode 100644
index 8e27d4a..0000000
--- a/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
+++ /dev/null
@@ -1,89 +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.core.internal;
-
-import org.apache.tamaya.spi.ServiceContext;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.ServiceLoader;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This class implements the (default) {@link org.apache.tamaya.spi.ServiceContext} interface and hereby uses the JDK
- * {@link java.util.ServiceLoader} to load the services required.
- */
-public final class DefaultServiceContext implements ServiceContext {
- /**
- * List current services loaded, per class.
- */
- private final ConcurrentHashMap<Class, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
- /**
- * Singletons.
- */
- private final Map<Class, Optional<?>> singletons = new ConcurrentHashMap<>();
-
- @Override
- public <T> Optional<T> getService(Class<T> serviceType) {
- Optional<T> cached = Optional.class.cast(singletons.get(serviceType));
- if (cached == null) {
- List<? extends T> services = getServices(serviceType);
- if (services.isEmpty()) {
- cached = Optional.empty();
- } else {
- cached = Optional.of(services.get(0));
- }
- singletons.put(serviceType, cached);
- }
- return cached;
- }
-
- /**
- * Loads and registers services.
- *
- * @param serviceType The service type.
- * @param <T> the concrete type.
- * @return the items found, never {@code null}.
- */
- @Override
- public <T> List<T> getServices(final Class<T> serviceType) {
- List<T> found = List.class.cast(servicesLoaded.get(serviceType));
- if (found != null) {
- return found;
- }
- List<T> services = new ArrayList<>();
- try {
- for (T t : ServiceLoader.load(serviceType)) {
- services.add(t);
- }
- services = Collections.unmodifiableList(services);
- } catch (Exception e) {
- Logger.getLogger(DefaultServiceContext.class.getName()).log(Level.WARNING,
- "Error loading services current type " + serviceType, e);
- }
- final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>) services));
- return previousServices != null ? previousServices : services;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/internal/PropertiesFileLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/PropertiesFileLoader.java b/core/src/main/java/org/apache/tamaya/core/internal/PropertiesFileLoader.java
deleted file mode 100644
index b79a756..0000000
--- a/core/src/main/java/org/apache/tamaya/core/internal/PropertiesFileLoader.java
+++ /dev/null
@@ -1,102 +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.core.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-
-public final class PropertiesFileLoader {
-
-
- private PropertiesFileLoader() {
- // no instantiation
- }
-
-
- /**
- * loads all properties-files with the given name.
- * If the name do not end with {@code .properties} it will be appended
- *
- * @param name of the properties file
- *
- * @return URLs of properties-files or
- * an empty {@link Set} if no files has been found
- *
- * @throws IOException in case of problems loading the properties-files
- */
- public static Set<URL> resolvePropertiesFiles(String name) throws IOException {
- Objects.requireNonNull(name);
-
- if (!name.endsWith(".properties")) {
- name = name + ".properties";
- }
-
- Set<URL> urls = new HashSet<>();
-
- Enumeration<URL> files = Thread.currentThread().getContextClassLoader().getResources(name);
- while (files.hasMoreElements()) {
- urls.add(files.nextElement());
- }
-
- return urls;
- }
-
-
- /**
- * loads the Properties from the given URL
- *
- * @param propertiesFile {@link URL} to load Properties from
- *
- * @return loaded {@link Properties}
- *
- * @throws IllegalStateException in case of an error while reading properties-file
- */
- public static Properties load(URL propertiesFile) {
-
- Properties properties = new Properties();
-
- InputStream stream = null;
- try {
- stream = propertiesFile.openStream();
-
- if (stream != null) {
- properties.load(stream);
- }
- } catch (IOException e) {
- throw new IllegalStateException("Error loading Properties " + propertiesFile, e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- // bad luck -> stream is already closed
- }
- }
- }
-
- return properties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java b/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
deleted file mode 100644
index 5c7ae02..0000000
--- a/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ /dev/null
@@ -1,247 +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.core.internal;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Currency;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.StampedLock;
-import java.util.logging.Logger;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertyConverter;
-
-/**
- * Manager that deals with {@link org.apache.tamaya.spi.PropertyConverter} instances.
- * This class is thread-safe.
- */
-public class PropertyConverterManager {
- /** The logger used. */
- private static final Logger LOG = Logger.getLogger(PropertyConverterManager.class.getName());
- /** The registered converters. */
- private Map<Class<?>, List<PropertyConverter<?>>> converters = new ConcurrentHashMap<>();
- /** The lock used. */
- private StampedLock lock = new StampedLock();
- private static final String CHAR_NULL_ERROR = "Cannot convert null property";
- /**
- * Constructor.
- */
- public PropertyConverterManager() {
- initDefaultConverters();
- }
-
- private static final PropertyConverter<Character> CHAR_CONVERTER =
- (s) -> Objects.requireNonNull(s,CHAR_NULL_ERROR).charAt(0);
-
- /**
- * Registers the default converters provided out of the box.
- */
- protected void initDefaultConverters() {
- // Add default converters
- register(char.class, CHAR_CONVERTER);
- register(byte.class, Byte::parseByte);
- register(short.class, Short::parseShort);
- register(int.class, Integer::parseInt);
- register(long.class, Long::parseLong);
- register(boolean.class, Boolean::parseBoolean);
- register(float.class, Float::parseFloat); //X TODO not good enough as this is Locale dependent!
- register(double.class, Double::parseDouble); //X TODO not good enough as this is Locale dependent!
-
- register(Character.class, CHAR_CONVERTER);
- register(Byte.class, Byte::valueOf);
- register(Short.class, Short::valueOf);
- register(Integer.class, Integer::valueOf);
- register(Long.class, Long::valueOf);
- register(Boolean.class, Boolean::valueOf);
- register(Float.class, Float::valueOf); //X TODO not good enough as this is Locale dependent!
- register(Double.class, Double::valueOf); //X TODO not good enough as this is Locale dependent!
- register(BigDecimal.class, BigDecimal::new); //X TODO not good enough as this is Locale dependent!
- register(BigInteger.class, BigInteger::new); //X TODO not good enough as this is Locale dependent!
-
- register(Currency.class, Currency::getInstance);
-
- register(LocalDate.class, LocalDate::parse);
- register(LocalTime.class, LocalTime::parse);
- register(LocalDateTime.class, LocalDateTime::parse);
- register(ZoneId.class, ZoneId::of);
- }
-
- /**
- * Registers a ew converter instance.
- *
- * @param targetType the target type, not null.
- * @param converter the converter, not null.
- * @param <T> the type.
- */
- public <T> void register(Class<T> targetType, PropertyConverter<T> converter) {
- Objects.requireNonNull(converter);
- Lock writeLock = lock.asWriteLock();
- try {
- writeLock.lock();
- List<PropertyConverter<T>> converters = List.class.cast(this.converters.get(targetType));
- List<PropertyConverter<T>> newConverters = new ArrayList<>();
- if (converters != null) {
- newConverters.addAll(converters);
- }
- newConverters.add(converter);
- this.converters.put(targetType, Collections.unmodifiableList(newConverters));
- } finally {
- writeLock.unlock();
- }
- }
-
- /**
- * Allows to evaluate if a given target type is supported.
- *
- * @param targetType the target type, not null.
- * @return true, if a converter for the given type is registered, or a default one can be created.
- */
- public boolean isTargetTypeSupported(Class<?> targetType) {
- return converters.containsKey(targetType)
- || createDefaultPropertyConverter(targetType) != null;
- }
-
- /**
- * Get a map of all property converters currently registered. This will not contain the converters that
- * may be created, when an instance is adapted, which provides a String constructor or compatible
- * factory methods taking a single String instance.
- *
- * @return the current map of instantiated and registered converters.
- * @see #createDefaultPropertyConverter(Class)
- */
- public Map<Class<?>, List<PropertyConverter<?>>> getPropertyConverters() {
- Lock readLock = lock.asReadLock();
- try {
- readLock.lock();
- return new HashMap<>(this.converters);
- } finally {
- readLock.unlock();
- }
- }
-
- /**
- * Get the list of all current registered converters for the given target type.
- * If not converters are registered, they component tries to create and register a dynamic
- * converter based on String costructor or static factory methods available.
- *
- * @param targetType the target type, not null.
- * @param <T> the type class
- * @return the ordered list of converters (may be empty for not convertible types).
- * @see #createDefaultPropertyConverter(Class)
- */
- public <T> List<PropertyConverter<T>> getPropertyConverters(Class<T> targetType) {
- Lock readLock = lock.asReadLock();
- List<PropertyConverter<T>> converters;
- try {
- readLock.lock();
- converters = List.class.cast(this.converters.get(targetType));
- } finally {
- readLock.unlock();
- }
- if (converters != null) {
- return converters;
- }
- PropertyConverter<T> defaultConverter = createDefaultPropertyConverter(targetType);
- if (defaultConverter != null) {
- register(targetType, defaultConverter);
- try {
- converters = List.class.cast(this.converters.get(targetType));
- } finally {
- readLock.unlock();
- }
- }
- if (converters != null) {
- return converters;
- }
- return Collections.emptyList();
- }
-
- /**
- * Creates a dynamic PropertyConverter for the given target type.
- *
- * @param targetType the target type
- * @param <T> the type class
- * @return a new converter, or null.
- */
- protected <T> PropertyConverter<T> createDefaultPropertyConverter(Class<T> targetType) {
- PropertyConverter<T> converter = null;
- Method factoryMethod = getFactoryMethod(targetType, "of", "valueOf", "instanceOf", "getInstance", "from", "fromString", "parse");
- if (factoryMethod != null) {
- converter = (s) -> {
- try {
- factoryMethod.setAccessible(true);
- return targetType.cast(factoryMethod.invoke(s));
- } catch (Exception e) {
- throw new ConfigException("Failed to decode '" + s + "'", e);
- }
- };
- }
- if (converter == null) {
- try {
- Constructor<T> constr = targetType.getDeclaredConstructor(String.class);
- converter = (s) -> {
- try {
- constr.setAccessible(true);
- return constr.newInstance(s);
- } catch (Exception e) {
- throw new ConfigException("Failed to decode '" + s + "'", e);
- }
- };
- } catch (Exception e) {
- LOG.finest(() -> "Failed to construct instance of type: " + targetType.getName()+": " + e);
- }
- }
- return converter;
- }
-
- /**
- * Tries to evaluate a factory method that can be used to create an instance based on a String.
- *
- * @param type the target type
- * @param methodNames the possible static method names
- * @return the first method found, or null.
- */
- private Method getFactoryMethod(Class<?> type, String... methodNames) {
- Method m;
- for (String name : methodNames) {
- try {
- m = type.getDeclaredMethod(name, String.class);
- return m;
- } catch (Exception e) {
- LOG.finest(() -> "No such factory method found on type: " + type.getName()+", methodName: " + name);
- }
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java b/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
deleted file mode 100644
index e58be54..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
+++ /dev/null
@@ -1,78 +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.core.propertysource;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Objects;
-import java.util.Optional;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A base class for {@link PropertySource}s. It provides a {@link #initializeOrdinal(int)} method that
- * reads the ordinal from the config source itself, allowing the ordinal to be "self-configured" by
- * the configuration read.
- */
-public abstract class BasePropertySource implements PropertySource {
-
- private static final Logger LOG = Logger.getLogger(BasePropertySource.class.getName());
-
-
- private int ordinal = DefaultOrdinal.PROPERTY_SOURCE;
-
-
- @Override
- public int getOrdinal() {
- return ordinal;
- }
-
-
- @Override
- public Optional<String> get(String key) {
- Objects.requireNonNull(key, "key must not be null");
- return Optional.ofNullable(getProperties().get(key));
- }
-
-
- /**
- * Initializing the ordinal of this {@link PropertySource} with the given defaultOrdinal.
- *
- * If {@link PropertySource#TAMAYA_ORDINAL} is present via {@link #get(String)} and the
- * value is a valid {@link Integer} then, the defaultOrdinal will be overridden.
- *
- * @param defaultOrdinal of the {@link PropertySource}
- */
- protected void initializeOrdinal(final int defaultOrdinal) {
- this.ordinal = defaultOrdinal;
-
- Optional<String> ordinal = get(PropertySource.TAMAYA_ORDINAL);
- if (ordinal.isPresent()) {
-
- try {
- this.ordinal = Integer.valueOf(ordinal.get());
- } catch (NumberFormatException e) {
- LOG.log(Level.WARNING,
- "Specified {0} is not a valid Integer value: {1} - using defaultOrdinal {2}",
- new Object[]{PropertySource.TAMAYA_ORDINAL, ordinal.get(), defaultOrdinal});
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/DefaultOrdinal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/DefaultOrdinal.java b/core/src/main/java/org/apache/tamaya/core/propertysource/DefaultOrdinal.java
deleted file mode 100644
index ff35e3f..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/DefaultOrdinal.java
+++ /dev/null
@@ -1,54 +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.core.propertysource;
-
-
-/**
- * This interface defines the default ordinals for the 'standard'
- * {@link org.apache.tamaya.spi.PropertySource}s
- *
- * DefaultOrdinals can be overwritten via {@link org.apache.tamaya.spi.PropertySource#TAMAYA_ORDINAL}
- */
-public final class DefaultOrdinal {
-
- /** Private constructor. */
- private DefaultOrdinal(){}
-
- /**
- * default ordinal for {@link org.apache.tamaya.core.propertysource.BasePropertySource} if
- * not overriden in each class
- */
- public static final int PROPERTY_SOURCE = 1000;
-
- /**
- * default ordinal for {@link org.apache.tamaya.core.propertysource.SystemPropertySource}
- */
- public static final int SYSTEM_PROPERTIES = 400;
-
- /**
- * default ordinal for {@link org.apache.tamaya.core.propertysource.EnvironmentPropertySource}
- */
- public static final int ENVIRONMENT_PROPERTIES = 300;
-
- /**
- * default ordinal for {@link org.apache.tamaya.core.propertysource.PropertiesFilePropertySource}
- */
- public static final int FILE_PROPERTIES = 100;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java b/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java
deleted file mode 100644
index 596ea73..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java
+++ /dev/null
@@ -1,47 +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.core.propertysource;
-
-import java.util.Map;
-
-/**
- * This {@link org.apache.tamaya.spi.PropertySource} provides all Properties which are set
- * via <br />
- * {@code export myprop=myval} on UNIX Systems or<br />
- * {@code set myprop=myval} on Windows
- */
-public class EnvironmentPropertySource extends BasePropertySource {
-
- public EnvironmentPropertySource() {
- initializeOrdinal(DefaultOrdinal.ENVIRONMENT_PROPERTIES);
- }
-
-
- @Override
- public String getName() {
- return "environment-properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
- return System.getenv(); // already a map and unmodifiable
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySource.java b/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySource.java
deleted file mode 100644
index e117a12..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySource.java
+++ /dev/null
@@ -1,47 +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.core.propertysource;
-
-import org.apache.tamaya.core.internal.PropertiesFileLoader;
-
-import java.net.URL;
-
-/**
- * {@link org.apache.tamaya.spi.PropertySource} for properties-files
- */
-public class PropertiesFilePropertySource extends PropertiesPropertySource {
-
-
- private String fileName;
-
-
- public PropertiesFilePropertySource(URL propertiesFile) {
- super(PropertiesFileLoader.load(propertiesFile));
-
- initializeOrdinal(DefaultOrdinal.FILE_PROPERTIES);
- this.fileName = propertiesFile.toExternalForm();
- }
-
-
- @Override
- public String getName() {
- return fileName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesPropertySource.java b/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesPropertySource.java
deleted file mode 100644
index cf68bd6..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/PropertiesPropertySource.java
+++ /dev/null
@@ -1,51 +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.core.propertysource;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * base class for {@link org.apache.tamaya.spi.PropertySource}s which are based on
- * {@link java.util.Properties}
- */
-abstract class PropertiesPropertySource extends BasePropertySource {
-
- protected Map<String, String> properties;
-
-
- // package private to not expose this class
- PropertiesPropertySource(Properties properties) {
- Map<String, String> props = new HashMap<>();
-
- for (String key : properties.stringPropertyNames()) {
- props.put(key, properties.getProperty(key));
- }
-
- this.properties = Collections.unmodifiableMap(props);
- }
-
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java b/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
deleted file mode 100644
index 50d788d..0000000
--- a/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
+++ /dev/null
@@ -1,75 +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.core.propertysource;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * This {@link org.apache.tamaya.spi.PropertySource} manages the system properties.
- */
-public class SystemPropertySource extends PropertiesPropertySource {
-
- /**
- * previous System.getProperties().hashCode()
- * so we can check if we need to reload
- */
- private int previousHash;
-
-
- public SystemPropertySource() {
- super(System.getProperties());
- previousHash = System.getProperties().hashCode();
- initializeOrdinal(DefaultOrdinal.SYSTEM_PROPERTIES);
- }
-
-
- @Override
- public String getName() {
- return "system-properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
-
- // only need to reload and fill our map if something has changed
- if (previousHash != System.getProperties().hashCode()) {
-
- synchronized (this) {
-
- if (previousHash != System.getProperties().hashCode()) {
-
- Properties systemProperties = System.getProperties();
- Map<String, String> properties = new HashMap<>();
-
- for (String propertyName : systemProperties.stringPropertyNames()) {
- properties.put(propertyName, System.getProperty(propertyName));
- }
-
- this.properties = Collections.unmodifiableMap(properties);
- previousHash = systemProperties.hashCode();
- }
- }
- }
-
- return super.getProperties();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java b/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
deleted file mode 100644
index 0341c0e..0000000
--- a/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
+++ /dev/null
@@ -1,60 +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.core.provider;
-
-import org.apache.tamaya.core.internal.PropertiesFileLoader;
-import org.apache.tamaya.core.propertysource.PropertiesFilePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Provider which reads all {@code javaconfiguration.properties} files from classpath
- */
-public class JavaConfigurationProvider implements PropertySourceProvider {
-
-
- @Override
- public Collection<PropertySource> getPropertySources() {
-
- List<PropertySource> propertySources = new ArrayList<>();
-
- //X TODO maybe put javaconf... in META-INF
-
- try {
- propertySources.addAll(
- PropertiesFileLoader.resolvePropertiesFiles("javaconfiguration.properties")
- .stream()
- .map(PropertiesFilePropertySource::new)
- .collect(Collectors.toList()));
-
-
- } catch (IOException e) {
- throw new IllegalStateException("error loading javaconfiguration.properties", e);
- }
-
- return Collections.unmodifiableList(propertySources);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/resources/META-INF/services/org.apache.tamaya.Configuration
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.Configuration b/core/src/main/resources/META-INF/services/org.apache.tamaya.Configuration
deleted file mode 100644
index 0db8402..0000000
--- a/core/src/main/resources/META-INF/services/org.apache.tamaya.Configuration
+++ /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.core.internal.DefaultConfiguration
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resources.ResourceLoader
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resources.ResourceLoader b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resources.ResourceLoader
deleted file mode 100644
index a964d3c..0000000
--- a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resources.ResourceLoader
+++ /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.resource.internal.DefaultResourceLoader
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContext
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContext b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContext
deleted file mode 100644
index 32b4302..0000000
--- a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContext
+++ /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.core.internal.DefaultConfigurationContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 2721eff..0000000
--- a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ /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.core.internal.DefaultServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java b/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
deleted file mode 100644
index 5a6fc70..0000000
--- a/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
+++ /dev/null
@@ -1,58 +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.core;
-
-import org.apache.tamaya.Configuration;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * This tests checks if the combination of 2 prioritized PropertySource return valid results on the final Configuration.
- */
-public class ConfigurationTest {
-
- @Test
- public void testAccess(){
- assertNotNull(Configuration.current());
- }
-
- @Test
- public void testContent(){
- assertEquals("Robin", Configuration.current().get("name").get());
- assertEquals("Sabine", Configuration.current().get("name2").get()); // from default
- assertEquals("Mapped to name: Robin", Configuration.current().get("name3").get()); // oderridden default, mapped by filter to name property
- assertEquals("Sereina(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)", Configuration.current().get("name4").get()); // final only
- assertNull(Configuration.current().get("name5").orElse(null)); // final only, but removed from filter
-
- System.out.println("name : " + Configuration.current().get("name").get());
- System.out.println("name2: " + Configuration.current().get("name2").get());
- System.out.println("name3: " + Configuration.current().get("name3").get());
- System.out.println("name4: " + Configuration.current().get("name4").get());
- System.out.println("name5: " + Configuration.current().get("name5").orElse(null));
-
- System.out.println("ALL :");
- Configuration.current().getProperties().entrySet().forEach(e ->
- System.out.println(" " + e.getKey()+" = " + e.getValue()));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/test/internal/PropetiesFileLoaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/test/internal/PropetiesFileLoaderTest.java b/core/src/test/java/org/apache/tamaya/core/test/internal/PropetiesFileLoaderTest.java
deleted file mode 100644
index 985b5d5..0000000
--- a/core/src/test/java/org/apache/tamaya/core/test/internal/PropetiesFileLoaderTest.java
+++ /dev/null
@@ -1,76 +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.core.test.internal;
-
-import org.apache.tamaya.core.internal.PropertiesFileLoader;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.net.URL;
-import java.util.Properties;
-import java.util.Set;
-
-public class PropetiesFileLoaderTest {
-
-
- @Test
- public void testResolvePropertiesFiles() throws Exception {
- Properties expectedProperties = PropertiesFileLoader.load(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
-
- {
- // with .properties
- Set<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile.properties");
- Assert.assertNotNull(urls);
- Assert.assertFalse(urls.isEmpty());
-
- Properties properties = PropertiesFileLoader.load(urls.iterator().next());
- Assert.assertEquals(expectedProperties.size(), properties.size());
- }
-
- {
- // without .properties
- Set<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("testfile");
- Assert.assertNotNull(urls);
- Assert.assertFalse(urls.isEmpty());
-
- Properties properties = PropertiesFileLoader.load(urls.iterator().next());
- Assert.assertEquals(expectedProperties.size(), properties.size());
- }
-
- {
- // with a while which doesn't exist
- Set<URL> urls = PropertiesFileLoader.resolvePropertiesFiles("nonexistingfile.properties");
- Assert.assertNotNull(urls);
- Assert.assertTrue(urls.isEmpty());
- }
-
- }
-
- @Test
- public void testLoad() {
- Properties properties = PropertiesFileLoader.load(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
-
- Assert.assertNotNull(properties);
- Assert.assertEquals(5, properties.size());
-
- for (int i = 1; i < 6; i++) {
- Assert.assertEquals(properties.getProperty("key" + i), "val" + i);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java b/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
deleted file mode 100644
index d6dc867..0000000
--- a/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-import org.apache.tamaya.core.propertysource.DefaultOrdinal;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-public class BasePropertySourceTest {
-
- @Test
- public void testGetOrdinal() {
-
- PropertySource defaultPropertySource = new BasePropertySource() {
-
- @Override
- public String getName() {
- return "testWithDefault";
- }
-
- @Override
- public Optional<String> get(String key) {
- return Optional.ofNullable(null);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
- };
-
- Assert.assertEquals(DefaultOrdinal.PROPERTY_SOURCE, defaultPropertySource.getOrdinal());
- Assert.assertEquals(1000, new OverriddenOrdinalPropertySource().getOrdinal());
-
- // propertySource with invalid ordinal
- Assert.assertEquals(1, new OverriddenInvalidOrdinalPropertySource().getOrdinal());
- }
-
- @Test
- public void testGet() {
- Assert.assertEquals("1000", new OverriddenOrdinalPropertySource().get(PropertySource.TAMAYA_ORDINAL).get());
- }
-
- private static class OverriddenOrdinalPropertySource extends BasePropertySource {
-
- private OverriddenOrdinalPropertySource() {
- initializeOrdinal(250);
- }
-
- @Override
- public String getName() {
- return "overriddenOrdinal";
- }
-
- @Override
- public Map<String, String> getProperties() {
- Map<String, String> map = new HashMap<>(1);
- map.put(PropertySource.TAMAYA_ORDINAL, "1000");
- return map;
- }
- }
-
- private static class OverriddenInvalidOrdinalPropertySource extends BasePropertySource {
-
- private OverriddenInvalidOrdinalPropertySource() {
- initializeOrdinal(1);
- }
-
- @Override
- public String getName() {
- return "overriddenInvalidOrdinal";
- }
-
- @Override
- public Map<String, String> getProperties() {
- Map<String, String> map = new HashMap<>(1);
- map.put(PropertySource.TAMAYA_ORDINAL, "invalid");
- return map;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java b/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
deleted file mode 100644
index 6a1c9e7..0000000
--- a/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
+++ /dev/null
@@ -1,71 +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.core.test.propertysource;
-
-import org.apache.tamaya.core.internal.PropertiesFileLoader;
-import org.apache.tamaya.core.propertysource.DefaultOrdinal;
-import org.apache.tamaya.core.propertysource.PropertiesFilePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-
-public class PropertiesFilePropertySourceTest {
-
- private PropertiesFilePropertySource testfilePropertySource;
- private PropertiesFilePropertySource overrideOrdinalPropertySource;
-
-
- @Before
- public void initTest() {
- testfilePropertySource = new PropertiesFilePropertySource(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
- overrideOrdinalPropertySource = new PropertiesFilePropertySource(Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
- }
-
-
- @Test
- public void testGetOrdinal() {
- Assert.assertEquals(DefaultOrdinal.FILE_PROPERTIES, testfilePropertySource.getOrdinal());
- Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL).get()), overrideOrdinalPropertySource.getOrdinal());
- }
-
-
- @Test
- public void testGet() {
- Assert.assertEquals("val3", testfilePropertySource.get("key3").get());
- Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5").get());
- Assert.assertFalse(testfilePropertySource.get("nonpresentkey").isPresent());
- }
-
-
- @Test
- public void testGetProperties() throws Exception {
- Properties expectedProperties = PropertiesFileLoader.load(new URL(testfilePropertySource.getName()));
-
- Assert.assertEquals(expectedProperties.size(), testfilePropertySource.getProperties().size());
-
- for (Map.Entry<String, String> entry : testfilePropertySource.getProperties().entrySet()) {
- Assert.assertEquals(expectedProperties.getProperty(entry.getKey()), entry.getValue());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java b/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
deleted file mode 100644
index a7712db..0000000
--- a/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
+++ /dev/null
@@ -1,102 +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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.DefaultOrdinal;
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.Properties;
-
-public class SystemPropertySourceTest {
-
- private SystemPropertySource testPropertySource = new SystemPropertySource();
-
-
- @Test
- public void testGetOrdinal() throws Exception {
-
- // test the default ordinal
- Assert.assertEquals(DefaultOrdinal.SYSTEM_PROPERTIES, testPropertySource.getOrdinal());
-
- // set the ordinal to 1000
- System.setProperty(PropertySource.TAMAYA_ORDINAL, "1000");
- Assert.assertEquals(1000, new SystemPropertySource().getOrdinal()); // currently its not possible to change ordinal at runtime
-
- // reset it to not destroy other tests!!
- System.clearProperty(PropertySource.TAMAYA_ORDINAL);
- }
-
- @Test
- public void testGetName() throws Exception {
- Assert.assertEquals("system-properties", new SystemPropertySource().getName());
- }
-
- @Test
- public void testGet() throws Exception {
- String propertyKeyToCheck = System.getProperties().stringPropertyNames().iterator().next();
-
- Optional<String> property = testPropertySource.get(propertyKeyToCheck);
- Assert.assertTrue("Property '" + propertyKeyToCheck + "' is not present in " + SystemPropertySource.class.getSimpleName(),
- property.isPresent());
- Assert.assertEquals(System.getProperty(propertyKeyToCheck), property.get());
-
-
- }
-
- @Test
- public void testGetProperties() throws Exception {
- checkWithSystemProperties(testPropertySource.getProperties());
-
- // modify system properties
- System.setProperty("test", "myTestVal");
-
- checkWithSystemProperties(testPropertySource.getProperties());
-
- // cleanup
- System.clearProperty("test");
-
- // no modifaction
- try {
- testPropertySource.getProperties().put("add.new.keys", "must throw exception");
- Assert.fail(UnsupportedOperationException.class.getName() + " expected");
- }
- catch (UnsupportedOperationException e) {
- // expected -> all is fine
- }
- }
-
- private void checkWithSystemProperties(Map<String, String> toCheck) {
- Properties systemEntries = System.getProperties();
-
- Assert.assertEquals("size of System.getProperties().entrySet() must be the same as SystemPropertySrouce.getProperties().entrySet()",
- systemEntries.entrySet().size(), toCheck.size());
-
- for (Map.Entry<String, String> propertySourceEntry : toCheck.entrySet()) {
-
- Assert.assertEquals("Entry values for key '" + propertySourceEntry.getKey() + "' do not match",
- systemEntries.getProperty(propertySourceEntry.getKey()), propertySourceEntry.getValue());
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java b/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
deleted file mode 100644
index 5c5fefc..0000000
--- a/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
+++ /dev/null
@@ -1,53 +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.core.test.provider;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.core.provider.JavaConfigurationProvider;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collection;
-
-public class JavaConfigurationProviderTest {
-
- @Test
- public void testJavaConfigurationProvider() {
-
- Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
-
- Assert.assertNotNull(propertySources);
- Assert.assertEquals(1, propertySources.size());
-
- PropertySource propertySource = propertySources.iterator().next();
- for (int i = 1; i < 6; i++) {
- String key = "confkey" + i;
- String value = "javaconf-value" + i;
-
- Assert.assertEquals(value, propertySource.get(key).get());
-
- // check if we had our key in configuration.current
- Assert.assertTrue(Configuration.current().getProperties().containsKey(key));
- Assert.assertEquals(value, Configuration.current().get(key).get());
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java b/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java
deleted file mode 100644
index b67d17e..0000000
--- a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java
+++ /dev/null
@@ -1,51 +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.core.testdata;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Test provider reading properties from classpath:cfg/defaults/**.properties.
- */
-public class TestPropertyDefaultSource extends BasePropertySource{
-
- private Map<String,String> properties = new HashMap<>();
-
- public TestPropertyDefaultSource() {
- initializeOrdinal(100);
- properties.put("name","Anatole");
- properties.put("name2","Sabine");
- properties = Collections.unmodifiableMap(properties);
- }
-
- @Override
- public String getName() {
- return "default-testdata-properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java b/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
deleted file mode 100644
index 0713fee..0000000
--- a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
+++ /dev/null
@@ -1,38 +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.core.testdata;
-
-import org.apache.tamaya.spi.PropertyFilter;
-
-import javax.annotation.Priority;
-import java.util.function.Function;
-
-/**
- * Simple PropertyFilter that filters exact one value, registered using ServiceLoader.
- */
-@Priority(100)
-public class TestPropertyFilter implements PropertyFilter{
- @Override
- public String filterProperty(String key, String valueToBeFiltered) {
- if("name4".equals(key)){
- return valueToBeFiltered + "(filtered)";
- }
- return valueToBeFiltered;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilterRemoving.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilterRemoving.java b/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilterRemoving.java
deleted file mode 100644
index 0244d6a..0000000
--- a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilterRemoving.java
+++ /dev/null
@@ -1,42 +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.core.testdata;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import javax.annotation.Priority;
-import java.util.function.Function;
-
-/**
- * Simple PropertyFilter that filters exact one value, registered using ServiceLoader.
- */
-@Priority(200)
-public class TestPropertyFilterRemoving implements PropertyFilter{
- @Override
- public String filterProperty(String key, String valueToBeFiltered) {
- if("name5".equals(key)){
- return null;
- }
- else if("name3".equals(key)){
- return "Mapped to name: " + Configuration.current().get("name").orElse("NoName found!");
- }
- return valueToBeFiltered;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java b/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
deleted file mode 100644
index 902027b..0000000
--- a/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
+++ /dev/null
@@ -1,73 +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.core.testdata;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Test provider reading properties from classpath:cfg/final/**.properties.
- */
-public class TestPropertySourceProvider implements PropertySourceProvider {
-
- private List<PropertySource> list = new ArrayList<>();
-
- public TestPropertySourceProvider(){
- list.add(new MyPropertySource());
- list = Collections.unmodifiableList(list);
- }
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- return list;
- }
-
- private static class MyPropertySource extends BasePropertySource {
-
- private Map<String, String> properties = new HashMap<>();
-
- public MyPropertySource() {
- initializeOrdinal(200);
- properties.put("name", "Robin");
- properties.put("name3", "Lukas");
- properties.put("name4", "Sereina");
- properties.put("name5", "Benjamin");
- properties = Collections.unmodifiableMap(properties);
- }
-
- @Override
- public String getName() {
- return "final-testdata-properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
----------------------------------------------------------------------
diff --git a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter b/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
deleted file mode 100644
index 4e7d068..0000000
--- a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
+++ /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.
-#
-org.apache.tamaya.core.testdata.TestPropertyFilter
-org.apache.tamaya.core.testdata.TestPropertyFilterRemoving
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 1effc9e..0000000
--- a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /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.
-#
-org.apache.tamaya.core.testdata.TestPropertyDefaultSource
-org.apache.tamaya.core.propertysource.SystemPropertySource
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index afc8910..0000000
--- a/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /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.
-#
-org.apache.tamaya.core.testdata.TestPropertySourceProvider
-org.apache.tamaya.core.provider.JavaConfigurationProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/core/src/test/resources/javaconfiguration.properties b/core/src/test/resources/javaconfiguration.properties
deleted file mode 100644
index b461414..0000000
--- a/core/src/test/resources/javaconfiguration.properties
+++ /dev/null
@@ -1,22 +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.
-
-confkey1=javaconf-value1
-confkey2=javaconf-value2
-confkey3=javaconf-value3
-confkey4=javaconf-value4
-confkey5=javaconf-value5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/overrideOrdinal.properties
----------------------------------------------------------------------
diff --git a/core/src/test/resources/overrideOrdinal.properties b/core/src/test/resources/overrideOrdinal.properties
deleted file mode 100644
index 96935a8..0000000
--- a/core/src/test/resources/overrideOrdinal.properties
+++ /dev/null
@@ -1,25 +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.
-
-#override ordinal
-tamaya.ordinal=16784
-
-mykey1=myval1
-mykey2=myval2
-mykey3=myval3
-mykey4=myval4
-mykey5=myval5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/328a4ac7/core/src/test/resources/testfile.properties
----------------------------------------------------------------------
diff --git a/core/src/test/resources/testfile.properties b/core/src/test/resources/testfile.properties
deleted file mode 100644
index abd7ee8..0000000
--- a/core/src/test/resources/testfile.properties
+++ /dev/null
@@ -1,22 +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.
-
-key1=val1
-key2=val2
-key3=val3
-key4=val4
-key5=val5
\ No newline at end of file