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:29:18 UTC
[1/6] incubator-tamaya git commit: Removed the attic
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 359d3e4a2 -> ccc0842b7
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/pom.xml
----------------------------------------------------------------------
diff --git a/attic/pom.xml b/attic/pom.xml
deleted file mode 100644
index e27f07d..0000000
--- a/attic/pom.xml
+++ /dev/null
@@ -1,109 +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.
--->
-<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</groupId>
- <artifactId>tamaya-all</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tamaya-java8</artifactId>
- <name>Apache Tamaya Java 8 Parent</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>api</module>
- <module>core</module>
- </modules>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc.version}</version>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <additionalparam>-Xdoclint:none</additionalparam>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-versions</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireJavaVersion>
- <version>[1.8,)</version>
- </requireJavaVersion>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <excludeFilterFile>findbugs/findbugs-exclude.xml</excludeFilterFile>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>buildconfigurations</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <logViolationsToConsole>true</logViolationsToConsole>
- <configLocation>checkstyle/style.xml</configLocation>
- </configuration>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>buildconfigurations</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
- </plugins>
- </build>
-</project>
[4/6] incubator-tamaya git commit: Removed the attic
Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
deleted file mode 100644
index 1c7cce5..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ /dev/null
@@ -1,390 +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.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.*;
-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.TypeLiteral;
-import org.apache.tamaya.core.internal.converters.EnumConverter;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-/**
- * 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<TypeLiteral<?>, List<PropertyConverter<?>>> converters = new ConcurrentHashMap<>();
- /** The transitive converters as evaluated based on the registered converters. */
- private Map<TypeLiteral<?>, List<PropertyConverter<?>>> transitiveConverters = new ConcurrentHashMap<>();
- /** The lock used. */
- private StampedLock lock = new StampedLock();
-
- private static final Comparator<Object> PRIORITY_COMPARATOR =
- (o1,o2) -> {
- int prio = DefaultServiceContext.getPriority(o1) - DefaultServiceContext.getPriority(o2);
- if(prio<0){
- return 1;
- } else if(prio>0){
- return -1;
- } else{
- return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
- }
- };
-
- /**
- * Constructor.
- */
- public PropertyConverterManager() {
- this(true);
- }
-
- public PropertyConverterManager(boolean init) {
- if (init) {
- initConverters();
- }
- }
-
- /**
- * Registers the default converters provided out of the box.
- */
- protected void initConverters() {
- for(PropertyConverter conv: ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)){
- Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0];
- register(TypeLiteral.of(type), conv);
- }
- }
-
- /**
- * 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(TypeLiteral<T> targetType, PropertyConverter<T> converter) {
- Objects.requireNonNull(converter);
- Lock writeLock = lock.asWriteLock();
- try {
- writeLock.lock();
- List converters = List.class.cast(this.converters.get(targetType));
- List<PropertyConverter<T>> newConverters = new ArrayList<>();
- if (converters != null) {
- newConverters.addAll(converters);
- }
- newConverters.add(converter);
- Collections.sort(newConverters, PRIORITY_COMPARATOR);
- this.converters.put(targetType, Collections.unmodifiableList(newConverters));
- // evaluate transitive closure for all inherited supertypes and implemented interfaces
- // direct implemented interfaces
- for(Class<?> ifaceType: targetType.getRawType().getInterfaces()){
- converters = List.class.cast(this.transitiveConverters.get(ifaceType));
- newConverters = new ArrayList<>();
- if (converters != null) {
- newConverters.addAll(converters);
- }
- newConverters.add(converter);
- Collections.sort(newConverters, PRIORITY_COMPARATOR);
- this.transitiveConverters.put(TypeLiteral.of(ifaceType), Collections.unmodifiableList(newConverters));
- }
- Class<?> superClass = targetType.getRawType().getSuperclass();
- while(superClass!=null && !superClass.equals(Object.class)){
- converters = List.class.cast(this.transitiveConverters.get(superClass));
- newConverters = new ArrayList<>();
- if (converters != null) {
- newConverters.addAll(converters);
- }
- newConverters.add(converter);
- Collections.sort(newConverters, PRIORITY_COMPARATOR);
- this.transitiveConverters.put(TypeLiteral.of(superClass), Collections.unmodifiableList(newConverters));
- for(Class<?> ifaceType: superClass.getInterfaces()){
- converters = List.class.cast(this.transitiveConverters.get(ifaceType));
- newConverters = new ArrayList<>();
- if (converters != null) {
- newConverters.addAll(converters);
- }
- newConverters.add(converter);
- Collections.sort(newConverters, PRIORITY_COMPARATOR);
- this.transitiveConverters.put(TypeLiteral.of(ifaceType), Collections.unmodifiableList(newConverters));
- }
- superClass = superClass.getSuperclass();
- }
- } 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(TypeLiteral<?> targetType) {
- if(converters.containsKey(targetType) || transitiveConverters.containsKey(targetType)){
- return true;
- }
- return 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. <br/>
- * This will also NOT contain any transitive converter mappings as derived from the registered converters.
- *
- * @return the current map of instantiated and registered converters.
- * @see #createDefaultPropertyConverter(org.apache.tamaya.TypeLiteral)
- */
- public Map<TypeLiteral<?>, 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.<br/>
- * The converters provided are of the following type and returned in the following order:
- * <ul>
- * <li>Converters mapped explicitly to the required target type are returned first, ordered
- * by decreasing priority. This means, if explicit converters are registered these are used
- * primarly for converting a value.</li>
- * <li>The target type of each explicitly registered converter also can be transitively mapped to
- * 1) all directly implemented interfaces, 2) all its superclasses (except Object), 3) all the interfaces
- * implemented by its superclasses. These groups of transitive converters is returned similarly in the
- * order as mentioned, whereas also here a priority based decreasing ordering is applied.</li>
- * <li>java.lang wrapper classes and native types are automatically mapped.</li>
- * <li>If no explicit converters are registered, for Enum types a default implementation is provided that
- * compares the configuration values with the different enum members defined (cases sensitive mapping).</li>
- * </ul>
- *
- * So given that list above directly registered mappings always are tried first, before any transitive mapping
- * should be used. Also in all cases @Priority annotations are honored for ordering of the converters in place.
- * Transitive conversion is supported for all directly implemented interfaces (including inherited ones) and
- * the inheritance hierarchy (exception Object). Superinterfaces of implemented interfaces are ignored.
- *
- * @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(org.apache.tamaya.TypeLiteral)
- */
- public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType) {
- List<PropertyConverter<T>> converterList = new ArrayList<>();
- Lock readLock = lock.asReadLock();
- List<PropertyConverter<T>> converters;
- // direct mapped converters
- try {
- readLock.lock();
- converters = List.class.cast(this.converters.get(targetType));
- } finally {
- readLock.unlock();
- }
- if (converters != null) {
- converterList.addAll(converters);
- }
- // transitive converter
- try {
- readLock.lock();
- converters = List.class.cast(this.transitiveConverters.get(targetType));
- } finally {
- readLock.unlock();
- }
- if (converters != null) {
- converterList.addAll(converters);
- }
- // handling of java.ui.lang wrapper classes
- TypeLiteral<T> boxedType = mapBoxedType(targetType);
- if(boxedType!=null){
- try {
- readLock.lock();
- converters = List.class.cast(this.converters.get(boxedType));
- } finally {
- readLock.unlock();
- }
- if (converters != null) {
- converterList.addAll(converters);
- }
- }
- if(converterList.isEmpty()) {
- // adding any converters created on the fly, e.g. for enum types.
- PropertyConverter<T> defaultConverter = createDefaultPropertyConverter(targetType);
- if (defaultConverter != null) {
- register(targetType, defaultConverter);
- try {
- readLock.lock();
- converters = List.class.cast(this.converters.get(targetType));
- } finally {
- readLock.unlock();
- }
- }
- if (converters != null) {
- converterList.addAll(converters);
- }
- }
- return converterList;
- }
-
- /**
- * Maps native types to the corresponding boxed types.
- * @param targetType the native type.
- * @param <T> the type
- * @return the boxed type, or null.
- */
- private <T> TypeLiteral<T> mapBoxedType(TypeLiteral<T> targetType) {
- Type parameterType = targetType.getType();
- if(parameterType == int.class){
- return TypeLiteral.of(Integer.class);
- }
- if(parameterType == short.class){
- return TypeLiteral.of(Short.class);
- }
- if(parameterType == byte.class){
- return TypeLiteral.of(Byte.class);
- }
- if(parameterType == long.class){
- return TypeLiteral.of(Long.class);
- }
- if(parameterType == boolean.class){
- return TypeLiteral.of(Boolean.class);
- }
- if(parameterType == char.class){
- return TypeLiteral.of(Character.class);
- }
- if(parameterType == float.class){
- return TypeLiteral.of(Float.class);
- }
- if(parameterType == double.class){
- return TypeLiteral.of(Double.class);
- }
- if(parameterType == int[].class){
- return TypeLiteral.of(Integer[].class);
- }
- if(parameterType == short[].class){
- return TypeLiteral.of(Short[].class);
- }
- if(parameterType == byte[].class){
- return TypeLiteral.of(Byte[].class);
- }
- if(parameterType == long[].class){
- return TypeLiteral.of(Long[].class);
- }
- if(parameterType == boolean.class){
- return TypeLiteral.of(Boolean.class);
- }
- if(parameterType == char[].class){
- return TypeLiteral.of(Character[].class);
- }
- if(parameterType == float[].class){
- return TypeLiteral.of(Float[].class);
- }
- if(parameterType == double[].class){
- return TypeLiteral.of(Double[].class);
- }
- return null;
- }
-
- /**
- * 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(TypeLiteral<T> targetType) {
- if(Enum.class.isAssignableFrom(targetType.getRawType())){
- return new EnumConverter<>(targetType.getRawType());
- }
- PropertyConverter<T> converter = null;
- Method factoryMethod = getFactoryMethod(targetType.getRawType(), "of", "valueOf", "instanceOf", "getInstance", "from", "fromString", "parse");
- if (factoryMethod != null) {
- converter = (value) -> {
- try {
- if (!Modifier.isStatic(factoryMethod.getModifiers())) {
- throw new RuntimeException(factoryMethod.toGenericString() +
- " is not a static method. Only static " +
- "methods can be used as factory methods.");
- }
-
- factoryMethod.setAccessible(true);
-
- Object invoke = factoryMethod.invoke(null, value);
- return targetType.getRawType().cast(invoke);
- } catch (Exception e) {
- throw new ConfigException("Failed to decode '" + value + "'", e);
- }
- };
- }
- if (converter == null) {
- try {
- Constructor<T> constr = targetType.getRawType().getDeclaredConstructor(String.class);
- converter = (value) -> {
- try {
- constr.setAccessible(true);
- return constr.newInstance(value);
- } catch (Exception e) {
- throw new ConfigException("Failed to decode '" + value + "'", e);
- }
- };
- } catch (Exception e) {
- LOG.finest(() -> "Failed to construct instance of type: " + targetType.getRawType().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 (NoSuchMethodException | RuntimeException 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/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java
deleted file mode 100644
index 9c90b18..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to BigDecimal, the supported format is one of the following:
- * <ul>
- * <li>232573527352.76352753</li>
- * <li>-23257352.735276352753</li>
- * <li>-0xFFFFFF (integral numbers only)</li>
- * <li>-0XFFFFAC (integral numbers only)</li>
- * <li>0xFFFFFF (integral numbers only)</li>
- * <li>0XFFFFAC (integral numbers only)</li>
- * </ul>
- */
-public class BigDecimalConverter implements PropertyConverter<BigDecimal>{
- /** The logger. */
- private static final Logger LOG = Logger.getLogger(BigDecimalConverter.class.getName());
- /** Converter to be used if the format is not directly supported by BigDecimal, e.g. for integral hex values. */
- private BigIntegerConverter integerConverter = new BigIntegerConverter();
-
- @Override
- public BigDecimal convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try{
- return new BigDecimal(trimmed);
- } catch(Exception e){
- LOG.finest(() -> "Parsing BigDecimal failed, trying BigInteger for: " + value);
- BigInteger bigInt = integerConverter.convert(trimmed);
- if(bigInt!=null){
- return new BigDecimal(bigInt);
- }
- LOG.finest(() -> "Failed to parse BigDecimal from: " + value);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigIntegerConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigIntegerConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigIntegerConverter.java
deleted file mode 100644
index 9a4571b..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BigIntegerConverter.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.core.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.math.BigInteger;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to BigInteger, the supported format is one of the following:
- * <ul>
- * <li>0xFFFFFF</li>
- * <li>0XFFFFAC</li>
- * <li>23257352735276352753</li>
- * <li>-0xFFFFFF</li>
- * <li>-0XFFFFAC</li>
- * <li>-23257352735276352753</li>
- * </ul>
- */
-public class BigIntegerConverter implements PropertyConverter<BigInteger>{
-
- /** The logger. */
- private static final Logger LOG = Logger.getLogger(BigIntegerConverter.class.getName());
- /** Converter used to decode hex, octal values. */
- private ByteConverter byteConverter = new ByteConverter();
-
- @Override
- public BigInteger convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- if(trimmed.startsWith("0x") || trimmed.startsWith("0X")){
- LOG.finest(() -> "Parsing Hex value to BigInteger: " + value);
- trimmed = trimmed.substring(2);
- StringBuilder decimal = new StringBuilder();
- for(int offset = 0;offset < trimmed.length();offset+=2){
- if(offset==trimmed.length()-1){
- LOG.finest(() -> "Invalid Hex-Byte-String: " + value);
- return null;
- }
- byte val = byteConverter.convert("0x" + trimmed.substring(offset, offset + 2));
- if(val<10){
- decimal.append('0').append(val);
- } else{
- decimal.append(val);
- }
- }
- return new BigInteger(decimal.toString());
- } else if(trimmed.startsWith("-0x") || trimmed.startsWith("-0X")){
- LOG.finest(() -> "Parsing Hex value to BigInteger: " + value);
- trimmed = trimmed.substring(3);
- StringBuilder decimal = new StringBuilder();
- for(int offset = 0;offset < trimmed.length();offset+=2){
- if(offset==trimmed.length()-1){
- LOG.finest("Invalid Hex-Byte-String: " + trimmed);
- return null;
- }
- byte val = byteConverter.convert("0x" + trimmed.substring(offset, offset + 2));
- if(val<10){
- decimal.append('0').append(val);
- } else{
- decimal.append(val);
- }
- }
- return new BigInteger('-' + decimal.toString());
- }
- try{
- return new BigInteger(trimmed);
- } catch(Exception e){
- LOG.log(Level.FINEST, e, () -> "Failed to parse BigInteger from: " + value);
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
deleted file mode 100644
index ebf0146..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
+++ /dev/null
@@ -1,65 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Boolean, the supported format is one of the following:
- * <ul>
- * <li>true</li>
- * <li>t</li>
- * <li>yes</li>
- * <li>y</li>
- * <li>1</li>
- * <li>0</li>
- * </ul>
- */
-public class BooleanConverter implements PropertyConverter<Boolean> {
-
- private Logger LOG = Logger.getLogger(getClass().getName());
-
- @Override
- public Boolean convert(String value) {
- String ignoreCaseValue = Objects.requireNonNull(value)
- .trim()
- .toLowerCase(Locale.ENGLISH);
- switch(ignoreCaseValue) {
- case "yes":
- case "y":
- case "true":
- case "t":
- case "1":
- return Boolean.TRUE;
- case "no":
- case "n":
- case "false":
- case "f":
- case "0":
- return Boolean.FALSE;
- default:
- LOG.finest("Unknown boolean value encountered: " + value);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ByteConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ByteConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ByteConverter.java
deleted file mode 100644
index 586cafb..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ByteConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Byte, the supported format is one of the following:
- * <ul>
- * <li>0xFF</li>
- * <li>0XFF</li>
- * <li>45</li>
- * <li>-34</li>
- * <li>0D1</li>
- * </ul>
- */
-public class ByteConverter implements PropertyConverter<Byte> {
-
- private Logger LOG = Logger.getLogger(getClass().getName());
-
- @Override
- public Byte convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch (trimmed.toUpperCase(Locale.ENGLISH)) {
- case "MIN_VALUE":
- case "MIN":
- return Byte.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Byte.MAX_VALUE;
- default:
- try {
- return Byte.decode(trimmed);
- } catch (Exception e) {
- LOG.finest("Failed to parse Byte value: " + value);
- return null;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CharConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CharConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CharConverter.java
deleted file mode 100644
index 85b9a9a..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CharConverter.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.core.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Character, the supported format is one of the following:
- * <ul>
- * <li>'a'</li>
- * <li>123 (byte value)</li>
- * <li>0xFF (byte value)</li>
- * <li>0XDF (byte value)</li>
- * <li>0D1 (byte value)</li>
- * </ul>
- */
-public class CharConverter implements PropertyConverter<Character>{
-
- private static final Logger LOG = Logger.getLogger(CharConverter.class.getName());
-
- @Override
- public Character convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- if(trimmed.isEmpty()){
- return null;
- }
- if(trimmed.startsWith("'")) {
- try {
- trimmed = trimmed.substring(1, trimmed.length() - 1);
- if (trimmed.isEmpty()) {
- return null;
- }
- return trimmed.charAt(0);
- } catch (Exception e) {
- LOG.finest("Invalid character format encountered: '" + value + "', valid formats are 'a', 101 and a.");
- return null;
- }
- }
- try {
- Integer val = Integer.decode(trimmed);
- return (char) val.shortValue();
- } catch (Exception e) {
- LOG.finest("Character format is not numeric: '" + value + "', using first character.");
- return trimmed.charAt(0);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ClassConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ClassConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ClassConverter.java
deleted file mode 100644
index d0765f7..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ClassConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Class, hereby using the following classloaders:
- * <ul>
- * <li>The current ThreadContext ClassLoader</li>
- * <li>The Classloader of this class</li>
- * <li>The system Classloader</li>
- * </ul>
- */
-public class ClassConverter implements PropertyConverter<Class<?>> {
-
- private Logger LOG = Logger.getLogger(getClass().getName());
-
- @Override
- public Class<?> convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try {
- return Class.forName(trimmed, false, Thread.currentThread().getContextClassLoader());
- } catch (Exception e) {
- LOG.finest("Class not found in context CL: " + trimmed);
- }
- try {
- return Class.forName(trimmed, false, ClassConverter.class.getClassLoader());
- } catch (Exception e) {
- LOG.finest("Class not found in ClassConverter's CL: " + trimmed);
- }
- try {
- return Class.forName(trimmed, false, ClassLoader.getSystemClassLoader());
- } catch (Exception e) {
- LOG.finest("Class not found in System CL (giving up): " + trimmed);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CurrencyConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CurrencyConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CurrencyConverter.java
deleted file mode 100644
index e70a0b1..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/CurrencyConverter.java
+++ /dev/null
@@ -1,87 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Currency;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Currency.
- */
-public class CurrencyConverter implements PropertyConverter<Currency> {
-
- private static final Logger LOG = Logger.getLogger(CurrencyConverter.class.getName());
-
- @Override
- public Currency convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try {
- return Currency.getInstance(trimmed);
- } catch (Exception e) {
- // try converting to upper case, works for all default ISO currencies.
- try {
- return Currency.getInstance(trimmed.toUpperCase(Locale.ENGLISH));
- } catch (Exception e2) {
- LOG.finest(() -> "Not a valid textual currency code: " + trimmed +
- ", checking for numeric code...");
- }
- }
- try {
- // Check for numeric code
- Integer numCode = Integer.parseInt(trimmed);
- for (Currency currency : Currency.getAvailableCurrencies()) {
- if (currency.getNumericCode() == numCode) {
- return currency;
- }
- }
- } catch (Exception e) {
- LOG.finest(() -> "Not a valid numeric currency code: " + trimmed + ", checking for locale...");
- }
- try {
- // Check for numeric code
- String[] parts = trimmed.split("\\_");
- Locale locale;
- switch (parts.length) {
- case 1:
- locale = new Locale("", parts[0]);
- break;
- case 2:
- locale = new Locale(parts[0], parts[1]);
- break;
- case 3:
- locale = new Locale(parts[0], parts[1], parts[2]);
- break;
- default:
- locale = null;
- }
- if (locale != null) {
- return Currency.getInstance(locale);
- }
- LOG.finest(() -> "Not a valid currency: " + trimmed + ", giving up...");
- } catch (Exception e) {
- LOG.log(Level.FINEST, e, () -> "Not a valid country locale for currency: " + trimmed + ", giving up...");
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/DoubleConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/DoubleConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/DoubleConverter.java
deleted file mode 100644
index 9f3996e..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/DoubleConverter.java
+++ /dev/null
@@ -1,70 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Double, using the Java number syntax:
- * (-)?[0-9]*\.[0-9]*. In case of error the value given also is tried being parsed as integral number using
- * {@link org.apache.tamaya.core.internal.converters.LongConverter}.
- */
-public class DoubleConverter implements PropertyConverter<Double>{
- /** The logger. */
- private static final Logger LOG = Logger.getLogger(DoubleConverter.class.getName());
- /** The converter used, when floating point parse failed. */
- private LongConverter integerConverter = new LongConverter();
-
- @Override
- public Double convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch(trimmed.toUpperCase(Locale.ENGLISH)){
- case "POSITIVE_INFINITY":
- return Double.POSITIVE_INFINITY;
- case "NEGATIVE_INFINITY":
- return Double.NEGATIVE_INFINITY;
- case "NAN":
- return Double.NaN;
- case "MIN_VALUE":
- case "MIN":
- return Double.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Double.MAX_VALUE;
- default:
- try {
- return Double.valueOf(trimmed);
- } catch(Exception e){
- // OK perhaps we have an integral number that must be converted to the double type...
- LOG.log(Level.FINEST, e, () -> "Parsing of double as floating number failed, trying parsing " +
- "integral/hex number instead...");
- }
- Long val = integerConverter.convert(trimmed);
- if(val!=null){
- return val.doubleValue();
- }
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
deleted file mode 100644
index e925ad2..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
+++ /dev/null
@@ -1,67 +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.converters;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to tge given enum type.
- * @param <T> the enumeration type.
- */
-public class EnumConverter<T> implements PropertyConverter<T> {
- private Logger LOG = Logger.getLogger(EnumConverter.class.getName());
- private Class<T> enumType;
- private Method factory;
-
- public EnumConverter(Class<T> enumType) {
- if (!Enum.class.isAssignableFrom(enumType)) {
- throw new IllegalArgumentException("Not an Enum: " + enumType.getName());
- }
- this.enumType = Objects.requireNonNull(enumType);
- try {
- this.factory = enumType.getMethod("valueOf", String.class);
- } catch (NoSuchMethodException e) {
- throw new ConfigException("Uncovertible enum type without valueOf method found, please provide a custom " +
- "PropertyConverter for: " + enumType.getName());
- }
- }
-
- @Override
- public T convert(String value) {
- try {
- return (T) factory.invoke(null, value);
- } catch (InvocationTargetException | IllegalAccessException e) {
- LOG.log(Level.FINEST, e, () -> "Invalid enum value '" + value + "' for " + enumType.getName());
- }
- try {
- return (T) factory.invoke(null, value.toUpperCase(Locale.ENGLISH));
- } catch (InvocationTargetException | IllegalAccessException e) {
- LOG.log(Level.FINEST, e, () -> "Invalid enum value '" + value + "' for " + enumType.getName());
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/FloatConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/FloatConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/FloatConverter.java
deleted file mode 100644
index b2ae4cb..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/FloatConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Float, using the Java number syntax:
- * (-)?[0-9]*\.[0-9]*. In case of error the value given also is tried being parsed as integral number using
- * {@link org.apache.tamaya.core.internal.converters.LongConverter}.
- */
-public class FloatConverter implements PropertyConverter<Float> {
- /**
- * The logger.
- */
- private static final Logger LOG = Logger.getLogger(FloatConverter.class.getName());
- /**
- * The converter used, when floating point parse failed.
- */
- private IntegerConverter integerConverter = new IntegerConverter();
-
- @Override
- public Float convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
-
- switch(trimmed.toUpperCase(Locale.ENGLISH)) {
- case "POSITIVE_INFINITY":
- return Float.POSITIVE_INFINITY;
- case "NEGATIVE_INFINITY":
- return Float.NEGATIVE_INFINITY;
- case "NAN":
- return Float.NaN;
- case "MIN_VALUE":
- case "MIN":
- return Float.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Float.MAX_VALUE;
- default:
- try {
- return Float.valueOf(trimmed);
- } catch(Exception e) {
- // OK perhaps we have an integral number that must be converted to the double type...
- LOG.finest(() -> "Parsing of float as floating number failed, trying parsing integral" +
- " number/hex instead...");
- }
-
- Integer val = integerConverter.convert(trimmed);
-
- if (val!=null) {
- return val.floatValue();
- }
-
- LOG.finest(() -> "Unparseable float value: " + trimmed);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/IntegerConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/IntegerConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/IntegerConverter.java
deleted file mode 100644
index 3c93349..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/IntegerConverter.java
+++ /dev/null
@@ -1,70 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Integer, the supported format is one of the following:
- * <ul>
- * <li>123 (byte value)</li>
- * <li>0xFF (byte value)</li>
- * <li>0XDF (byte value)</li>
- * <li>0D1 (byte value)</li>
- * <li>-123 (byte value)</li>
- * <li>-0xFF (byte value)</li>
- * <li>-0XDF (byte value)</li>
- * <li>-0D1 (byte value)</li>
- * <li>MIN_VALUE (ignoring case)</li>
- * <li>MIN (ignoring case)</li>
- * <li>MAX_VALUE (ignoring case)</li>
- * <li>MAX (ignoring case)</li>
- * </ul>
- */
-public class IntegerConverter implements PropertyConverter<Integer>{
-
- /**
- * The logger.
- */
- private static final Logger LOG = Logger.getLogger(IntegerConverter.class.getName());
-
- @Override
- public Integer convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch (trimmed.toUpperCase(Locale.ENGLISH)) {
- case "MIN_VALUE":
- case "MIN":
- return Integer.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Integer.MAX_VALUE;
- default:
- try{
- return Integer.decode(trimmed);
- } catch (Exception e) {
- LOG.finest(() -> "Unparseable Integer value: " + trimmed);
- return null;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
deleted file mode 100644
index 7c223dd..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateConverter.java
+++ /dev/null
@@ -1,36 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.time.LocalDate;
-import java.util.Objects;
-
-/**
- * Converter, converting from String to LocalDate.
- */
-public class LocalDateConverter implements PropertyConverter<LocalDate>{
-
- @Override
- public LocalDate convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- return LocalDate.parse(trimmed);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
deleted file mode 100644
index 0dd3351..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalDateTimeConverter.java
+++ /dev/null
@@ -1,36 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.time.LocalDateTime;
-import java.util.Objects;
-
-/**
- * Converter, converting from String to LocalDateTime.
- */
-public class LocalDateTimeConverter implements PropertyConverter<LocalDateTime>{
-
- @Override
- public LocalDateTime convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- return LocalDateTime.parse(trimmed);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.java
deleted file mode 100644
index 047d6ff..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LocalTimeConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.time.LocalTime;
-import java.util.Objects;
-
-/**
- * Converter, converting from String to LocalTime.
- */
-public class LocalTimeConverter implements PropertyConverter<LocalTime>{
-
- @Override
- public LocalTime convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- return LocalTime.parse(trimmed);
- }
-
- public static void main(String... args){
- LocalTime.parse("10:00");
- LocalTime.parse("10:00:23");
- LocalTime.parse("10");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java
deleted file mode 100644
index 561c846..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java
+++ /dev/null
@@ -1,68 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Long, the supported format is one of the following:
- * <ul>
- * <li>123 (byte value)</li>
- * <li>0xFF (byte value)</li>
- * <li>0XDF (byte value)</li>
- * <li>0D1 (byte value)</li>
- * <li>-123 (byte value)</li>
- * <li>-0xFF (byte value)</li>
- * <li>-0XDF (byte value)</li>
- * <li>-0D1 (byte value)</li>
- * <li>MIN_VALUE (ignoring case)</li>
- * <li>MIN (ignoring case)</li>
- * <li>MAX_VALUE (ignoring case)</li>
- * <li>MAX (ignoring case)</li>
- * </ul>
- */
-public class LongConverter implements PropertyConverter<Long> {
-
- private static final Logger LOGGER = Logger.getLogger(LongConverter.class.getName());
-
- @Override
- public Long convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch (trimmed.toUpperCase(Locale.ENGLISH)) {
- case "MIN_VALUE":
- case "MIN":
- return Long.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Long.MAX_VALUE;
- default:
- try {
- return Long.decode(trimmed);
- } catch (Exception e) {
- LOGGER.finest("Unable to parse Long value: " + value);
- return null;
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/NumberConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/NumberConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/NumberConverter.java
deleted file mode 100644
index 7ec7dff..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/NumberConverter.java
+++ /dev/null
@@ -1,72 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.math.BigDecimal;
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Number. Valid inputs are:
- * <pre>
- * POSITIVE_INFINITY -> Double.POSITIVE_INFINITY
- * NEGATIVE_INFINITY -> Double.NEGATIVE_INFINITY
- * NaN -> Double.NaN
- * 0xFFDCD3D2 -> Long
- * 1234566789.23642327352735273752 -> new BigDecimal(input)
- * </pre>
- */
-public class NumberConverter implements PropertyConverter<Number> {
-
- /**
- * the logger.
- */
- private static final Logger LOGGER = Logger.getLogger(NumberConverter.class.getName());
- /**
- * Converter used for trying to parse as an integral value.
- */
- private LongConverter longConverter = new LongConverter();
-
- @Override
- public Number convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch (trimmed.toUpperCase(Locale.ENGLISH)) {
- case "POSITIVE_INFINITY":
- return Double.POSITIVE_INFINITY;
- case "NEGATIVE_INFINITY":
- return Double.NEGATIVE_INFINITY;
- case "NAN":
- return Double.NaN;
- default:
- Long lVal = longConverter.convert(trimmed);
- if (lVal != null) {
- return lVal;
- }
- try {
- return new BigDecimal(trimmed);
- } catch (Exception e) {
- LOGGER.finest("Unparseable Number: " + trimmed);
- return null;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java
deleted file mode 100644
index 81ff510..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java
+++ /dev/null
@@ -1,70 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.util.Locale;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to Short, the supported format is one of the following:
- * <ul>
- * <li>123 (byte value)</li>
- * <li>0xFF (byte value)</li>
- * <li>0XDF (byte value)</li>
- * <li>0D1 (byte value)</li>
- * <li>-123 (byte value)</li>
- * <li>-0xFF (byte value)</li>
- * <li>-0XDF (byte value)</li>
- * <li>-0D1 (byte value)</li>
- * <li>MIN_VALUE (ignoring case)</li>
- * <li>MIN (ignoring case)</li>
- * <li>MAX_VALUE (ignoring case)</li>
- * <li>MAX (ignoring case)</li>
- * </ul>
- */
-public class ShortConverter implements PropertyConverter<Short> {
-
- /**
- * the logger.
- */
- private static final Logger LOG = Logger.getLogger(ShortConverter.class.getName());
-
- @Override
- public Short convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- switch (trimmed.toUpperCase(Locale.ENGLISH)) {
- case "MIN_VALUE":
- case "MIN":
- return Short.MIN_VALUE;
- case "MAX_VALUE":
- case "MAX":
- return Short.MAX_VALUE;
- default:
- try {
- return Short.decode(trimmed);
- } catch (Exception e) {
- LOG.finest(() -> "Unparseable Short: " + trimmed);
- return null;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URIConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URIConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URIConverter.java
deleted file mode 100644
index 8c16edc..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URIConverter.java
+++ /dev/null
@@ -1,45 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.net.URI;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to URI, using new URI(value).
- */
-public class URIConverter implements PropertyConverter<URI>{
-
- private Logger LOG = Logger.getLogger(getClass().getName());
-
- @Override
- public URI convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try {
- return new URI(trimmed);
- } catch (Exception e) {
- LOG.log(Level.FINE, e, () -> "Unparseable URI: " + trimmed);
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URLConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URLConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URLConverter.java
deleted file mode 100644
index 8401048..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/URLConverter.java
+++ /dev/null
@@ -1,45 +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.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.net.URL;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to URI, using new URL(value).
- */
-public class URLConverter implements PropertyConverter<URL> {
-
- private Logger LOG = Logger.getLogger(getClass().getName());
-
- @Override
- public URL convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try {
- return new URL(trimmed);
- } catch (Exception e) {
- LOG.log(Level.FINE, e, () -> "Unparseable URL: " + trimmed);
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ZoneIdConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ZoneIdConverter.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ZoneIdConverter.java
deleted file mode 100644
index efdd0f5..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/ZoneIdConverter.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.internal.converters;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-import java.time.ZoneId;
-import java.util.Objects;
-import java.util.logging.Logger;
-
-/**
- * Converter, converting from String to ZoneId. Valid inputs are as defined by {@link ZoneId#of(String)}.
- */
-public class ZoneIdConverter implements PropertyConverter<ZoneId> {
-
- /**
- * the logger.
- */
- private static final Logger LOG = Logger.getLogger(ShortConverter.class.getName());
-
- @Override
- public ZoneId convert(String value) {
- String trimmed = Objects.requireNonNull(value).trim();
- try {
- return ZoneId.of(trimmed);
- } catch (Exception e) {
- LOG.finest("Unparseable ZoneId: " + trimmed);
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
deleted file mode 100644
index f7404c8..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/BasePropertySource.java
+++ /dev/null
@@ -1,55 +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.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Abstract {@link org.apache.tamaya.spi.PropertySource} that allows to set a default ordinal that will be used, if no
- * ordinal is provided with the config.
- */
-public abstract class BasePropertySource implements PropertySource{
- /** default ordinal that will be used, if no ordinal is provided with the config. */
- private final int defaultOrdinal;
-
- /**
- * COnstructor.
- * @param defaultOrdinal default ordinal that will be used, if no ordinal is provided with the config.
- */
- protected BasePropertySource(int defaultOrdinal){
- this.defaultOrdinal = defaultOrdinal;
- }
-
- @Override
- public int getOrdinal() {
- String configuredOrdinal = get(TAMAYA_ORDINAL);
- if(configuredOrdinal!=null){
- try{
- return Integer.parseInt(configuredOrdinal);
- } catch(Exception e){
- Logger.getLogger(getClass().getName()).log(Level.WARNING, e,
- () -> "Configured Ordinal is not an int number: " + configuredOrdinal);
- }
- }
- return defaultOrdinal;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.java
deleted file mode 100644
index b927274..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySource.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;
-
-import org.apache.tamaya.spi.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 implements PropertySource {
-
- /**
- * default ordinal for {@link EnvironmentPropertySource}
- */
- public static final int DEFAULT_ORDINAL = 300;
-
- @Override
- public int getOrdinal() {
- return DEFAULT_ORDINAL;
- }
-
- @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/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
deleted file mode 100644
index 72b2e92..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.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.core.propertysource;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-
-/**
- * Simple implementation of a {@link org.apache.tamaya.spi.PropertySource} for properties-files.
- */
-public class SimplePropertySource implements PropertySource{
- /** The property source name. */
- private String name;
- /** The current properties. */
- private Map<String,String> properties;
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- * @param propertiesLocation the URL encoded location, not null.
- */
- public SimplePropertySource(File propertiesLocation) {
- try{
- this.properties = load(propertiesLocation.toURI().toURL());
- this.name = propertiesLocation.toString();
- } catch(IOException e){
- throw new ConfigException("Failed to load properties from " + propertiesLocation,e);
- }
- }
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- * @param propertiesLocation the URL encoded location, not null.
- */
- public SimplePropertySource(URL propertiesLocation) {
- this.properties = load(propertiesLocation);
- this.name = propertiesLocation.toExternalForm();
- }
-
- /**
- * Creates a new Properties based PropertySource based on the given URL.
- * @param name The property source name
- * @param propertiesLocation the URL encoded location, not null.
- */
- public SimplePropertySource(String name, URL propertiesLocation) {
- this.properties = load(propertiesLocation);
- this.name = Objects.requireNonNull(name);
- }
-
- /**
- * Creates a new Properties based PropertySource based on the given properties map.
- *
- * @param name the name, not null.
- * @param properties the properties, not null.
- */
- public SimplePropertySource(String name, Map<String, String> properties) {
- this.properties = new HashMap<>(properties);
- this.name = Objects.requireNonNull(name);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return this.properties;
- }
-
- /**
- * loads the Properties from the given URL
- *
- * @param propertiesFile {@link URL} to load Properties from
- *
- * @return loaded {@link java.util.Properties}
- *
- * @throws IllegalStateException in case of an error while reading properties-file
- */
- private Map<String,String> load(URL propertiesFile) {
- Map<String,String> properties = new HashMap<>();
- try (InputStream stream = propertiesFile.openStream()) {
- Properties props = new Properties();
- if (stream != null) {
- props.load(stream);
- }
- props.forEach((k,v) -> properties.put(k.toString(), v.toString()));
- } catch (IOException e) {
- throw new ConfigException("Error loading properties " + propertiesFile, e);
- }
- return properties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
deleted file mode 100644
index 4e7708e..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
+++ /dev/null
@@ -1,87 +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.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 implements PropertySource {
-
- /**
- * default ordinal for {@link SystemPropertySource}
- */
- public static final int DEFAULT_ORDINAL = 1000;
-
- private volatile Map<String,String> cachedProperties;
-
- /**
- * previous System.getProperties().hashCode()
- * so we can check if we need to reload
- */
- private int previousHash;
-
-
- public SystemPropertySource() {
- cachedProperties = loadProperties();
- previousHash = System.getProperties().hashCode();
- }
-
- private Map<String, String> loadProperties() {
- Map<String,String> props = new HashMap<>();
- Properties sysProps = System.getProperties();
- sysProps.forEach((k,v) -> props.put(k.toString(),v.toString()));
- return props;
- }
-
- @Override
- public int getOrdinal() {
- return DEFAULT_ORDINAL;
- }
-
- @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
- // synchonization was removed, Instance was marked as volatile. In the worst case it
- // is reloaded twice, but the values will be the same.
- 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.cachedProperties = Collections.unmodifiableMap(properties);
- previousHash = systemProperties.hashCode();
- }
- return this.cachedProperties;
- }
-}
[5/6] incubator-tamaya git commit: Removed the attic
Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
deleted file mode 100644
index 8490455..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.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;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class that tests the default methods implemented on {@link org.apache.tamaya.Configuration}. The provided
- * {@link org.apache.tamaya.TestConfiguration} is implemented with maximal use of the default methods.
- */
-public class ConfigurationTest {
-
- @Test
- public void testget() throws Exception {
- assertEquals(Boolean.TRUE, ConfigurationProvider.getConfiguration().getOptional("booleanTrue", Boolean.class).get());
- assertEquals(Boolean.FALSE, ConfigurationProvider.getConfiguration().getOptional("booleanFalse", Boolean.class).get());
- assertEquals((int) Byte.MAX_VALUE, (int) ConfigurationProvider.getConfiguration().getOptional("byte", Byte.class).get());
- assertEquals((int) Integer.MAX_VALUE, (int) ConfigurationProvider.getConfiguration().getOptional("int", Integer.class).get());
- assertEquals((long) Long.MAX_VALUE, (long) ConfigurationProvider.getConfiguration().getOptional("long", Long.class).get());
- assertEquals((double) Float.MAX_VALUE, (double) ConfigurationProvider.getConfiguration().getOptional("float", Float.class).get(), 0.0d);
- assertEquals((double) Double.MAX_VALUE, (double) ConfigurationProvider.getConfiguration().getOptional("double", Double.class).get(), 0.0d);
- }
-
- @Test
- public void testGetBoolean() throws Exception {
- assertTrue(ConfigurationProvider.getConfiguration().getBoolean("booleanTrue").isPresent());
- assertTrue(ConfigurationProvider.getConfiguration().getBoolean("booleanFalse").isPresent());
- assertFalse(ConfigurationProvider.getConfiguration().getBoolean("booleanFalse").get());
- assertTrue(ConfigurationProvider.getConfiguration().getBoolean("booleanTrue").get());
- assertFalse(ConfigurationProvider.getConfiguration().getBoolean("fooBar").isPresent());
- }
-
- @Test
- public void testGetInteger() throws Exception {
- assertEquals(Integer.MAX_VALUE, ConfigurationProvider.getConfiguration().getInteger("int").getAsInt());
- }
-
- @Test
- public void testGetLong() throws Exception {
- assertEquals(Long.MAX_VALUE, ConfigurationProvider.getConfiguration().getLong("long").getAsLong());
- }
-
- @Test
- public void testGetDouble() throws Exception {
- assertEquals(Double.MAX_VALUE, ConfigurationProvider.getConfiguration().getDouble("double").getAsDouble(), 0.0d);
- }
-
- @Test
- public void testWith() throws Exception {
- assertEquals(ConfigurationProvider.getConfiguration(), ConfigurationProvider.getConfiguration().with(c -> c));
- }
-
- @Test
- public void testQuery() throws Exception {
- assertEquals("myFooResult", ConfigurationProvider.getConfiguration().query(c -> "myFooResult"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/attic/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
deleted file mode 100644
index ef7cccf..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ /dev/null
@@ -1,80 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Test Configuration class, that is used to testdata the default methods provided by the API.
- */
-public class TestConfiguration implements Configuration {
-
- private static final Map<String, String> VALUES;
-
- static {
- VALUES = new HashMap<String, String>();
- VALUES.put("long", String.valueOf(Long.MAX_VALUE));
- VALUES.put("int", String.valueOf(Integer.MAX_VALUE));
- VALUES.put("double", String.valueOf(Double.MAX_VALUE));
- VALUES.put("float", String.valueOf(Float.MAX_VALUE));
- VALUES.put("short", String.valueOf(Short.MAX_VALUE));
- VALUES.put("byte", String.valueOf(Byte.MAX_VALUE));
- VALUES.put("booleanTrue", "true");
- VALUES.put("booleanFalse", "false");
- VALUES.put("String", "aStringValue");
- }
-
- @Override
- public String get(String key) {
- return VALUES.get(key);
- }
-
- @Override
- public <T> T get(String key, TypeLiteral<T> type) {
- if (type.getType().equals(Long.class)) {
- return (T) (Object) Long.MAX_VALUE;
- } else if (type.getType().equals(Integer.class)) {
- return (T) (Object) Integer.MAX_VALUE;
- } else if (type.getType().equals(Double.class)) {
- return (T) (Object) Double.MAX_VALUE;
- } else if (type.getType().equals(Float.class)) {
- return (T) (Object) Float.MAX_VALUE;
- } else if (type.getType().equals(Short.class)) {
- return (T) (Object) Short.MAX_VALUE;
- } else if (type.getType().equals(Byte.class)) {
- return (T) (Object) Byte.MAX_VALUE;
- } else if (type.getType().equals(Boolean.class)) {
- if ("booleanTrue".equals(key)) {
- return (T) (Object) Boolean.TRUE;
- } else if ("booleanFalse".equals(key)) {
- return (T) (Object) Boolean.FALSE;
- }
- } else if (type.getType().equals(String.class)) {
- return (T) (Object) "aStringValue";
- }
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/attic/java8/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
deleted file mode 100644
index 98820ca..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.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;
-
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-
-/**
- * Test Configuration class, that is used to testdata the default methods provided by the API.
- */
-public class TestConfigurationProvider implements ConfigurationProviderSpi {
-
- private static final Configuration config = new TestConfiguration();
-
-
- @Override
- public Configuration getConfiguration() {
- return config;
- }
-
- @Override
- public ConfigurationContext getConfigurationContext() {
- return null;
- }
-
- @Override
- public ConfigurationContextBuilder getConfigurationContextBuilder() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
deleted file mode 100644
index 79f6257..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
+++ /dev/null
@@ -1,61 +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;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for the {@link org.apache.tamaya.TypeLiteral} class.
- */
-public class TypeLiteralTest {
-
- @Test
- public void test_constrcutor(){
- TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
- assertEquals(List.class, listTypeLiteral.getRawType());
- assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
- }
-
- @Test
- public void test_of(){
- class MyListClass extends ArrayList<String>{};
- TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
- assertEquals(MyListClass.class, listTypeLiteral.getRawType());
- assertEquals(MyListClass.class, listTypeLiteral.getType());
- }
-
- @Test
- public void test_getTypeParameter(){
- TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
- assertEquals(List.class, listTypeLiteral.getRawType());
- assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
- }
-
- @Test
- public void test_getGenericInterfaceTypeParameter(){
- class MyListClass extends ArrayList<String> implements List<String>{};
- assertEquals(String.class, TypeLiteral.getGenericInterfaceTypeParameters(MyListClass.class, List.class)[0]);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
deleted file mode 100644
index 949170d..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
+++ /dev/null
@@ -1,131 +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.spi;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-public class ServiceContextManagerTest {
-
- private static URLClassLoader classLoader;
- private static Field delegateField;
-
- @BeforeClass
- public static void init() throws Exception {
-
- // setup the environment for our ugly hacks
-
- // replace classloader with our own
- classLoader = (URLClassLoader) Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(new UglyHackClassLoader(classLoader));
-
- // clear the caching field
- delegateField = ServiceContextManager.class.getDeclaredField("serviceContextProviderDelegate");
- delegateField.setAccessible(true);
-
- delegateField.set(null, null);
- }
-
- @AfterClass
- public static void clean() throws Exception {
-
- // clean our hacks
-
- delegateField.set(null, null);
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- @Test
- public void testGetServiceContext() {
-
- ServiceContext context = ServiceContextManager.getServiceContext();
- Assert.assertEquals(1, context.ordinal());
-
- }
-
- @Test
- public void testSetServiceContext(){
- ServiceContext ctx = new ServiceContext() {
- @Override
- public <T> T getService(Class<T> serviceType) {
- return null;
- }
-
- @Override
- public <T> List<T> getServices(Class<T> serviceType) {
- return Collections.emptyList();
- }
- };
- ServiceContext prevContext = ServiceContextManager.set(ctx);
- if(prevContext!=null) {
- ServiceContextManager.set(prevContext);
- assertTrue(ServiceContextManager.getServiceContext() == prevContext);
- }
- }
-
-
- // has to be public because ServiceLoader won't find it otherwise
- public static class ServiceContextWithOrdinal implements ServiceContext {
-
- @Override
- public int ordinal() {
- return 100;
- }
-
- @Override
- public <T> T getService(Class<T> serviceType) {
- return null;
- }
-
- @Override
- public <T> List<T> getServices(Class<T> serviceType) {
- return null;
- }
- }
-
- // to override the getResources method to use our own 'ServiceLoader'-file we have to this ugly hack
- private static class UglyHackClassLoader extends URLClassLoader {
-
- private UglyHackClassLoader(URLClassLoader urlClassLoader) {
- super(urlClassLoader.getURLs());
- }
-
-
- @Override
- public Enumeration<URL> getResources(String name) throws IOException {
- if ("META-INF/services/org.apache.tamaya.spi.ServiceContext".equals(name)) {
- return super.getResources("ServiceContextWithOrdinal");
- }
-
- return super.getResources(name);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
deleted file mode 100644
index 28d9fac..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
+++ /dev/null
@@ -1,91 +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.spi;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-public class ServiceContextTest {
-
- private ServiceContext serviceContext = new ServiceContext() {
-
- @Override
- public <T> T getService(Class<T> serviceType) {
- if (String.class.equals(serviceType)) {
- return serviceType.cast("ServiceContextTest");
- }
- return null;
- }
-
- @Override
- public <T> List<T> getServices(Class<T> serviceType) {
- if (String.class.equals(serviceType)) {
- List<String> list = new ArrayList<>();
- list.add("ServiceContextTest");
- return List.class.cast(list);
- }
- return Collections.EMPTY_LIST;
- }
- };
-
- @Test
- public void testOrdinal() throws Exception {
- assertEquals(1, serviceContext.ordinal());
- }
-
- @Test
- public void testgetService() throws Exception {
- assertEquals("ServiceContextTest", serviceContext.getService(String.class));
- assertTrue(serviceContext.getService(Integer.class)==null);
- }
-
- @Test
- public void testGetService() throws Exception {
- String service = serviceContext.getService(String.class);
- assertNotNull(service);
- assertTrue(service!=null);
- assertEquals("ServiceContextTest", service);
- Integer intService = serviceContext.getService(Integer.class);
- assertNull(intService);
- }
-
- @Test
- public void testGetServices() throws Exception {
- Collection<String> services = serviceContext.getServices(String.class);
- assertNotNull(services);
- assertFalse(services.isEmpty());
- assertEquals("ServiceContextTest", services.iterator().next());
- List<Integer> intServices = serviceContext.getServices(Integer.class);
- assertNotNull(intServices);
- assertTrue(intServices.isEmpty());
- }
-
- @Test
- public void testGetInstance() throws Exception {
- assertNotNull(ServiceContext.getInstance());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java b/attic/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
deleted file mode 100644
index 720a5c4..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
+++ /dev/null
@@ -1,83 +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.spi;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-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 TestServiceContext implements ServiceContext {
- /**
- * List current services loaded, per class.
- */
- private final ConcurrentHashMap<Class<?>, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
- /**
- * Singletons.
- */
- private final Map<Class<?>, Object> singletons = new ConcurrentHashMap<>();
-
- @Override
- public <T> T getService(Class<T> serviceType) {
- T cached = serviceType.cast(singletons.get(serviceType));
- if (cached == null) {
- List<? extends T> services = getServices(serviceType);
- if (services.isEmpty()) {
- cached = null;
- } else {
- cached = 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(Class<T> serviceType) {
- try {
- List<T> services = new ArrayList<>();
- for (T t : ServiceLoader.load(serviceType)) {
- services.add(t);
- }
- services = Collections.unmodifiableList(services);
- final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>) services));
- return previousServices != null ? previousServices : services;
- } catch (Exception e) {
- Logger.getLogger(TestServiceContext.class.getName()).log(Level.WARNING,
- "Error loading services current type " + serviceType, e);
- return Collections.emptyList();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
deleted file mode 100644
index b9c5ba5..0000000
--- a/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
+++ /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.TestConfigurationProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 199956f..0000000
--- a/attic/java8/api/src/test/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.spi.TestServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/resources/ServiceContextWithOrdinal b/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
deleted file mode 100644
index 4112c18..0000000
--- a/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
+++ /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.
-
-# this is just an ugly hack to test the loading of ServiceContexts
-# if we have more than one
-
-# this one is without overriding ordinal so it shall take the default
-org.apache.tamaya.spi.TestServiceContext
-
-# this one has a higher ordinal (100)
-org.apache.tamaya.spi.ServiceContextManagerTest$ServiceContextWithOrdinal
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/pom.xml
----------------------------------------------------------------------
diff --git a/attic/java8/core/pom.xml b/attic/java8/core/pom.xml
deleted file mode 100644
index 08860b6..0000000
--- a/attic/java8/core/pom.xml
+++ /dev/null
@@ -1,87 +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.
--->
-<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</groupId>
- <artifactId>tamaya-java8</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tamaya-core</artifactId>
- <name>Apache Tamaya Java 8 Core</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copyMain</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <stripVersion>true</stripVersion>
- <artifactItems>
- <artifactItem>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-main</artifactId>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
deleted file mode 100644
index 8eaa5cd..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
+++ /dev/null
@@ -1,235 +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.ConfigException;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.TypeLiteral;
-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.PropertyValueCombinationPolicy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Collectors;
-
-/**
- * Implementation of the Configuration API. This class uses the current {@link ConfigurationContext} to evaluate the
- * chain of {@link org.apache.tamaya.spi.PropertySource} and {@link org.apache.tamaya.spi.PropertyFilter}
- * instance to evaluate the current Configuration.
- */
-public class DefaultConfiguration implements Configuration {
- /**
- * The logger.
- */
- private static final Logger LOG = Logger.getLogger(DefaultConfiguration.class.getName());
- /**
- * The maximal number of filter cycles performed before aborting.
- */
- private static final int MAX_FILTER_LOOPS = 10;
-
- /**
- * The current {@link org.apache.tamaya.spi.ConfigurationContext} of the current instance.
- */
- private final ConfigurationContext configurationContext;
-
- /**
- * Constructor.
- * @param configurationContext The configuration Context to be used.
- */
- public DefaultConfiguration(ConfigurationContext configurationContext){
- this.configurationContext = Objects.requireNonNull(configurationContext);
- }
-
- /**
- * This method evaluates the given configuration key. Hereby if goes down the chain or PropertySource instances
- * provided by the current {@link org.apache.tamaya.spi.ConfigurationContext}. The first non-null-value returned
- * is taken as an intermediate value. Finally the value is filtered through the
- * {@link org.apache.tamaya.spi.PropertyFilter} instances installed, before it is returned as the final result of
- * this method.
- *
- * @param key the property's key, not null.
- * @return the optional configuration value, never null.
- */
- @Override
- public String get(String key) {
- List<PropertySource> propertySources = configurationContext.getPropertySources();
- String unfilteredValue = null;
- PropertyValueCombinationPolicy combinationPolicy = this.configurationContext
- .getPropertyValueCombinationPolicy();
- for (PropertySource propertySource : propertySources) {
- unfilteredValue = combinationPolicy.collect(unfilteredValue, key, propertySource);
- }
- return applyFilter(key, unfilteredValue);
- }
-
- /**
- * Apply filters to a single property value.
- *
- * @param key the key, used for logging, not null.
- * @param unfilteredValue the unfiltered property value.
- * @return the filtered value, or null.
- */
- private String applyFilter(String key, String unfilteredValue) {
- // Apply filters to values, prevent values filtered to null!
- for (int i = 0; i < MAX_FILTER_LOOPS; i++) {
- boolean changed = false;
- // Apply filters to values, prevent values filtered to null!
- for (PropertyFilter filter : configurationContext.getPropertyFilters()) {
- String newValue = filter.filterProperty(key, unfilteredValue);
- if (newValue != null && !newValue.equals(unfilteredValue)) {
- changed = true;
- if (LOG.isLoggable(Level.FINEST)) {
- LOG.finest("Filter - " + key + ": " + unfilteredValue + " -> " + newValue + " by " + filter);
- }
- } else if (unfilteredValue != null && !unfilteredValue.equals(newValue)) {
- changed = true;
- if (LOG.isLoggable(Level.FINEST)) {
- LOG.finest("Filter - " + key + ": " + unfilteredValue + " -> " + newValue + " by " + filter);
- }
- }
- unfilteredValue = newValue;
- }
- if (!changed) {
- LOG.finest(() -> "Finishing filter loop, no changes detected.");
- break;
- } else {
- if (i == (MAX_FILTER_LOOPS - 1)) {
- if (LOG.isLoggable(Level.WARNING)) {
- LOG.warning("Maximal filter loop count reached, aborting filter evaluation after cycles: " + i);
- }
- } else {
- LOG.finest(() -> "Repeating filter loop, changes detected.");
- }
- }
- }
- return unfilteredValue;
- }
-
- /**
- * Get the current properties, composed by the loaded {@link org.apache.tamaya.spi.PropertySource} and filtered
- * by registered {@link org.apache.tamaya.spi.PropertyFilter}.
- *
- * @return the final properties.
- */
- @Override
- public Map<String, String> getProperties() {
- List<PropertySource> propertySources = new ArrayList<>(configurationContext.getPropertySources());
- Map<String, String> result = new HashMap<>();
- for (PropertySource propertySource : propertySources) {
- try {
- int origSize = result.size();
- Map<String, String> otherMap = propertySource.getProperties();
- LOG.log(Level.FINEST, null, () -> "Overriding with properties from " + propertySource.getName());
- result.putAll(otherMap);
- LOG.log(Level.FINEST, null, () -> "Handled properties from " + propertySource.getName() + "(new: " +
- (result.size() - origSize) + ", overrides: " + origSize + ", total: " + result.size());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Error adding properties from PropertySource: " + propertySource + ", ignoring PropertySource.", e);
- }
- }
- return applyFilters(result);
- }
-
- /**
- * Filter a full configuration property map.
- *
- * @param inputMap the unfiltered map
- * @return the filtered map.
- */
- private Map<String, String> applyFilters(Map<String, String> inputMap) {
- // Apply filters to values, prevent values filtered to null!
- for (int i = 0; i < MAX_FILTER_LOOPS; i++) {
- AtomicInteger changes = new AtomicInteger();
- for (PropertyFilter filter : configurationContext.getPropertyFilters()) {
- inputMap.replaceAll((k, v) -> {
- String newValue = filter.filterProperty(k, v);
- if (newValue != null && !newValue.equals(v)) {
- changes.incrementAndGet();
- LOG.finest(() -> "Filter - " + k + ": " + v + " -> " + newValue + " by " + filter);
- } else if (v != null && !v.equals(newValue)) {
- changes.incrementAndGet();
- LOG.finest(() -> "Filter - " + k + ": " + v + " -> " + newValue + " by " + filter);
- }
- return newValue;
- });
- }
- if (changes.get() == 0) {
- LOG.finest(() -> "Finishing filter loop, no changes detected.");
- break;
- } else {
- if (i == (MAX_FILTER_LOOPS - 1)) {
- if (LOG.isLoggable(Level.WARNING)) {
- LOG.warning("Maximal filter loop count reached, aborting filter evaluation after cycles: " + i);
- }
- } else {
- LOG.finest(() -> "Repeating filter loop, changes detected: " + changes.get());
- }
- changes.set(0);
- }
- }
- // Remove null values
- return inputMap.entrySet().parallelStream().filter((e) -> e.getValue() != null).collect(
- Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- }
-
- /**
- * Accesses the current String value for the given key (see {@link #getOptional(String)}) 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) {
- Optional<String> value = getOptional(key);
- if (value.isPresent()) {
- List<PropertyConverter<T>> converters = configurationContext.getPropertyConverters(type);
- for (PropertyConverter<T> converter : converters) {
- try {
- T t = converter.convert(value.get());
- if (t != null) {
- return t;
- }
- } catch (Exception e) {
- LOG.log(Level.FINEST, e, () -> "PropertyConverter: " + converter +
- " failed to convert value: " + value.get());
- }
- }
-
- throw new ConfigException("Unable to convert config value for key " +
- key + " in type " + type.getType());
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
deleted file mode 100644
index 96d5909..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ /dev/null
@@ -1,239 +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.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import javax.annotation.Priority;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.logging.Logger;
-
-/**
- * Default Implementation of a simple ConfigurationContext.
- */
-public class DefaultConfigurationContext implements ConfigurationContext {
- /** The logger used. */
- private final static Logger LOG = Logger.getLogger(DefaultConfigurationContext.class.getName());
- /**
- * 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;
-
- /**
- * The overriding policy used when combining PropertySources registered to evalute the final configuration
- * values.
- */
- private PropertyValueCombinationPolicy propertyValueCombinationPolicy;
-
- /**
- * 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);
- LOG.info(() -> "Registered " + immutablePropertySources.size() + " property sources: " +
- createStringList(immutablePropertySources,ps -> ps.getName() + '[' + ps.getClass().getName()+']'));
-
- // 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);
- LOG.info(() -> "Registered " + immutablePropertyFilters.size() + " property filters: " +
- createStringList(immutablePropertyFilters,f -> f.getClass().getName()));
-
- propertyValueCombinationPolicy = ServiceContext.getInstance().getService(PropertyValueCombinationPolicy.class);
- if(propertyValueCombinationPolicy==null) {
- propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
- }
- LOG.info(() -> "Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
- }
-
- DefaultConfigurationContext(DefaultConfigurationContextBuilder builder) {
- List<PropertySource> propertySources = new ArrayList<>();
- // first we load all PropertySources which got registered via java.util.ServiceLoader
- propertySources.addAll(builder.propertySources);
- // now sort them according to their ordinal values
- Collections.sort(propertySources, this::comparePropertySources);
- immutablePropertySources = Collections.unmodifiableList(propertySources);
- LOG.info(() -> "Registered " + immutablePropertySources.size() + " property sources: " +
- createStringList(immutablePropertySources,ps -> ps.getName() + '[' + ps.getClass().getName()+']'));
-
- // 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);
- LOG.info(() -> "Registered " + immutablePropertyFilters.size() + " property filters: " +
- createStringList(immutablePropertyFilters,f -> f.getClass().getName()));
-
- propertyValueCombinationPolicy = ServiceContext.getInstance().getService(PropertyValueCombinationPolicy.class);
- if(propertyValueCombinationPolicy==null){
- propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
- }
- LOG.info(() -> "Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
- }
-
- /**
- * 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<>();
- Collection<PropertySourceProvider> propertySourceProviders = ServiceContext.getInstance().getServices(PropertySourceProvider.class);
- for (PropertySourceProvider propertySourceProvider : propertySourceProviders) {
- Collection<PropertySource> sources = propertySourceProvider.getPropertySources();
- LOG.finer(() -> "PropertySourceProvider " + propertySourceProvider.getClass().getName() +
- " provided the following property sources: " +
- createStringList(sources,ps -> ps.getName() + '[' + ps.getClass().getName()+']'));
- propertySources.addAll(sources);
- }
- 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 source1.getClass().getName().compareTo(source2.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 Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
- return propertyConverterManager.getPropertyConverters();
- }
-
- @Override
- public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType) {
- return propertyConverterManager.getPropertyConverters(targetType);
- }
-
- @Override
- public List<PropertyFilter> getPropertyFilters() {
- return immutablePropertyFilters;
- }
-
- @Override
- public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy(){
- return propertyValueCombinationPolicy;
- }
-
- @Override
- public ConfigurationContextBuilder toBuilder() {
- ServiceContext serviceContext = ServiceContextManager.getServiceContext();
- ConfigurationContextBuilder service = serviceContext.getService(ConfigurationContextBuilder.class);
-
- service.setContext(this);
-
- return service;
- }
-
- private <T> String createStringList(Collection<T> propertySources, Function<T,String> mapper){
- StringBuilder joiner = new StringBuilder(", ");
- propertySources.forEach(t -> joiner.append(mapper.apply(t)));
- return joiner.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
deleted file mode 100644
index c181373..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
+++ /dev/null
@@ -1,145 +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.ConfigException;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-/**
- * Default implementation of {@link org.apache.tamaya.spi.ConfigurationContextBuilder}.
- */
-public class DefaultConfigurationContextBuilder implements ConfigurationContextBuilder {
-
- List<PropertySource> propertySources = new ArrayList<>();
- List<PropertyFilter> propertyFilters = new ArrayList<>();
- Map<TypeLiteral<?>, List<PropertyConverter<?>>> propertyConverters = new HashMap<>();
- PropertyValueCombinationPolicy combinationPolicy;
-
- public DefaultConfigurationContextBuilder(){
- }
-
- @Override
- public ConfigurationContextBuilder setContext(ConfigurationContext context) {
- this.propertySources.clear();
- this.propertySources.addAll(context.getPropertySources());
- this.propertyFilters.clear();
- this.propertyFilters.addAll(context.getPropertyFilters());
- this.propertyConverters.clear();
- this.propertyConverters.putAll(context.getPropertyConverters());
- this.combinationPolicy = context.getPropertyValueCombinationPolicy();
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd) {
- Set<String> names = this.propertySources.stream().map(ps -> ps.getName()).collect(Collectors.toSet());
- for(PropertySource ps:propertySourcesToAdd){
- if(names.contains(ps.getName())){
- throw new ConfigException("Duplicate PropertySource: " + ps.getName());
- }
- }
- this.propertySources.addAll(propertySourcesToAdd);
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesToRemove) {
- this.propertySources = this.propertySources.stream().filter(ps -> !propertySourcesToRemove
- .contains(ps.getName())).collect(Collectors.toList());
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters) {
- this.propertyFilters.addAll(filters);
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder removePropertyFilters(Predicate<PropertyFilter> selector) {
- Collection<PropertyFilter> filtersToRemove = this.propertyFilters.stream().filter(selector)
- .collect(Collectors.toList());
- this.propertyFilters.removeAll(filtersToRemove);
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
- this.propertyFilters.removeAll(filters);
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder removePropertySources(Predicate<PropertySource> selector) {
- Collection<PropertySource> sourcesToRemove = this.propertySources.stream().filter(selector)
- .collect(Collectors.toList());
- this.propertySources.removeAll(sourcesToRemove);
- return this;
- }
-
- @Override
- public <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {
- List<PropertyConverter<?>> converters = this.propertyConverters.computeIfAbsent(typeToConvert, (k) -> new ArrayList<>());
- converters.add(propertyConverter);
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, PropertyConverter<?>... converters) {
- return removePropertyConverters(typeToConvert, Arrays.asList(converters));
- }
-
- @Override
- public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, Collection<PropertyConverter<?>> converters) {
- List<PropertyConverter<?>> existing = this.propertyConverters.get(typeToConvert);
- if(existing!=null) {
- existing.removeAll(converters);
- }
- return this;
- }
-
- @Override
- public ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy) {
- this.combinationPolicy = Objects.requireNonNull(policy);
- return this;
- }
-
- @Override
- public ConfigurationContext build() {
- return new DefaultConfigurationContext(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
deleted file mode 100644
index 8b3d4bc..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.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.core.internal;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-
-/**
- * Implementation of the Configuration API. This class uses the current {@link org.apache.tamaya.spi.ConfigurationContext} to evaluate the
- * chain of {@link org.apache.tamaya.spi.PropertySource} and {@link org.apache.tamaya.spi.PropertyFilter}
- * instance to evaluate the current Configuration.
- */
-public class DefaultConfigurationProvider implements ConfigurationProviderSpi {
-
- private ConfigurationContext context = new DefaultConfigurationContext();
- private Configuration config = new DefaultConfiguration(context);
-
- @Override
- public Configuration getConfiguration() {
- return config;
- }
-
- @Override
- public ConfigurationContext getConfigurationContext() {
- return context;
- }
-
- @Override
- public ConfigurationContextBuilder getConfigurationContextBuilder() {
- ServiceContext serviceContext = ServiceContextManager.getServiceContext();
- ConfigurationContextBuilder service = serviceContext.getService(ConfigurationContextBuilder.class);
-
- return service;
- }
-
- @Override
- public void setConfigurationContext(ConfigurationContext context){
- this.config = new DefaultConfiguration(context);
- this.context = context;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
deleted file mode 100644
index 8f37244..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/internal/DefaultServiceContext.java
+++ /dev/null
@@ -1,148 +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.ConfigException;
-import org.apache.tamaya.spi.ServiceContext;
-
-import javax.annotation.Priority;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-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<?>, Object> singletons = new ConcurrentHashMap<>();
-
- @Override
- public <T> T getService(Class<T> serviceType) {
- T cached = serviceType.cast(singletons.get(serviceType));
- if (cached == null) {
- List<? extends T> services = getServices(serviceType);
- if (!services.isEmpty()) {
- cached = getServiceWithHighestPriority(services, serviceType);
- }
- if(cached!=null){
- 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;
- }
-
- /**
- * Checks the given instance for a @Priority annotation. If present the annotation's value s evaluated. If no such
- * annotation is present, a default priority is returned (1);
- * @param o the instance, not null.
- * @return a priority, by default 1.
- */
- public static int getPriority(Object o){
- int prio = 1; //X TODO discuss default priority
- Priority priority = o.getClass().getAnnotation(Priority.class);
- if (priority != null) {
- prio = priority.value();
- }
- return prio;
- }
-
- /**
- * @param services to scan
- * @param <T> type of the service
- *
- * @return the service with the highest {@link javax.annotation.Priority#value()}
- *
- * @throws ConfigException if there are multiple service implementations with the maximum priority
- */
- private <T> T getServiceWithHighestPriority(List<? extends T> services, Class<T> serviceType) {
-
- // we do not need the priority stuff if the list contains only one element
- if (services.size() == 1) {
- return services.get(0);
- }
-
- Integer highestPriority = null;
- int highestPriorityServiceCount = 0;
- T highestService = null;
-
- for (T service : services) {
- int prio = getPriority(service);
-
- if (highestPriority == null || highestPriority < prio) {
- highestService = service;
- highestPriorityServiceCount = 1;
- highestPriority = prio;
- } else if (highestPriority == prio) {
- highestPriorityServiceCount++;
- }
- }
-
- if (highestPriorityServiceCount > 1) {
- throw new ConfigException(MessageFormat.format("Found {0} implementations for Service {1} with Priority {2}: {3}",
- highestPriorityServiceCount,
- serviceType.getName(),
- highestPriority,
- services));
- }
-
- return highestService;
- }
-
-}
[2/6] incubator-tamaya git commit: Removed the attic
Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
deleted file mode 100644
index 86ee5dd..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/DoubleConverterTest.java
+++ /dev/null
@@ -1,176 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class DoubleConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.decimal", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().doubleValue(), 1.23456789, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_DecimalNegative() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.decimalNegative", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().doubleValue(), -1.23456789, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Integer() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.integer", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().doubleValue(),100d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex1() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.hex1", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().doubleValue(),255d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex2() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.hex2", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().doubleValue(),-255d, 0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_Hex3() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.hex3", Double.class);
- assertTrue(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.min", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Double.MIN_VALUE, valueRead.get().doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.max", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Double.MAX_VALUE, valueRead.get().doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_NaNValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.nan", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Double.NaN, valueRead.get().doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_PositiveInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.pi", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Double.POSITIVE_INFINITY, valueRead.get().doubleValue(),0.0d);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Double_NegativeInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Double> valueRead = config.getOptional("tests.converter.double.ni", Double.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Double.NEGATIVE_INFINITY, valueRead.get().doubleValue(),0.0d);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.java
deleted file mode 100644
index c8ec6dc..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/EnumConverterTest.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.internal.converters;
-
-import org.junit.Test;
-
-import java.math.RoundingMode;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class testing the {@link org.apache.tamaya.core.internal.converters.EnumConverter} class.
- */
-public class EnumConverterTest {
-
- private EnumConverter testConverter = new EnumConverter(RoundingMode.class);
-
- @Test
- public void testConvert() {
- assertEquals(testConverter.convert(RoundingMode.CEILING.toString()), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_LowerCase() {
- assertEquals(testConverter.convert("ceiling"), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_MixedCase() {
- assertEquals(testConverter.convert("CeiLinG"), RoundingMode.CEILING);
- }
-
- @Test
- public void testConvert_OtherValue() {
- assertNull(testConverter.convert("fooBars"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
deleted file mode 100644
index 68c12e1..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/FloatConverterTest.java
+++ /dev/null
@@ -1,178 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the default converter for bytes.
- */
-public class FloatConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.decimal", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(), 1.23456789f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_DecimalNegative() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.decimalNegative", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(), -1.23456789f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Integer() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.integer", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(),100f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex1() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.hex1", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(),255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex2() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.hex2", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(),-255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_Hex3() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.hex3", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().floatValue(),255f, 0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.min", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Float.MIN_VALUE, valueRead.get().floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.max", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Float.MAX_VALUE, valueRead.get().floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_NaNValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.nan", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Float.NaN, valueRead.get().floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_PositiveInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.pi", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Float.POSITIVE_INFINITY, valueRead.get().floatValue(),0.0f);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Float_NegativeInfinityValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Float> valueRead = config.getOptional("tests.converter.float.ni", Float.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Float.NEGATIVE_INFINITY, valueRead.get().floatValue(),0.0f);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
deleted file mode 100644
index f22f531..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/IntegerConverterTest.java
+++ /dev/null
@@ -1,113 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Integers.
- */
-public class IntegerConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.decimal", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.octal", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Integer.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.hex.lowerX", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Integer.decode("0x2F").intValue());
- valueRead = config.getOptional("tests.converter.integer.hex.upperX", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Integer.decode("0X3F").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.foo", Integer.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.min", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Integer.MIN_VALUE, valueRead.get().intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Integer_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Integer> valueRead = config.getOptional("tests.converter.integer.max", Integer.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Integer.MAX_VALUE, valueRead.get().intValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
deleted file mode 100644
index 936aaa4..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LocalDateConverterTest.java
+++ /dev/null
@@ -1,41 +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.converters;
-
-import org.junit.Test;
-
-import java.time.LocalDate;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.notNullValue;
-
-public class LocalDateConverterTest {
- public static final LocalDate REF_LOCAL_DATE = LocalDate.of(2007, 4, 1);
-
- @Test
- public void canConvertStringToLocalDate() throws Exception {
- LocalDateConverter converter = new LocalDateConverter();
-
- LocalDate date = converter.convert(" 2007-04-01\t");
-
- assertThat(date, notNullValue());
- assertThat(date, equalTo(REF_LOCAL_DATE));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
deleted file mode 100644
index c54f784..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/LongConverterTest.java
+++ /dev/null
@@ -1,113 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Longs.
- */
-public class LongConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.decimal", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.octal", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Long.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.hex.lowerX", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Long.decode("0x2F").intValue());
- valueRead = config.getOptional("tests.converter.long.hex.upperX", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Long.decode("0X3F").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.foo", Long.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.min", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Long.MIN_VALUE, valueRead.get().longValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Long_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Long> valueRead = config.getOptional("tests.converter.long.max", Long.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Long.MAX_VALUE, valueRead.get().longValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
deleted file mode 100644
index 64c6033..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/NumberConverterTest.java
+++ /dev/null
@@ -1,104 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Number.
- */
-public class NumberConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Number> valueRead = config.getOptional("tests.converter.bd.decimal", Number.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Long.valueOf(101));
- }
-
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Number> valueRead = config.getOptional("tests.converter.bd.hex.lowerX", Number.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Long.valueOf("47"));
- valueRead = config.getOptional("tests.converter.bd.hex.upperX", Number.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Long.valueOf("63"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Number> valueRead = config.getOptional("tests.converter.bd.foo", Number.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Number> valueRead = config.getOptional("tests.converter.bd.big", Number.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("101666666666666662333337263723628763821638923628193612983618293628763"),
- valueRead.get());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigFloatValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Number> valueRead = config.getOptional("tests.converter.bd.bigFloat", Number.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("1016666666666666623333372637236287638216389293628763.1016666666666666623333372" +
- "63723628763821638923628193612983618293628763"), valueRead.get());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
deleted file mode 100644
index 0db16ab..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ShortConverterTest.java
+++ /dev/null
@@ -1,113 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for Shorts.
- */
-public class ShortConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.decimal", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.octal", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Short.decode("02").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.hex.lowerX", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Short.decode("0x2F").intValue());
- valueRead = config.getOptional("tests.converter.short.hex.upperX", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().intValue(), Short.decode("0X3F").intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.foo", Short.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.min", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Short.MIN_VALUE, valueRead.get().intValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Short_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Short> valueRead = config.getOptional("tests.converter.short.max", Short.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Short.MAX_VALUE, valueRead.get().intValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
deleted file mode 100644
index 8d3f086..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
+++ /dev/null
@@ -1,104 +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.propertysource.BasePropertySource;
-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;
-
-public class BasePropertySourceTest {
-
- @Test
- public void testGetOrdinal() {
-
- PropertySource defaultPropertySource = new BasePropertySource(56) {
-
- @Override
- public String getName() {
- return "testWithDefault";
- }
-
- @Override
- public String get(String key) {
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
- };
-
- Assert.assertEquals(56, 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));
- }
-
- private static class OverriddenOrdinalPropertySource extends BasePropertySource {
-
- private OverriddenOrdinalPropertySource() {
- super(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() {
- super(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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
deleted file mode 100644
index 280351e..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.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.core.propertysource;
-
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for {@link org.apache.tamaya.core.propertysource.EnvironmentPropertySource}.
- */
-public class EnvironmentPropertySourceTest {
-
- private EnvironmentPropertySource envPropertySource = new EnvironmentPropertySource();
-
- @Test
- public void testGetOrdinal() throws Exception {
- assertEquals(EnvironmentPropertySource.DEFAULT_ORDINAL, envPropertySource.getOrdinal());
- }
-
- @Test
- public void testGetName() throws Exception {
- assertEquals("environment-properties", envPropertySource.getName());
- }
-
- @Test
- public void testGet() throws Exception {
- for (Map.Entry<String, String> envEntry : System.getenv().entrySet()) {
- assertEquals(envPropertySource.get(envEntry.getKey()), envEntry.getValue());
- }
- }
-
- @Test
- public void testGetProperties() throws Exception {
- Map<String, String> props = envPropertySource.getProperties();
- assertEquals(System.getenv(), props);
- }
-
- @Test
- public void testIsScannable() throws Exception {
- assertTrue(envPropertySource.isScannable());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
deleted file mode 100644
index d4ef659..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
+++ /dev/null
@@ -1,64 +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.propertysource.SimplePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class PropertiesFilePropertySourceTest {
-
- private SimplePropertySource testfilePropertySource;
- private SimplePropertySource overrideOrdinalPropertySource;
-
-
- @Before
- public void initTest() {
- testfilePropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
- overrideOrdinalPropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
- }
-
-
- @Test
- public void testGetOrdinal() {
- Assert.assertEquals(0, testfilePropertySource.getOrdinal());
- Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL)), overrideOrdinalPropertySource.getOrdinal());
- }
-
-
- @Test
- public void testGet() {
- Assert.assertEquals("val3", testfilePropertySource.get("key3"));
- Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5"));
- Assert.assertNull(testfilePropertySource.get("nonpresentkey"));
- }
-
-
- @Test
- public void testGetProperties() throws Exception {
- Assert.assertEquals(5, testfilePropertySource.getProperties().size());
- Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
- Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
- Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
- Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
- Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
deleted file mode 100644
index 14b136b..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
+++ /dev/null
@@ -1,101 +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.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.Properties;
-
-public class SystemPropertySourceTest {
-
- private SystemPropertySource testPropertySource = new SystemPropertySource();
-
-
- @Test
- public void testGetOrdinal() throws Exception {
-
- // test the default ordinal
- Assert.assertEquals(SystemPropertySource.DEFAULT_ORDINAL, 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();
-
- String property = testPropertySource.get(propertyKeyToCheck);
- Assert.assertTrue("Property '" + propertyKeyToCheck + "' is not present in " + SystemPropertySource.class.getSimpleName(),
- property != null);
- Assert.assertEquals(System.getProperty(propertyKeyToCheck), property);
-
-
- }
-
- @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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
deleted file mode 100644
index 6d16707..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.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.ConfigurationProvider;
-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;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.notNullValue;
-
-public class JavaConfigurationProviderTest {
-
- @Test
- public void testJavaConfigurationProvider() {
-
- Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
-
- assertThat(propertySources, notNullValue());
- assertThat(propertySources, hasSize(1));
-
- PropertySource propertySource = propertySources.iterator().next();
-
- assertThat(propertySource.getProperties().keySet(), hasSize(5));
-
- for (int i = 1; i < 6; i++) {
- String key = "confkey" + i;
- String value = "javaconf-value" + i;
-
- Assert.assertEquals(value, propertySource.get(key));
-
- // check if we had our key in configuration.current
- Assert.assertTrue(ConfigurationProvider.getConfiguration().getProperties().containsKey(key));
- Assert.assertEquals(value, ConfigurationProvider.getConfiguration().getOptional(key).get());
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyDefaultSource.java
deleted file mode 100644
index 0b82260..0000000
--- a/attic/java8/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() {
- super(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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
deleted file mode 100644
index 6faa831..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertyFilter.java
+++ /dev/null
@@ -1,37 +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;
-
-/**
- * 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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
deleted file mode 100644
index 5178674..0000000
--- a/attic/java8/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() {
- super(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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
deleted file mode 100644
index acd7ca3..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
+++ /dev/null
@@ -1,41 +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.ConfigurationProvider;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import javax.annotation.Priority;
-
-/**
- * Simple PropertyFilter that filters exact one value, registered using ServiceLoader.
- */
-@Priority(200)
-public class TestRemovingPropertyFilter 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: " + ConfigurationProvider.getConfiguration().getOptional("name").orElse("NoName found!");
- }
- return valueToBeFiltered;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/javaconfiguration.properties b/attic/java8/core/src/test/resources/META-INF/javaconfiguration.properties
deleted file mode 100644
index b461414..0000000
--- a/attic/java8/core/src/test/resources/META-INF/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/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
deleted file mode 100644
index 62b9bd5..0000000
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
+++ /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 of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityImpl1
-org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityImpl2
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
deleted file mode 100644
index b144790..0000000
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
+++ /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 of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl1
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl2
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
deleted file mode 100644
index d039696..0000000
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ /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.CTestConverter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
deleted file mode 100644
index 44a8c98..0000000
--- a/attic/java8/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.TestRemovingPropertyFilter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 72dd3c3..0000000
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /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 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
-org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index afc8910..0000000
--- a/attic/java8/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/ccc0842b/attic/java8/core/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/arquillian.xml b/attic/java8/core/src/test/resources/arquillian.xml
deleted file mode 100644
index 1eeb58b..0000000
--- a/attic/java8/core/src/test/resources/arquillian.xml
+++ /dev/null
@@ -1,30 +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 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.
--->
-<arquillian xmlns="http://jboss.org/schema/arquillian"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
- <container qualifier="daemon" default="true">
- <configuration>
- <property name="host">localhost</property>
- <property name="port">12346</property>
- <property name="serverJarFile">target/arquillian-daemon-main.jar</property>
- </configuration>
- </container>
-</arquillian>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/javaconfiguration.properties b/attic/java8/core/src/test/resources/javaconfiguration.properties
deleted file mode 100644
index 33beabb..0000000
--- a/attic/java8/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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/overrideOrdinal.properties
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/overrideOrdinal.properties b/attic/java8/core/src/test/resources/overrideOrdinal.properties
deleted file mode 100644
index 96935a8..0000000
--- a/attic/java8/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/ccc0842b/attic/java8/core/src/test/resources/testfile.properties
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/testfile.properties b/attic/java8/core/src/test/resources/testfile.properties
deleted file mode 100644
index abd7ee8..0000000
--- a/attic/java8/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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/resources/x34.properties
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/x34.properties b/attic/java8/core/src/test/resources/x34.properties
deleted file mode 100644
index f2c4a0a..0000000
--- a/attic/java8/core/src/test/resources/x34.properties
+++ /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 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.
-
-x34=x34
-x34.a.b.c=C
[6/6] incubator-tamaya git commit: Removed the attic
Posted by pl...@apache.org.
Removed the attic
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ccc0842b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ccc0842b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ccc0842b
Branch: refs/heads/master
Commit: ccc0842b77b0745e3413a224b14ae5be8e6e5aae
Parents: 359d3e4
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Thu Sep 15 19:29:10 2016 +0200
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Thu Sep 15 19:29:10 2016 +0200
----------------------------------------------------------------------
attic/java8/api/pom.xml | 43 --
.../java/org/apache/tamaya/ConfigException.java | 46 ---
.../java/org/apache/tamaya/ConfigOperator.java | 38 --
.../java/org/apache/tamaya/ConfigQuery.java | 38 --
.../java/org/apache/tamaya/Configuration.java | 232 -----------
.../apache/tamaya/ConfigurationProvider.java | 87 -----
.../java/org/apache/tamaya/TypeLiteral.java | 202 ----------
.../apache/tamaya/spi/ConfigurationContext.java | 152 --------
.../tamaya/spi/ConfigurationContextBuilder.java | 193 ---------
.../tamaya/spi/ConfigurationProviderSpi.java | 77 ----
.../apache/tamaya/spi/PropertyConverter.java | 49 ---
.../org/apache/tamaya/spi/PropertyFilter.java | 49 ---
.../org/apache/tamaya/spi/PropertySource.java | 153 --------
.../tamaya/spi/PropertySourceProvider.java | 43 --
.../spi/PropertyValueCombinationPolicy.java | 61 ---
.../org/apache/tamaya/spi/ServiceContext.java | 66 ----
.../tamaya/spi/ServiceContextManager.java | 115 ------
.../org/apache/tamaya/ConfigExceptionTest.java | 47 ---
.../tamaya/ConfigurationProviderTest.java | 63 ---
.../org/apache/tamaya/ConfigurationTest.java | 75 ----
.../org/apache/tamaya/TestConfiguration.java | 80 ----
.../tamaya/TestConfigurationProvider.java | 47 ---
.../java/org/apache/tamaya/TypeLiteralTest.java | 61 ---
.../tamaya/spi/ServiceContextManagerTest.java | 131 -------
.../apache/tamaya/spi/ServiceContextTest.java | 91 -----
.../apache/tamaya/spi/TestServiceContext.java | 83 ----
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 -
.../org.apache.tamaya.spi.ServiceContext | 19 -
.../test/resources/ServiceContextWithOrdinal | 25 --
attic/java8/core/pom.xml | 87 -----
.../core/internal/DefaultConfiguration.java | 235 -----------
.../internal/DefaultConfigurationContext.java | 239 ------------
.../DefaultConfigurationContextBuilder.java | 145 -------
.../internal/DefaultConfigurationProvider.java | 62 ---
.../core/internal/DefaultServiceContext.java | 148 -------
.../core/internal/PropertyConverterManager.java | 390 -------------------
.../converters/BigDecimalConverter.java | 60 ---
.../converters/BigIntegerConverter.java | 92 -----
.../internal/converters/BooleanConverter.java | 65 ----
.../core/internal/converters/ByteConverter.java | 60 ---
.../core/internal/converters/CharConverter.java | 66 ----
.../internal/converters/ClassConverter.java | 58 ---
.../internal/converters/CurrencyConverter.java | 87 -----
.../internal/converters/DoubleConverter.java | 70 ----
.../core/internal/converters/EnumConverter.java | 67 ----
.../internal/converters/FloatConverter.java | 78 ----
.../internal/converters/IntegerConverter.java | 70 ----
.../internal/converters/LocalDateConverter.java | 36 --
.../converters/LocalDateTimeConverter.java | 36 --
.../internal/converters/LocalTimeConverter.java | 42 --
.../core/internal/converters/LongConverter.java | 68 ----
.../internal/converters/NumberConverter.java | 72 ----
.../internal/converters/ShortConverter.java | 70 ----
.../core/internal/converters/URIConverter.java | 45 ---
.../core/internal/converters/URLConverter.java | 45 ---
.../internal/converters/ZoneIdConverter.java | 47 ---
.../core/propertysource/BasePropertySource.java | 55 ---
.../EnvironmentPropertySource.java | 54 ---
.../propertysource/SimplePropertySource.java | 118 ------
.../propertysource/SystemPropertySource.java | 87 -----
.../provider/JavaConfigurationProvider.java | 58 ---
...pache.tamaya.spi.ConfigurationContextBuilder | 19 -
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 -
.../org.apache.tamaya.spi.PropertyConverter | 37 --
.../org.apache.tamaya.spi.PropertySource | 20 -
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
.../org.apache.tamaya.spi.ServiceContext | 19 -
.../apache/tamaya/core/ConfigurationTest.java | 58 ---
.../org/apache/tamaya/core/NotMockedAnswer.java | 55 ---
.../java/org/apache/tamaya/core/internal/A.java | 29 --
.../java/org/apache/tamaya/core/internal/B.java | 29 --
.../java/org/apache/tamaya/core/internal/C.java | 56 ---
.../tamaya/core/internal/CTestConverter.java | 31 --
.../core/internal/DefaultConfigurationTest.java | 204 ----------
.../internal/DefaultServiceContextTest.java | 128 ------
.../internal/PropertyConverterManagerTest.java | 162 --------
.../converters/BigDecimalConverterTest.java | 104 -----
.../converters/BooleanConverterTest.java | 131 -------
.../internal/converters/ByteConverterTest.java | 113 ------
.../internal/converters/CharConverterTest.java | 90 -----
.../ConverterTestsPropertySource.java | 252 ------------
.../converters/CurrencyConverterTest.java | 155 --------
.../converters/DoubleConverterTest.java | 176 ---------
.../internal/converters/EnumConverterTest.java | 53 ---
.../internal/converters/FloatConverterTest.java | 178 ---------
.../converters/IntegerConverterTest.java | 113 ------
.../converters/LocalDateConverterTest.java | 41 --
.../internal/converters/LongConverterTest.java | 113 ------
.../converters/NumberConverterTest.java | 104 -----
.../internal/converters/ShortConverterTest.java | 113 ------
.../propertysource/BasePropertySourceTest.java | 104 -----
.../EnvironmentPropertySourceTest.java | 62 ---
.../PropertiesFilePropertySourceTest.java | 64 ---
.../SystemPropertySourceTest.java | 101 -----
.../provider/JavaConfigurationProviderTest.java | 60 ---
.../testdata/TestPropertyDefaultSource.java | 51 ---
.../core/testdata/TestPropertyFilter.java | 37 --
.../testdata/TestPropertySourceProvider.java | 73 ----
.../testdata/TestRemovingPropertyFilter.java | 41 --
.../META-INF/javaconfiguration.properties | 22 --
...tServiceContextTest$InvalidPriorityInterface | 19 -
...efaultServiceContextTest$MultiImplsInterface | 20 -
.../org.apache.tamaya.spi.PropertyConverter | 19 -
.../org.apache.tamaya.spi.PropertyFilter | 20 -
.../org.apache.tamaya.spi.PropertySource | 22 --
...org.apache.tamaya.spi.PropertySourceProvider | 20 -
.../core/src/test/resources/arquillian.xml | 30 --
.../test/resources/javaconfiguration.properties | 22 --
.../test/resources/overrideOrdinal.properties | 25 --
.../core/src/test/resources/testfile.properties | 22 --
.../core/src/test/resources/x34.properties | 19 -
attic/pom.xml | 109 ------
112 files changed, 8880 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/pom.xml
----------------------------------------------------------------------
diff --git a/attic/java8/api/pom.xml b/attic/java8/api/pom.xml
deleted file mode 100644
index 0d4e8a5..0000000
--- a/attic/java8/api/pom.xml
+++ /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 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</groupId>
- <artifactId>tamaya-java8</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tamaya-api</artifactId>
- <name>Apache Tamaya Java 8 API</name>
- <description>
- The API defines a complete SE based API for reading of configuration data.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
deleted file mode 100644
index e3b6fb8..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
+++ /dev/null
@@ -1,46 +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;
-
-/**
- * Exception class (runtime exception) for configuration issues.
- */
-public class ConfigException extends RuntimeException {
-
- private static final long serialVersionUID = -5886094818057522680L;
-
- /**
- * Creates a new configuration exception.
- *
- * @param message the exception message, not null.
- */
- public ConfigException(String message) {
- super(message);
- }
-
- /**
- * Creates a new configuration exception.
- *
- * @param message the exception message, not null.
- * @param t the throwable.
- */
- public ConfigException(String message, Throwable t) {
- super(message, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java
deleted file mode 100644
index 35c583c..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.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;
-
-/**
- * Models a function that maps a given {@link Configuration} to another {@link Configuration}. This can be used
- * to modell additional functionality and applying it to a given {@link Configuration} instance by calling
- * the {@link Configuration#with(ConfigOperator)} method.
- */
-@FunctionalInterface
-public interface ConfigOperator {
-
- /**
- * Creates a new {@link Configuration} based on the given Configuration. Operators basically acts similar to
- * decorators, whereas operated instances may have non compatible behaviour, e.g. by applying security constraints
- * or view restrictions.
- *
- * @param config the input configuration, not null.
- * @return the operated configuration, never null.
- */
- Configuration operate(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java
deleted file mode 100644
index 6151d03..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.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;
-
-/**
- * Models a function that maps a given {@link org.apache.tamaya.Configuration} to something else. This can be used
- * to model additional functionality and applying it to a given {@link org.apache.tamaya.Configuration} instance by
- * calling the {@link org.apache.tamaya.Configuration#query(org.apache.tamaya.ConfigQuery)} method.
- * @param <T> the result type of the query.
- */
-@FunctionalInterface
-public interface ConfigQuery<T> {
-
- /**
- * Creates a result based on the given Configuration. Queries basically acts similar to
- * operators, whereas they returns any kind of result.
- *
- * @param config the input configuration, not null.
- * @return the query result.
- */
- T query(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java b/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
deleted file mode 100644
index 583a1bf..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
+++ /dev/null
@@ -1,232 +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;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.OptionalDouble;
-import java.util.OptionalInt;
-import java.util.OptionalLong;
-
-
-/**
- * A configuration models a aggregated set current properties, identified by a unique key, but adds higher level access functions to
- * a {@link org.apache.tamaya.spi.PropertySource}. Hereby in most cases a configuration is a wrapper around a composite
- * {@link org.apache.tamaya.spi.PropertySource} instance, which may combine multiple child config in well defined tree like structure,
- * where nodes define logically the rules current priority, filtering, combination and overriding.
- * <br/>
- * <h3>Implementation Requirements</h3>
- * Implementations current this interface must be
- * <ul>
- * <li>Thread safe.
- * <li>Immutable
- * </ul>
- * It is not recommended that implementations also are serializable, since the any configuration can be <i>freezed</i>
- * by reading out its complete configuration map into a serializable and remotable structure. This helps significantly
- * simplifying the development current this interface, e.g. for being backed up by systems and stores that are not part current
- * this library at all.
- */
-public interface Configuration {
-
- /**
- * Access a property.
- *
- * @param key the property's key, not null.
- * @return the property's value or {@code null}.
- */
- default String get(String key) {
- return getProperties().get(key);
- }
-
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @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 target type.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- default <T> T get(String key, Class<T> type) {
- return get(key, TypeLiteral.of(type));
- }
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @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 target type.
- * @return the property value, or null, if the underlying value is null as well.
- * @throws ConfigException if the value could not be converted to the required target type by any of the
- * registered converters.
- */
- <T> T get(String key, TypeLiteral<T> type);
-
- /**
- * Access a property.
- *
- * @param key the property's key, not null.
- * @return the property's keys.
- */
- default Optional<String> getOptional(String key) {
- return Optional.ofNullable(get(key));
- }
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @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 target type.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- default <T> Optional<T> getOptional(String key, Class<T> type) {
- return Optional.ofNullable(get(key, type));
- }
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @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 target type.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- default <T> Optional<T> getOptional(String key, TypeLiteral<T> type) {
- return Optional.ofNullable(get(key, type));
- }
-
- /**
- * Access all current known Configuration properties as a full {@code Map<String,String>}.
- * Be aware that entries from non scannable parts of the registered {@link org.apache.tamaya.spi.PropertySource}
- * instances may not be contained in the result, but nevertheless be accessible calling one of the
- * {@code get(...)} methods.
- *
- * @return the current properties. These may not include all properties from non-scannable
- * {@link org.apache.tamaya.spi.PropertySource}s.
- */
- @SuppressWarnings("JavaDoc")
- Map<String, String> getProperties();
-
-
- /**
- * Get the property keys as {@link Boolean}.
- *
- * @param key the property's absolute, or relative path, e.g. {@code
- * a/b/c/d.myProperty}.
- * @return the property's keys.
- * @throws ConfigException if the configured value could not be converted to the target type.
- * @since Java8
- */
- default Optional<Boolean> getBoolean(String key) {
- return getOptional(key, Boolean.class);
- }
-
- /**
- * Get the property keys as {@link Integer}.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @return the property's keys.
- * @throws ConfigException if the configured value could not be converted to the target type.
- * @since Java8
- */
- default OptionalInt getInteger(String key) {
- Optional<Integer> val = getOptional(key, Integer.class);
-
- if (val.isPresent()) {
- return OptionalInt.of(val.get());
- }
- return OptionalInt.empty();
- }
-
- /**
- * Get the property keys as {@link Long}.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @return the property's keys.
- * @throws ConfigException if the configured value could not be converted to the target type.
- * @since Java8
- */
- default OptionalLong getLong(String key) {
- Optional<Long> val = getOptional(key, Long.class);
- if (val.isPresent()) {
- return OptionalLong.of(val.get());
- }
- return OptionalLong.empty();
- }
-
- /**
- * Get the property keys as {@link Double}.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @return the property's keys.
- * @throws ConfigException if the configured value could not be converted to the target type.
- * @since Java8
- */
- default OptionalDouble getDouble(String key) {
-
- Optional<Double> val = getOptional(key, Double.class);
- if (val.isPresent()) {
- return OptionalDouble.of(val.get());
- }
- return OptionalDouble.empty();
- }
-
- /**
- * Extension point for adjusting configuration.
- *
- * @param operator A configuration operator, e.g. a filter, or an adjuster
- * combining configurations.
- * @return the new adjusted configuration, never {@code null}.
- */
- default Configuration with(ConfigOperator operator) {
- return operator.operate(this);
- }
-
- /**
- * Query a configuration.
- *
- * @param query the query, never {@code null}.
- * @param <T> the target query result type.
- * @return the result
- */
- default <T> T query(ConfigQuery<T> query) {
- return query.query(this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
deleted file mode 100644
index 03bd262..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ /dev/null
@@ -1,87 +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;
-
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import java.util.Objects;
-
-/**
- * Static access to the {@link org.apache.tamaya.Configuration} for the very application.
- */
-public final class ConfigurationProvider {
-
- private static final ConfigurationProviderSpi PROVIDER_SPI = Objects.requireNonNull(ServiceContextManager.getServiceContext()
- .getService(ConfigurationProviderSpi.class));
-
- private ConfigurationProvider() {
- // just to prevent initialisation
- }
-
- /**
- * Access the current configuration.
- *
- * @return the corresponding Configuration instance, never null.
- */
- public static Configuration getConfiguration() {
- return PROVIDER_SPI.getConfiguration();
- }
-
- /**
- * Get access to the current ConfigurationContext.
- *
- * @return the current ConfigurationContext, never null.
- */
- public static ConfigurationContext getConfigurationContext() {
- return PROVIDER_SPI.getConfigurationContext();
- }
-
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and should be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing
- * listeners can do whatever is appropriate to react to any given configuration changes.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only and does not support
- * applying a new ConfigurationContext.
- */
- public static void setConfigurationContext(ConfigurationContext context) {
- PROVIDER_SPI.setConfigurationContext(context);
- }
-
- /**
- * Create a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance. This method creates
- * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}.
- * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the
- * current configuration context.
- *
- * @return a new, empty {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- * @see org.apache.tamaya.spi.ConfigurationContext
- */
- public static ConfigurationContextBuilder getConfigurationContextBuilder() {
- return PROVIDER_SPI.getConfigurationContextBuilder();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
deleted file mode 100644
index 5aa4f4c..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
+++ /dev/null
@@ -1,202 +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;
-
-import java.io.Serializable;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-
-/**
- * <p>Class for instantiation of objects that represent parameterized types
- * with current parameters.</p>
- * <p>
- * <p>An object that represents a parameterized type may be obtained by
- * subclassing <tt>TypeLiteral</tt>.</p>
- * <p>
- * <pre>
- * TypeLiteral<List<Integer>> stringListType = new TypeLiteral<List<Integer>>() {};
- * </pre>
- *
- * @param <T> the type, including all type parameters
- */
-public class TypeLiteral<T> implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
- /** The current defined type. */
- private Type definedType;
-
- /**
- * Constructor.
- * @param definedType the defined type.
- */
- protected TypeLiteral(Type definedType) {
- this.definedType = definedType;
- }
-
- /**
- * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
- */
- protected TypeLiteral() {
- this.definedType = getDefinedType(this.getClass());
- }
-
- /**
- * Creates a new TypeLiteral based on a given type.
- *
- * @param type the type , not null.
- * @param <R> the literal generic type.
- * @return the corresponding TypeLiteral, never null.
- */
- public static <R> TypeLiteral<R> of(Type type) {
- return new TypeLiteral<>(type);
- }
-
- /**
- * Checks the current implemented generic interfaces and evaluates the given single type parameter.
- *
- * @param clazz the class to check, not null.
- * @param interfaceType the interface type to be checked, not null.
- * @return the generic type parameter, or null, if it cannot be evaluated.
- */
- public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
- for (Type type : clazz.getGenericInterfaces()) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- if(parameterizedType.getRawType().equals(interfaceType)){
- return parameterizedType.getActualTypeArguments();
- }
- }
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- /**
- * Method that checks the class's type for a generic interface implementation type.
- *
- * @param type the type, not null.
- * @return the generic type parameter of the given single type generic interfaceType, or null.
- */
- public static Type[] getTypeParameters(Type type) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- return parameterizedType.getActualTypeArguments();
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- public final Type getType() {
- return definedType;
- }
-
- /**
- * Returns basic raw Java type.
- *
- * @return the actual type represented by this object
- */
- public final Class<T> getRawType() {
- Class<T> rawType = null;
-
- if (this.definedType instanceof Class) {
- rawType = (Class<T>) this.definedType;
- } else if (this.definedType instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) this.definedType;
- rawType = (Class<T>) pt.getRawType();
-
- } else if (this.definedType instanceof GenericArrayType) {
- rawType = (Class<T>) Object[].class;
- } else {
- throw new RuntimeException("Illegal type for the Type Literal Class");
- }
-
- return rawType;
- }
-
-
- protected Type getDefinedType(Class<?> clazz) {
- Type type = null;
-
- if (clazz == null) {
- throw new RuntimeException("Class parameter clazz can not be null");
- }
-
- Type superClazz = clazz.getGenericSuperclass();
-
- if (superClazz.equals(Object.class)) {
- throw new RuntimeException("Super class must be parametrized type");
- } else if (superClazz instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) superClazz;
- Type[] actualArgs = pt.getActualTypeArguments();
-
- if (actualArgs.length == 1) {
- type = actualArgs[0];
-
- } else {
- throw new RuntimeException("More than one parametric type");
- }
-
- } else {
- type = getDefinedType((Class<?>) superClazz);
- }
-
- return type;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TypeLiteral other = (TypeLiteral) obj;
- if (definedType == null) {
- if (other.definedType != null) {
- return false;
- }
- } else if (!definedType.equals(other.definedType)) {
- return false;
- }
- return true;
- }
-
-
- @Override
- public String toString() {
- return "TypeLiteral{" +
- "type=" + definedType +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
deleted file mode 100644
index 24efdeb..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ /dev/null
@@ -1,152 +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.spi;
-
-import org.apache.tamaya.TypeLiteral;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-/**
- * Central SPI for programmatically dealing with the setup of the configuration system.
- * This includes adding and enlisting {@link org.apache.tamaya.spi.PropertySource}s,
- * managing {@link PropertyConverter}s, ConfigFilters, etc.
- */
-public interface ConfigurationContext {
-
- /**
- * This method returns the current list of registered PropertySources ordered via their ordinal.
- * PropertySources with a lower ordinal come last. The PropertySource with the
- * highest ordinal comes first.
- * If two PropertySources have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart, hereby names before are added last.
- * PropertySources are loaded when this method is called the first time, which basically is
- * when the first time configuration is accessed.
- *
- * @return a sorted list of registered PropertySources. The returned list need not be modifiable
- */
- List<PropertySource> getPropertySources();
-
- /**
- * This method returns a subset ot the currently registered PropertySources.
- *
- * @param selector the selector query, not null.
- * @return a collectino of selected PropertySources.
- */
- default Collection<PropertySource> getPropertySources(Predicate<PropertySource> selector){
- return getPropertySources().stream().filter(selector).collect(Collectors.toList());
- }
-
- /**
- * <p>
- * This method returns the Map of registered PropertyConverters
- * per type.
- * The List for each type is ordered via their {@link javax.annotation.Priority} and
- * class name.
- * </p>
- * <p>
- * A simplified scenario could be like:
- * <pre>
- * {
- * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- * </p>
- *
- * @return map with sorted list of registered PropertySources per type.
- */
- Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters();
-
- /**
- * <p>
- * This method returns the registered PropertyConverters for a given type.
- * The List for each type is ordered via their {@link javax.annotation.Priority}.
- * </p>
- * <p>
- * <p>
- * PropertyConverters with a higher Priority come first. The PropertyConverter with the
- * lowest Priority comes last.
- * If two PropertyConverter have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart.
- * </p>
- * <p>
- * <p>
- * Additionally if a PropertyProvider is accessed, which is not registered the implementation
- * should try to figure out, if there could be a default implementation as follows:
- * <ol>
- * <le>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
- * instanceOf(String), fomr(String)}</le>
- * <le>Look for a matching constructor: {@code T(String)}.</le>
- * </ol>
- * If a correspoding factory method or constructor could be found, a corresponding
- * PropertyConverter should be created and registered automatically for the given
- * type.
- * </p>
- * <p>
- * <p>
- * The scenario could be like:
- * <pre>
- * {
- * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- * </p>
- * <p>
- * <p>
- * The converters returned for a type should be used as a chain, whereas the result of the
- * first converter that is able to convert the configured value, is taken as the chain's result.
- * No more converters are called after a converter has successfully converted the input into
- * the required target type.
- * </p>
- *
- * @return a sorted list of registered PropertySources per type.
- */
- <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type);
-
- /**
- * Access the current PropertyFilter instances.
- *
- * @return the list of registered PropertyFilters, never null.
- */
- List<PropertyFilter> getPropertyFilters();
-
- /**
- * Access the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- * @return the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, never null.
- */
- PropertyValueCombinationPolicy getPropertyValueCombinationPolicy();
-
- /**
- * Creates a new updates instance for changing the current ConfigurationContext.
- * @throws java.lang.UnsupportedOperationException if this ConfigurationContext is not updateable.
- * @return a new ConfigurationContextUpdates instance.
- */
- ConfigurationContextBuilder toBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
deleted file mode 100644
index e070450..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ /dev/null
@@ -1,193 +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.spi;
-
-import org.apache.tamaya.TypeLiteral;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.function.Predicate;
-
-/**
- * A builder for creating new or adapting instances of {@link org.apache.tamaya.spi.ConfigurationContext}.
- * Builders can be obtained in exactly two ways:
- * <ol>
- * <li>By accessing a preinitialized builder from an existing {@link org.apache.tamaya.spi.ConfigurationContext},
- * by calling {@link ConfigurationContext#toBuilder()}.</li>
- * <li>By accessing an empty builder instance from
- * {@link org.apache.tamaya.ConfigurationProvider#getConfigurationContextBuilder()}.</li>
- * </ol>
- * After all changes are applied to a builder a new {@link org.apache.tamaya.spi.ConfigurationContext} instance can
- * be created and can be applied by calling
- * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(ConfigurationContext)}. Since this method can
- * throw an UnsupportedOperationException, you should check before if changing the current ConfigurationContext
- * programmatically is supported by calling
- * {@link org.apache.tamaya.ConfigurationProvider#isConfigurationContextSettable()}.
- */
-public interface ConfigurationContextBuilder {
-
- /**
- * Init this builder instance with the given {@link org.apache.tamaya.spi.ConfigurationContext} instance. This
- * method will replace any existing data in the current builder with the data contained in the given
- * {@link org.apache.tamaya.spi.ConfigurationContext}.
- *
- * @param context the {@link org.apache.tamaya.spi.ConfigurationContext} instance to be used, not null.
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setContext(ConfigurationContext context);
-
- /**
- * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- default ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd) {
- return addPropertySources(Arrays.asList(propertySourcesToAdd));
- }
-
-
- /**
- * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd);
-
- /**
- * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- default ConfigurationContextBuilder removePropertySources(String... propertySourcesNames) {
- return removePropertySources(Arrays.asList(propertySourcesNames));
- }
-
- /**
- * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesNames);
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- default ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters) {
- return addPropertyFilters(Arrays.asList(filters));
- }
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- default ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
- return removePropertyFilters(Arrays.asList(filters));
- }
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param selector the selector query, not null.
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(Predicate<PropertyFilter> selector);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * Remove the property sources selected by the given selector predicate.
- *
- * @param selector the selector query, not null.
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(Predicate<PropertySource> selector);
-
- /**
- * This method can be used for programmatically adding {@link PropertyConverter}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param typeToConvert the type which the converter is for
- * @param propertyConverter the PropertyConverters to add for this type
- * @return this builder, for chaining, never null.
- */
- <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert,
- PropertyConverter<T> propertyConverter);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- PropertyConverter<?>... converters);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- Collection<PropertyConverter<?>> converters);
-
- /**
- * Sets the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- *
- * @param policy the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, not null
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy);
-
- /**
- * Builds a {@link org.apache.tamaya.spi.ConfigurationContext} based on the data set.
- */
- ConfigurationContext build();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
deleted file mode 100644
index b2cc381..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
+++ /dev/null
@@ -1,77 +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.spi;
-
-import org.apache.tamaya.Configuration;
-
-/**
- * SPI that must be implemented to provide the component that manages all {@link org.apache.tamaya.Configuration}
- * instances in a system. In SE this may be a true singleton containing exact one {@link org.apache.tamaya.Configuration}
- * instance, whereas in Java EE and other more complex environments instances may be returned depending the current
- * runtime context.
- */
-public interface ConfigurationProviderSpi {
-
- /**
- * Access the current {@link org.apache.tamaya.Configuration}.
- *
- * @return the current {@link org.apache.tamaya.Configuration} instance, never null.
- */
- Configuration getConfiguration();
-
- /**
- * Get access to the current {@link org.apache.tamaya.spi.ConfigurationContext}.
- *
- * @return the current {@link org.apache.tamaya.spi.ConfigurationContext}, never null.
- */
- ConfigurationContext getConfigurationContext();
-
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and must be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update event for the current {@link org.apache.tamaya.spi.ConfigurationContext} or
- * {@link org.apache.tamaya.Configuration}.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
- */
- default void setConfigurationContext(ConfigurationContext context){
- throw new UnsupportedOperationException("By default a ConfigurationContext cannot not be switched later.");
- }
-
- /**
- * Method that allows to determine if a new {@link org.apache.tamaya.spi.ConfigurationContext} can be applied
- * programmatically.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- * @return true, if {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} is supported
- * by the current implementation.
- */
- default boolean isConfigurationContextSettable(){
- return false;
- }
-
- /**
- * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
- *
- * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- */
- ConfigurationContextBuilder getConfigurationContextBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
deleted file mode 100644
index b69953e..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
+++ /dev/null
@@ -1,49 +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.spi;
-
-
-/**
- * Interface for an property that converts a configured String into something else.
- * This is used for implementing type conversion from a property (String) to a certain target
- * type. Hereby the target type can be multivalued (eg collections) or complex if needed.
- * @param <T> the result/target type of the converter.
- */
-public interface PropertyConverter<T> {
-
- /**
- * Convert the given configuration keys from it's String representation into the required target type.
- * <b>IMPORTANT NOTE: </b> Multiple instances of this type are ordered in a chain of converters that
- * try to parse/convert a configured value. The first non-null result returned by a converter is
- * used as the final result of the conversion. As a consequence implementations of this class must
- * only return non-null values that are the result of a successful conversion of an entry.
- *
- * @param value the configuration value, not null.
- * @return the converted value, or {@code null} if the value could not be converted. Returning a non-null
- * value will stop the conversion process and return the value as result (converted value).
- */
- T convert(String value);
-
- //X TODO probably add some diagnostic info which explains what kind of
- //X format(s) is supported.
- //X This could be useful if e.g. no converter in the chain felt responsible
- //X because a wrongly formatted configuration string had been used.
- //X This could probably also be handled via an additional Annotation on the converter.
- //X Collection<String> getSupportedFormats();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
deleted file mode 100644
index 1fd8c36..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
+++ /dev/null
@@ -1,49 +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.spi;
-
-
-/**
- * <p>Interface for filtering the current map of properties during the evaluation of the chain of PropertySources.
- * Filters can be registered using the {@link org.apache.tamaya.spi.ServiceContext}. The ordinal
- * hereby is defined by the corresponding {@code @Priority} annotation.</p>
- * <p>Filters </p>
- */
-public interface PropertyFilter {
-
- /**
- * <p>Maps the current {@code valueToBeFiltered} value to a new value. The resulting value will be used as the result
- * passed to the user.</p>
- * <p>If a filter is currently not available, it should just pass the input map to the method's
- * output.</p>
- * <p>Returning {@code null} will remove the entry and Optional.empty() will be returned to the user.</p>
- * <h3>Implementation specification</h3>
- * Implementations of this class must be
- * <ul>
- * <li>reentrant</li>
- * <li>thread-safe</li>
- * </ul>
- *
- * @param key the key accessed, not null.
- * @param valueToBeFiltered the value to be filtered, not null.
- * @return the filtered value, or {@code null} if the value should be removed alltogether.
- */
- String filterProperty(String key, String valueToBeFiltered);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
deleted file mode 100644
index b4303a0..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
+++ /dev/null
@@ -1,153 +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.spi;
-
-
-import java.util.Map;
-import java.util.Objects;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * This interface models a provider that serves configuration properties. The contained
- * properties may be read fromMap single or several sources (composite).<br/>
- * PropertySources are the building blocks of the final configuration.
- * <p/>
- * <h3>Implementation Requirements</h3>
- * <p></p>Implementations current this interface must be
- * <ul>
- * <li>Thread safe.</li>
- * </ul>
- * </p>
- * <p>
- * <p>A PropertySourceProvider will get picked up via the
- * {@link java.util.ServiceLoader} mechanism and can be registered via
- * META-INF/services/org.apache.tamaya.spi.PropertySource
- * </p>
- * <p>
- * If you like to register multiple PropertySources at the same time
- * you can use the {@link org.apache.tamaya.spi.PropertySourceProvider}
- * interface.
- * </p>
- */
-public interface PropertySource {
-
- /**
- * property name to override default tamaya ordinals
- */
- static final String TAMAYA_ORDINAL = "tamaya.ordinal";
-
-
- /**
- * Lookup order:
- * TODO rethink whole default PropertySources and ordering:
- * TODO introduce default values or constants for ordinals
- * <ol>
- * <li>System properties (ordinal 400)</li>
- * <li>Environment properties (ordinal 300)</li>
- * <li>JNDI values (ordinal 200)</li>
- * <li>Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)</li>
- * </ol>
- * <p/>
- * <p><b>Important Hints for custom implementations</b>:</p>
- * <p>
- * If a custom implementation should be invoked <b>before</b> the default implementations, use a value > 400
- * </p>
- * <p>
- * If a custom implementation should be invoked <b>after</b> the default implementations, use a value < 100
- * </p>
- * <p/>
- * <p>Reordering of the default order of the config-sources:</p>
- * <p>Example: If the properties file/s should be used <b>before</b> the other implementations,
- * you have to configure an ordinal > 400. That means, you have to add e.g. deltaspike_ordinal=401 to
- * /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent
- * config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.</p>
- *
- * @return the 'importance' aka ordinal of the configured values. The higher, the more important.
- */
- default int getOrdinal(){
- String configuredOrdinal = get(TAMAYA_ORDINAL);
- if(configuredOrdinal!=null){
- try{
- return Integer.parseInt(configuredOrdinal);
- } catch(Exception e){
- Logger.getLogger(getClass().getName()).log(Level.WARNING, e,
- () -> "Configured Ordinal is not an int number: " + configuredOrdinal);
- }
- }
- return getDefaultOrdinal();
- }
-
- /**
- * Returns the default ordinal used, when no ordinal is set, or the ordinal was not parseable to an int value.
- * @return the default ordinal used, by default 0.
- */
- default int getDefaultOrdinal(){
- return 0;
- }
-
- /**
- * Get the name of the property source. The name should be unique for the type of source, whereas multiple instances
- * of the same type (and thus name) may exist in a system. Give a {@link ConfigurationContext}
- * the name of a PropertySource is unique.
- *
- * @return the property source's name, never null.
- */
- String getName();
-
- /**
- * Access a property.
- * <p>
- * //X TODO discuss if the key can be null
- *
- * @param key the property's key, not null.
- * @return the value assigned to the property or {@code null}. An empty String will kind of 'erase' previous values.
- */
- default String get(String key){
- Objects.requireNonNull(key, "key must not be null");
- return getProperties().get(key);
- }
-
- /**
- * Access the current properties as Map. The resulting Map may not return all items accessible, e.g.
- * when the underlying storage does not support iteration of its entries.
- *
- * @return the a corresponding map, never null.
- * //X TODO or should we just do getPropertyKeys()? Think about security (key) vs easier merging (full map)?
- */
- Map<String, String> getProperties();
-
- /**
- * Determines if this config source could be scanned for its list of properties.
- * <p>
- * <p>
- * PropertySources which are not scannable might not be able to find all the
- * configured values to provide via {@link #getProperties()}. This can e.g. happen
- * if the underlying storage doesn't support listing.
- * </p>
- *
- * @return {@code true} if this PropertySource could be scanned for its list of properties,
- * {@code false} if it should not be scanned.
- */
- default boolean isScannable() {
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
deleted file mode 100644
index 81ddcdd..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.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.spi;
-
-import java.util.Collection;
-
-/**
- * <p>Implement this interfaces to provide a PropertySource provider which
- * is able to register multiple PropertySources. This is e.g. needed if
- * there are multiple property files of a given config file name.</p>
- * <p>
- * <p>If a PropertySource like JNDI only exists once, then there is no need
- * to implement it via the PropertySourceProvider but should directly
- * expose a {@link PropertySource}.</p>
- * <p>
- * <p>A PropertySourceProvider will get picked up via the
- * {@link java.util.ServiceLoader} mechanism and must get registered via
- * META-INF/services/org.apache.tamaya.spi.PropertySourceProvider</p>
- */
-public interface PropertySourceProvider {
-
- /**
- * @return For each e.g. property file, we return a single PropertySource
- * or an empty list if no PropertySource exists.
- */
- Collection<PropertySource> getPropertySources();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
deleted file mode 100644
index 3c5fb42..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
+++ /dev/null
@@ -1,61 +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.spi;
-
-import java.util.Optional;
-
-/**
- * Policy that determines how the final value of a configuration entry is evaluated. An instances of this
- * interface can be registered to get control how multiple PropertySources are combined. This is useful in cases
- * where the default overriding policy as implemented in {@link #DEFAULT_OVERRIDING_COLLECTOR} is not matching
- * the need of the current application, e.g. then entries containing multiple values should be combined to new
- * values instead of overridden.
- */
-@FunctionalInterface
-public interface PropertyValueCombinationPolicy {
-
- /**
- * Default overriding collector, where each existing entry ({@code current} is overridden by a subsequent non-null
- * entry evaluated by {@code propertySource.get(key)}.
- */
- public final PropertyValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR =
- (current, key, propertySource) -> Optional.ofNullable(propertySource.get(key))
- .filter(s -> !s.isEmpty())
- .orElse(current);
-
- /**
- * Method that is called for each value evaluated by a PropertySource for the given key. This method is called
- * either when a single key is accessed, e.g. by calling {@code org.apache.tamaya.Configuration.getXXX}, but also
- * when the full configuration property map is accessed by calling
- * {@link org.apache.tamaya.Configuration#getProperties()}.
- *
- * @param currentValue the current value, including null.
- * The collector should either combine the existing value with value from {@code currentValue}
- * or replace the value in {@code currentValue} with {@code valueRead}, hereby returning the
- * result to be used as new {@code currentValue}.
- * @param key The current key to be evaluated.
- * @param propertySource The PropertySource that may return an value for the given key. The PropertySource given
- * may be evaluated for additional meta-data, how the given values are to be combined.
- * Note that the value returned by a PropertySource can be null. In that case
- * {@code currentValue} should be returned in almost all cases.
- * @return the value to be used for future evaluation.
- */
- String collect(String currentValue, String key, PropertySource propertySource);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
deleted file mode 100644
index f248503..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.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.spi;
-
-import java.util.List;
-
-
-/**
- * This class models the component that is managing the lifecycle current the
- * services used by the Configuration API.
- */
-public interface ServiceContext {
-
- /**
- * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
- *
- * @return the {@link ServiceContext} to be used.
- */
- public static ServiceContext getInstance() {
- return ServiceContextManager.getServiceContext();
- }
-
- /**
- * @return ordinal of the ServiceContext. The one with the highest ordinal will be taken.
- */
- default int ordinal() {
- return 1;
- }
-
- /**
- * Access a service singleton via its type.
- * If multiple implementations for the very serviceType exist then
- * the one with the highest {@link javax.annotation.Priority} will be used.
- *
- * @param serviceType the service type.
- * @return The instance to be used, never {@code null}
- * @throws org.apache.tamaya.ConfigException if there are multiple service implementations with the maximum priority.
- */
- <T> T getService(Class<T> serviceType);
-
- /**
- * Access a list current services, given its type. The bootstrap mechanism should
- * order the instance for precedence, hereby the most significant should be
- * first in order.
- *
- * @param serviceType the service type.
- * @return The instance to be used, never {@code null}
- */
- <T> List<T> getServices(Class<T> serviceType);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
deleted file mode 100644
index bcaca06..0000000
--- a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ /dev/null
@@ -1,115 +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.spi;
-
-import org.apache.tamaya.ConfigException;
-
-import java.util.Objects;
-import java.util.ServiceLoader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * This singleton provides access to the services available in the current {@link ServiceContext}. The
- * behaviour can be adapted, by calling {@link ServiceContextManager#set(ServiceContext)} before accessing any
- * services.
- */
-public final class ServiceContextManager {
-
- /** The logger used. */
- private static final Logger LOG = Logger.getLogger(ServiceContextManager.class.getName());
-
- /**
- * The ServiceProvider used.
- */
- private static volatile ServiceContext serviceContextProviderDelegate;
-
- /**
- * Private singletons constructor.
- */
- private ServiceContextManager() {
- }
-
- /**
- * Load the {@link ServiceContext} to be used.
- *
- * @return {@link ServiceContext} to be used for loading the services.
- */
- private static ServiceContext loadDefaultServiceProvider() {
- ServiceContext highestServiceContext = null;
- try {
- int highestOrdinal = 0;
- for (ServiceContext serviceContext : ServiceLoader.load(ServiceContext.class)) {
- if (serviceContext.ordinal() > highestOrdinal) {
- highestServiceContext = serviceContext;
- highestOrdinal = serviceContext.ordinal();
- }
- }
- } catch (Exception e) {
- throw new ConfigException("ServiceContext not loadable", e);
- }
- if (highestServiceContext == null) {
- throw new ConfigException("No ServiceContext found");
- }
- LOG.info("Using Service Context of type: " + highestServiceContext.getClass().getName());
- return highestServiceContext;
- }
-
- /**
- * Replace the current {@link ServiceContext} in use.
- *
- * @param serviceContextProvider the new {@link ServiceContext}, not null.
- */
- public static ServiceContext set(ServiceContext serviceContextProvider) {
- ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
- Objects.requireNonNull(serviceContextProvider);
- synchronized (ServiceContextManager.class) {
- if (ServiceContextManager.serviceContextProviderDelegate == null) {
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- Logger.getLogger(ServiceContextManager.class.getName())
- .log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
- } else {
- Logger.getLogger(ServiceContextManager.class.getName())
- .log(Level.WARNING, "Replacing ServiceProvider " +
- ServiceContextManager.serviceContextProviderDelegate.getClass().getName() +
- " with: " + serviceContextProvider.getClass().getName());
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- }
- }
- return currentContext;
- }
-
- /**
- * Ge {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
- *
- * @return the {@link ServiceContext} used.
- */
- public static ServiceContext getServiceContext() {
- if (serviceContextProviderDelegate == null) {
- synchronized (ServiceContextManager.class) {
- if (serviceContextProviderDelegate == null) {
- serviceContextProviderDelegate = loadDefaultServiceProvider();
- }
- }
- }
- return serviceContextProviderDelegate;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
deleted file mode 100644
index e5898cf..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-/**
- * Tests instantiating {@link org.apache.tamaya.ConfigException}.
- */
-public class ConfigExceptionTest {
-
- @Test
- public void testCreationMessage(){
- ConfigException ex = new ConfigException("test");
- assertNull(ex.getCause());
- assertEquals(ex.getMessage(), "test");
- }
-
- @Test
- public void testCreationMessageThrowable(){
- Exception e = new IllegalStateException("blabla");
- ConfigException ex = new ConfigException("test", e);
- assertTrue(ex.getCause() == e);
- assertEquals("test", ex.getMessage());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java b/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
deleted file mode 100644
index 8870d22..0000000
--- a/attic/java8/api/src/test/java/org/apache/tamaya/ConfigurationProviderTest.java
+++ /dev/null
@@ -1,63 +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;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Simple tests for the }@link ConfigurationProvider} singleton class.
- */
-public class ConfigurationProviderTest {
-
- @Test
- public void testGetConfiguration() throws Exception {
- Configuration cfg = ConfigurationProvider.getConfiguration();
- assertNotNull(cfg);
- }
-
-// @Test
-// public void testSetConfigurationContext() throws Exception {
-// ConfigurationContextBuilder builder = ConfigurationProvider.getConfigurationContextBuilder();
-// ConfigurationContext ctx = builder.build();
-// ConfigurationContext prevCtx = ConfigurationProvider.getConfigurationContext();
-// assertNotNull(prevCtx);
-// ConfigurationProvider.setConfigurationContext(ctx);
-// assertTrue(ConfigurationProvider.getConfigurationContext() == ctx);
-// ConfigurationProvider.setConfigurationContext(prevCtx);
-// assertTrue(ConfigurationProvider.getConfigurationContext() == prevCtx);
-//
-// }
-//
-// @Test
-// public void testIsConfigurationContextSettable() throws Exception {
-// assertTrue(ConfigurationProvider.isConfigurationContextSettable());
-// }
-//
-// @Test
-// public void testGetConfigurationContextBuilder() throws Exception {
-// ConfigurationContextBuilder builder = ConfigurationProvider.getConfigurationContextBuilder();
-// assertNotNull(builder);
-// assertTrue(builder.build().getPropertyConverters().isEmpty());
-// assertTrue(builder.build().getPropertyFilters().isEmpty());
-// assertTrue(builder.build().getPropertySources().isEmpty());
-//
-// }
-}
[3/6] incubator-tamaya git commit: Removed the attic
Posted by pl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
deleted file mode 100644
index bc6a4ec..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.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.provider;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.core.propertysource.SimplePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * Provider which reads all {@code javaconfiguration.properties} files from classpath
- */
-public class JavaConfigurationProvider implements PropertySourceProvider {
- /** Default location in the classpath, where Tamaya looks for configuration by default. */
- public static final String DEFAULT_PROPERTIES_FILE_NAME="META-INF/javaconfiguration.properties";
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- List<PropertySource> propertySources = new ArrayList<>();
- try {
- Enumeration<URL> urls = Thread.currentThread().getContextClassLoader()
- .getResources(DEFAULT_PROPERTIES_FILE_NAME);
- while (urls.hasMoreElements()) {
- propertySources.add(new SimplePropertySource(urls.nextElement()));
- }
-
- } catch (IOException e) {
- throw new ConfigException("Error while loading javaconfiguration.properties", e);
- }
- return Collections.unmodifiableList(propertySources);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
deleted file mode 100644
index 4efa42e..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
+++ /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.DefaultConfigurationContextBuilder
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
deleted file mode 100644
index 7c0e249..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
+++ /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.DefaultConfigurationProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
deleted file mode 100644
index fff680a..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ /dev/null
@@ -1,37 +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.converters.BooleanConverter
-org.apache.tamaya.core.internal.converters.ByteConverter
-org.apache.tamaya.core.internal.converters.CharConverter
-org.apache.tamaya.core.internal.converters.ClassConverter
-org.apache.tamaya.core.internal.converters.DoubleConverter
-org.apache.tamaya.core.internal.converters.FloatConverter
-org.apache.tamaya.core.internal.converters.IntegerConverter
-org.apache.tamaya.core.internal.converters.LongConverter
-org.apache.tamaya.core.internal.converters.ShortConverter
-org.apache.tamaya.core.internal.converters.BigDecimalConverter
-org.apache.tamaya.core.internal.converters.BigIntegerConverter
-org.apache.tamaya.core.internal.converters.CurrencyConverter
-org.apache.tamaya.core.internal.converters.LocalDateConverter
-org.apache.tamaya.core.internal.converters.LocalDateTimeConverter
-org.apache.tamaya.core.internal.converters.LocalTimeConverter
-org.apache.tamaya.core.internal.converters.ZoneIdConverter
-org.apache.tamaya.core.internal.converters.NumberConverter
-org.apache.tamaya.core.internal.converters.URIConverter
-org.apache.tamaya.core.internal.converters.URLConverter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 1b8f8c0..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /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.propertysource.EnvironmentPropertySource
-org.apache.tamaya.core.propertysource.SystemPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index 4535a09..0000000
--- a/attic/java8/core/src/main/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.core.provider.JavaConfigurationProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 2721eff..0000000
--- a/attic/java8/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/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
deleted file mode 100644
index 3e2b160..0000000
--- a/attic/java8/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.ConfigurationProvider;
-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(ConfigurationProvider.getConfiguration());
- }
-
- @Test
- public void testContent(){
- assertEquals("Robin", ConfigurationProvider.getConfiguration().getOptional("name").get());
- assertEquals("Sabine", ConfigurationProvider.getConfiguration().getOptional("name2").get()); // from default
- assertEquals("Mapped to name: Robin", ConfigurationProvider.getConfiguration().getOptional("name3").get()); // oderridden default, mapped by filter to name property
- assertEquals("Sereina(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)", ConfigurationProvider.getConfiguration().getOptional("name4").get()); // final only
- assertNull(ConfigurationProvider.getConfiguration().getOptional("name5").orElse(null)); // final only, but removed from filter
-
- System.out.println("name : " + ConfigurationProvider.getConfiguration().getOptional("name").get());
- System.out.println("name2: " + ConfigurationProvider.getConfiguration().getOptional("name2").get());
- System.out.println("name3: " + ConfigurationProvider.getConfiguration().getOptional("name3").get());
- System.out.println("name4: " + ConfigurationProvider.getConfiguration().getOptional("name4").get());
- System.out.println("name5: " + ConfigurationProvider.getConfiguration().getOptional("name5").orElse(null));
-
- System.out.println("ALL :");
- ConfigurationProvider.getConfiguration().getProperties().entrySet().forEach(e ->
- System.out.println(" " + e.getKey()+" = " + e.getValue()));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
deleted file mode 100644
index c2a35d8..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
+++ /dev/null
@@ -1,55 +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.mockito.exceptions.base.MockitoException;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.io.Serializable;
-
-// @todo This is a duplicated class
-public class NotMockedAnswer implements Answer<Object>, Serializable {
- public final static NotMockedAnswer NOT_MOCKED_ANSWER = new NotMockedAnswer();
-
- private NotMockedAnswer() {
- }
-
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- StringBuilder msgBuilder = new StringBuilder();
-
- msgBuilder.append("Invocation of method not mocked: ")
- .append(invocation.getMethod().toGenericString());
-
- if (invocation.getArguments().length > 0) {
- msgBuilder.append(" Supplied arguments: ");
-
- for (int i = 0; i < invocation.getArguments().length; i++) {
- msgBuilder.append(invocation.getArguments()[i]);
-
- if (i - 1 < invocation.getArguments().length) {
- msgBuilder.append(", ");
- }
- }
- }
-
- throw new MockitoException(msgBuilder.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
deleted file mode 100644
index aa77a5d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
+++ /dev/null
@@ -1,29 +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;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class A implements AutoCloseable{
- @Override
- public void close() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
deleted file mode 100644
index 31bafb6..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
+++ /dev/null
@@ -1,29 +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;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class B extends A implements Runnable{
- @Override
- public void run() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java
deleted file mode 100644
index aad1ef9..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.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.core.internal;
-
-import java.io.IOException;
-import java.nio.CharBuffer;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class C extends B implements Readable{
-
- private String inValue;
-
- public C(String inValue){
- this.inValue = inValue;
- }
-
- @Override
- public int read(CharBuffer cb) throws IOException {
- return 0;
- }
-
- /**
- * Returns the input value, set on creation. Used for test assertion.
- * @return the in value.
- */
- public String getInValue() {
- return inValue;
- }
-
- @Override
- public String toString() {
- return "C{" +
- "inValue='" + inValue + '\'' +
- '}';
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
deleted file mode 100644
index 62b8c9d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
+++ /dev/null
@@ -1,31 +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.PropertyConverter;
-
-/**
- * Created by Anatole on 13.06.2015.
- */
-public class CTestConverter implements PropertyConverter<C>{
- @Override
- public C convert(String value) {
- return new C(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
deleted file mode 100644
index 539cd8d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
+++ /dev/null
@@ -1,204 +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.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import javax.annotation.Priority;
-import java.util.ArrayList;
-import java.util.List;
-
-import static java.util.Collections.singletonList;
-import static org.apache.tamaya.core.NotMockedAnswer.NOT_MOCKED_ANSWER;
-import static org.apache.tamaya.spi.PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-public class DefaultConfigurationTest {
- private TestAppendingAFilter FILTER_APPENDING_A = new TestAppendingAFilter();
- private TestPrependingBFilter FILTER_PREPENDING_B = new TestPrependingBFilter();
- private TestPrependingCFilter FILTER_PREPENDING_C = new TestPrependingCFilter();
- private TestPrependingDFilter FILTER_PREPENDING_D = new TestPrependingDFilter();
-
- /* =
- * =- Section with tests for filtering properties with PropertyFilters
- * =
- */
-
- @Test
- public void filteringOfGivenValueWorksWithOneFilterWithoutPriority() {
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(singletonList(FILTER_APPENDING_A)).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("VA$"));
- }
-
- @Test
- public void filteringOfGivenValueWorksWithTwoFiltersWithoutPriority() {
- List<PropertyFilter> filters = new ArrayList<>();
-
- TestAppendingAFilter filterA = spy(FILTER_APPENDING_A);
- TestPrependingBFilter filterB = spy(FILTER_PREPENDING_B);
- filters.add(filterA);
- filters.add(filterB);
-
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(filters).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- assertThat(value, equalTo("$BVA$"));
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
- }
-
- @Test
- public void filteringOfGivenValueWorksWithOneFilterWithPriority() {
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(singletonList(FILTER_PREPENDING_C)).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("$CV"));
- }
-
- @Test
- public void filteringOfGivenValueWorksWithTwoFiltersWithDifferentPriorities() {
- assertThat(FILTER_PREPENDING_C.getClass().isAnnotationPresent(Priority.class), is(true));
- assertThat(FILTER_PREPENDING_D.getClass().isAnnotationPresent(Priority.class), is(true));
-
- List<PropertyFilter> filters = new ArrayList<>();
-
- filters.add(FILTER_PREPENDING_C);
- filters.add(FILTER_PREPENDING_D);
-
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(filters).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("$D$CV"));
- }
-
- private static class TestAppendingAFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.endsWith("A$")
- ? value
- : value + "A$";
- }
- }
-
- private static class TestPrependingBFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.startsWith("$B")
- ? value
- : "$B" + value;
- }
- }
-
- @Priority(987)
- private static class TestPrependingCFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.contains("$C")
- ? value
- : "$C" + value;
- }
- }
-
- @Priority(111)
- private static class TestPrependingDFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.contains("$D")
- ? value
- : "$D" + value;
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
deleted file mode 100644
index abbe944..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
+++ /dev/null
@@ -1,128 +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.ConfigException;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.annotation.Priority;
-import java.util.List;
-
-public class DefaultServiceContextTest {
-
- /**
- * context to test
- */
- private DefaultServiceContext context = new DefaultServiceContext();
-
-
- @Test
- public void testGetService() {
- ConfigurationProviderSpi providerSpi = context.getService(ConfigurationProviderSpi.class);
- Assert.assertNotNull(providerSpi);
- Assert.assertTrue(providerSpi instanceof DefaultConfigurationProvider);
- }
-
- @Test(expected = ConfigException.class)
- public void testGetService_multipleServicesWithoutPriority_shouldThrowConfigException() {
- context.getService(InvalidPriorityInterface.class);
- }
-
- @Test
- public void testGetService_multipleService_shouldReturnServiceWithHighestPriority() {
- MultiImplsInterface service = context.getService(MultiImplsInterface.class);
-
- Assert.assertNotNull(service);
- Assert.assertTrue(service instanceof MultiImpl2);
- }
-
- @Test
- public void testGetService_noImpl_shouldReturnEmptyOpional() {
- NoImplInterface service = context.getService(NoImplInterface.class);
- Assert.assertNull(service);
- }
-
-
- @Test
- public void testGetServices_shouldReturnServices() {
- {
- List<InvalidPriorityInterface> services = context.getServices(InvalidPriorityInterface.class);
- Assert.assertNotNull(services);
- Assert.assertEquals(2, services.size());
-
- for (InvalidPriorityInterface service : services) {
- Assert.assertTrue(service instanceof InvalidPriorityImpl1 || service instanceof InvalidPriorityImpl2);
- }
- }
-
- {
- List<MultiImplsInterface> services = context.getServices(MultiImplsInterface.class);
- Assert.assertNotNull(services);
- Assert.assertEquals(3, services.size());
-
- for (MultiImplsInterface service : services) {
- Assert.assertTrue(service instanceof MultiImpl1 ||
- service instanceof MultiImpl2 ||
- service instanceof MultiImpl3);
- }
- }
- }
-
- @Test
- public void testGetServices_noImpl_shouldReturnEmptyList() {
- List<NoImplInterface> services = context.getServices(NoImplInterface.class);
- Assert.assertNotNull(services);
- Assert.assertTrue(services.isEmpty());
- }
-
-
- // some test interfaces and classes
-
- public static interface InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl1 implements InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl2 implements InvalidPriorityInterface {
- }
-
-
- public static interface MultiImplsInterface {
- }
-
- public static class MultiImpl1 implements MultiImplsInterface {
- }
-
- @Priority(value = 500)
- public static class MultiImpl2 implements MultiImplsInterface {
- }
-
- @Priority(value = -10)
- public static class MultiImpl3 implements MultiImplsInterface {
- }
-
-
- private static interface NoImplInterface {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
deleted file mode 100644
index 9b413aa..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
+++ /dev/null
@@ -1,162 +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.PropertyConverter;
-import org.apache.tamaya.TypeLiteral;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-
-public class PropertyConverterManagerTest {
- @Test
- public void customTypeWithFactoryMethodOfIsRecognizedAsSupported() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- assertThat(manager.isTargetTypeSupported(TypeLiteral.of(MyType.class)),
- is(true));
- }
-
- @Test
- public void factoryMethodOfIsUsedAsConverter() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- List<PropertyConverter<Object>> converters = manager.getPropertyConverters(TypeLiteral.of(MyType.class));
-
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Object> converter = converters.get(0);
-
- Object result = converter.convert("IN");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(MyType.class));
- assertThat(((MyType)result).getValue(), equalTo("IN"));
- }
-
- public static class MyType {
- private String typeValue;
-
- private MyType(String value) {
- typeValue = value;
- }
-
- public static MyType of(String source) {
- return new MyType(source);
- }
-
- public String getValue() {
- return typeValue;
- }
-
- }
-
- @Test
- public void testDirectConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<C>> converters = manager.getPropertyConverters(TypeLiteral.of(C.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<C> converter = converters.get(0);
- C result = converter.convert("testDirectConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectConverterMapping"));
- }
-
- @Test
- public void testDirectSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<B>> converters = manager.getPropertyConverters(TypeLiteral.of(B.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<B> converter = converters.get(0);
- B result = converter.convert("testDirectSuperclassConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectSuperclassConverterMapping"));
- }
-
- @Test
- public void testTransitiveSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<A>> converters = manager.getPropertyConverters(TypeLiteral.of(A.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<A> converter = converters.get(0);
- A result = converter.convert("testTransitiveSuperclassConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveSuperclassConverterMapping"));
- }
-
- @Test
- public void testDirectInterfaceMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Readable>> converters = manager.getPropertyConverters(TypeLiteral.of(Readable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Readable> converter = converters.get(0);
- Readable result = converter.convert("testDirectInterfaceMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectInterfaceMapping"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping1(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Runnable>> converters = manager.getPropertyConverters(TypeLiteral.of(Runnable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Runnable> converter = converters.get(0);
- Runnable result = converter.convert("testTransitiveInterfaceMapping1");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping1"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping2(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<AutoCloseable>> converters = manager.getPropertyConverters(TypeLiteral.of(AutoCloseable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<AutoCloseable> converter = converters.get(0);
- AutoCloseable result = converter.convert("testTransitiveInterfaceMapping2");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping2"));
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
deleted file mode 100644
index 9c4449a..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
+++ /dev/null
@@ -1,104 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BigDecimalConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.decimal", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal(101));
- }
-
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.hex.lowerX", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal("47"));
- valueRead = config.getOptional("tests.converter.bd.hex.upperX", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal("63"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.foo", BigDecimal.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.big", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("101666666666666662333337263723628763821638923628193612983618293628763"),
- valueRead.get());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigFloatValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.bigFloat", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("1016666666666666623333372637236287638216389293628763.1016666666666666623333372" +
- "63723628763821638923628193612983618293628763"), valueRead.get());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
deleted file mode 100644
index a9671f0..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
+++ /dev/null
@@ -1,131 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BooleanConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- // trues
- Optional<Boolean> valueRead = config.getOptional("tests.converter.boolean.y1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.y2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.t1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.t2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- // falses
- valueRead = config.getOptional("tests.converter.boolean.n1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.n2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.f1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.f2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.foo", Boolean.class);
- assertFalse(valueRead.isPresent());
- }
- /*
-
- case "tests.converter.boolean.n1":
- return "n";
- case "tests.converter.boolean.n2":
- return "N";
- case "tests.converter.boolean.no1":
- return "no";
- case "tests.converter.boolean.no2":
- return "No";
- case "tests.converter.boolean.no3":
- return "nO";
- case "tests.converter.boolean.false1":
- return "false";
- case "tests.converter.boolean.false2":
- return "False";
- case "tests.converter.boolean.false3":
- return "falSe";
- case "tests.converter.boolean.f1":
- return "f";
- case "tests.converter.boolean.f2":
- return "F";
- */
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
deleted file mode 100644
index 3d3fe3e..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
+++ /dev/null
@@ -1,113 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class ByteConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.decimal", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.octal", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("02").byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.hex.lowerX", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("0x2F").byteValue());
- valueRead = config.getOptional("tests.converter.byte.hex.upperX", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("0X3F").byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.foo", Byte.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.min", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Byte.MIN_VALUE, valueRead.get().byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.max", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Byte.MAX_VALUE, valueRead.get().byteValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
deleted file mode 100644
index 6a124bd..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
+++ /dev/null
@@ -1,90 +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.converters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Optional;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-/**
- * Tests conversion of the {@link org.apache.tamaya.core.internal.converters.CharConverter}.
- */
-public class CharConverterTest {
-
- @Test
- public void testConvert_Character() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-numeric", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), (char)101);
- }
-
- @Test
- public void testConvert_Character_Quoted() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.d", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'd');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-before", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-after", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-around", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.foo", Character.class);
- assertFalse(valueRead.isPresent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
deleted file mode 100644
index 32d0b93..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
+++ /dev/null
@@ -1,252 +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.converters;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Test Property Source used by converter tests.
- */
-public class ConverterTestsPropertySource implements PropertySource{
- @Override
- public int getOrdinal() {
- return 0;
- }
-
- @Override
- public String getName() {
- return "ConverterTestsPropertySource";
- }
-
- @Override
- public String get(String key) {
- switch(key){
- // Bytes
- case "tests.converter.byte.decimal":
- return "101";
- case "tests.converter.byte.octal":
- return "02";
- case "tests.converter.byte.hex.lowerX":
- return "0x2F";
- case "tests.converter.byte.hex.upperX":
- return "0X3F";
- case "tests.converter.byte.min":
- return "min";
- case "tests.converter.byte.max":
- return "MAX_Value";
- // Boolean
- case "tests.converter.boolean.y1":
- return "y";
- case "tests.converter.boolean.y2":
- return "Y";
- case "tests.converter.boolean.yes1":
- return "yes";
- case "tests.converter.boolean.yes2":
- return "Yes";
- case "tests.converter.boolean.yes3":
- return "yeS";
- case "tests.converter.boolean.true1":
- return "true";
- case "tests.converter.boolean.true2":
- return "True";
- case "tests.converter.boolean.true3":
- return "trUe";
- case "tests.converter.boolean.t1":
- return "t";
- case "tests.converter.boolean.t2":
- return "T";
- case "tests.converter.boolean.n1":
- return "n";
- case "tests.converter.boolean.n2":
- return "N";
- case "tests.converter.boolean.no1":
- return "no";
- case "tests.converter.boolean.no2":
- return "No";
- case "tests.converter.boolean.no3":
- return "nO";
- case "tests.converter.boolean.false1":
- return "false";
- case "tests.converter.boolean.false2":
- return "False";
- case "tests.converter.boolean.false3":
- return "falSe";
- case "tests.converter.boolean.f1":
- return "f";
- case "tests.converter.boolean.f2":
- return "F";
- // Character
- case "tests.converter.char.f":
- return "f";
- case "tests.converter.char.d":
- return "'d'";
- case "tests.converter.char.f-before":
- return " f";
- case "tests.converter.char.f-after":
- return "f ";
- case "tests.converter.char.f-around":
- return " f ";
- case "tests.converter.char.f-numeric":
- return "101";
- // currency
- case "tests.converter.currency.code1":
- return "CHF";
- case "tests.converter.currency.code2":
- return "cHf";
- case "tests.converter.currency.code3":
- return " CHF";
- case "tests.converter.currency.code4":
- return "CHF ";
- case "tests.converter.currency.code5":
- return " CHF ";
- case "tests.converter.currency.code-numeric1":
- return "100";
- case "tests.converter.currency.code-numeric2":
- return " 100";
- case "tests.converter.currency.code-numeric3":
- return "100 ";
- case "tests.converter.currency.code-numeric4":
- return " 100 ";
- case "tests.converter.currency.code-locale1":
- return "DE";
- case "tests.converter.currency.code-locale2":
- return " DE";
- case "tests.converter.currency.code-locale3":
- return "DE ";
- case "tests.converter.currency.code-locale4":
- return " DE ";
- //double
- case "tests.converter.double.decimal":
- return "1.23456789";
- case "tests.converter.double.decimalNegative":
- return "-1.23456789";
- case "tests.converter.double.integer":
- return " 100";
- case "tests.converter.double.hex1":
- return " 0XFF";
- case "tests.converter.double.hex2":
- return "-0xFF ";
- case "tests.converter.double.hex3":
- return "#FF";
- case "tests.converter.double.octal":
- return "0013";
- case "tests.converter.double.min":
- return "MIN_Value";
- case "tests.converter.double.max":
- return "max";
- case "tests.converter.double.nan":
- return "NAN";
- case "tests.converter.double.pi":
- return "positive_infinity";
- case "tests.converter.double.ni":
- return "Negative_Infinity";
- //float
- case "tests.converter.float.decimal":
- return "1.23456789";
- case "tests.converter.float.decimalNegative":
- return "-1.23456789";
- case "tests.converter.float.integer":
- return " 100";
- case "tests.converter.float.hex1":
- return " 0XFF";
- case "tests.converter.float.hex2":
- return "-0xFF ";
- case "tests.converter.float.hex3":
- return "#FF";
- case "tests.converter.float.octal":
- return "0013";
- case "tests.converter.float.min":
- return "MIN_Value";
- case "tests.converter.float.max":
- return "max";
- case "tests.converter.float.nan":
- return "NAN";
- case "tests.converter.float.pi":
- return "positive_infinity";
- case "tests.converter.float.ni":
- return "Negative_Infinity";
- // Integer
- case "tests.converter.integer.decimal":
- return "101";
- case "tests.converter.integer.octal":
- return "02";
- case "tests.converter.integer.hex.lowerX":
- return "0x2F";
- case "tests.converter.integer.hex.upperX":
- return "0X3F";
- case "tests.converter.integer.min":
- return "min";
- case "tests.converter.integer.max":
- return "MAX_Value";
- // Long
- case "tests.converter.long.decimal":
- return "101";
- case "tests.converter.long.octal":
- return "02";
- case "tests.converter.long.hex.lowerX":
- return "0x2F";
- case "tests.converter.long.hex.upperX":
- return "0X3F";
- case "tests.converter.long.min":
- return "min";
- case "tests.converter.long.max":
- return "MAX_Value";
- // Short
- case "tests.converter.short.decimal":
- return "101";
- case "tests.converter.short.octal":
- return "02";
- case "tests.converter.short.hex.lowerX":
- return "0x2F";
- case "tests.converter.short.hex.upperX":
- return "0X3F";
- case "tests.converter.short.min":
- return "min";
- case "tests.converter.short.max":
- return "MAX_Value";
- // BigDecimal
- case "tests.converter.bd.decimal":
- return "101";
- case "tests.converter.bd.float":
- return "101.36438746";
- case "tests.converter.bd.big":
- return "101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.bigFloat":
- return "1016666666666666623333372637236287638216389293628763.101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.hex.lowerX":
- return "0x2F";
- case "tests.converter.bd.hex.upperX":
- return "0X3F";
- }
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
-
- @Override
- public boolean isScannable() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
deleted file mode 100644
index 4c498f6..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
+++ /dev/null
@@ -1,155 +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.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Currency;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class CurrencyConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_cHf() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code5", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code-numeric1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Locale() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code-locale1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.foo", Byte.class);
- assertFalse(valueRead.isPresent());
- }
-}
\ No newline at end of file