Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/configjsr 35cc751f2 -> 117c0a918


Adapted to comply with JSR API.

Signed-off-by: Anatole Tresch <[email protected]>


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

Branch: refs/heads/configjsr
Commit: 117c0a9186f0135e813e5851acc453227374d0a6
Parents: 35cc751
Author: Anatole Tresch <[email protected]>
Authored: Wed Jan 10 01:13:54 2018 +0100
Committer: Anatole Tresch <[email protected]>
Committed: Wed Jan 10 01:13:54 2018 +0100

----------------------------------------------------------------------
 jodatime/pom.xml                                |  5 ++++
 .../tamaya/jodatime/DateTimeConverter.java      | 13 +++++----
 .../tamaya/jodatime/DateTimeZoneConverter.java  | 13 +++++----
 .../tamaya/jodatime/DurationConverter.java      | 19 +++++++------
 .../tamaya/jodatime/InstantConverter.java       | 13 +++++----
 .../tamaya/jodatime/LocalDateConverter.java     | 14 ++++++----
 .../tamaya/jodatime/LocalTimeConverter.java     | 13 +++++----
 .../apache/tamaya/jodatime/PeriodConverter.java | 15 ++++++----
 .../services/javax.config.spi.Converter         | 25 +++++++++++++++++
 .../org.apache.tamaya.spi.PropertyConverter     | 25 -----------------
 .../tamaya/jodatime/DateTimeConverterIT.java    | 11 ++++----
 .../tamaya/jodatime/DateTimeConverterTest.java  | 19 +++++--------
 .../jodatime/DateTimeZoneConverterIT.java       | 10 +++----
 .../jodatime/DateTimeZoneConverterTest.java     | 18 +++++-------
 .../tamaya/jodatime/DurationConverterIT.java    | 10 +++----
 .../tamaya/jodatime/DurationConverterTest.java  | 20 ++++++--------
 .../org/apache/tamaya/jodatime/FullStackIT.java | 29 ++++++++++----------
 .../tamaya/jodatime/PeriodConverterIT.java      | 10 +++----
 .../tamaya/jodatime/PeriodConverterTest.java    | 15 ++++------
 .../resources/META-INF/javaconfig.properties    | 22 +++++++++++++++
 .../META-INF/javaconfiguration.properties       | 22 ---------------
 21 files changed, 173 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/pom.xml
----------------------------------------------------------------------
diff --git a/jodatime/pom.xml b/jodatime/pom.xml
index c88f11c..1be12d0 100644
--- a/jodatime/pom.xml
+++ b/jodatime/pom.xml
@@ -47,6 +47,11 @@ under the License.
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-base</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tamaya</groupId>
             <artifactId>tamaya-core</artifactId>
             <version>${project.parent.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
index 864eb32..58050e6 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
@@ -18,14 +18,14 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.DateTimeFormatterBuilder;
 import org.joda.time.format.DateTimeParser;
 
+import javax.config.spi.Converter;
 import java.util.Objects;
 
 /**
@@ -46,7 +46,7 @@ import java.util.Objects;
  *     <li>{@code yyyy-MM-dd'T'HHz}</li>
  * </ul>
  */
-public class DateTimeConverter implements PropertyConverter<DateTime> {
+public class DateTimeConverter implements Converter<DateTime> {
     static final String PARSER_FORMATS[] = {
         "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
         "yyyy-MM-dd'T'HH:mm:ss.SSSz",
@@ -90,8 +90,11 @@ public class DateTimeConverter implements 
PropertyConverter<DateTime> {
     }
 
     @Override
-    public DateTime convert(String value, ConversionContext context) {
-        context.addSupportedFormats(DateTimeConverter.class, PARSER_FORMATS);
+    public DateTime convert(String value) {
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            context.addSupportedFormats(DateTimeConverter.class, 
PARSER_FORMATS);
+        }
 
         String trimmed = Objects.requireNonNull(value).trim();
         DateTime result = null;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
index 198a345..4b959f7 100644
--- 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
+++ 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
@@ -18,10 +18,10 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTimeZone;
 
+import javax.config.spi.Converter;
 import java.util.regex.Pattern;
 
 import static java.util.Objects.requireNonNull;
@@ -37,14 +37,17 @@ import static java.util.Objects.requireNonNull;
  * @see DateTimeZone
  * @see DateTimeZone#getAvailableIDs()
  */
-public class DateTimeZoneConverter implements PropertyConverter<DateTimeZone> {
+public class DateTimeZoneConverter implements Converter<DateTimeZone> {
     private static final String PATTERN_REGEX = "(\\+|-)?\\d+";
     private static final Pattern IS_INTEGER_VALUE = 
Pattern.compile(PATTERN_REGEX);
 
     @Override
-    public DateTimeZone convert(String value, ConversionContext context) {
+    public DateTimeZone convert(String value) {
         String trimmed = requireNonNull(value).trim();
-        addSupportedFormats(context);
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            addSupportedFormats(context);
+        }
 
         DateTimeZone result = null;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/DurationConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/DurationConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/DurationConverter.java
index 36d6fe9..e3784bd 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/DurationConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/DurationConverter.java
@@ -18,15 +18,15 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.Duration;
 import org.joda.time.Period;
 
+import javax.config.spi.Converter;
 import java.util.Objects;
 
 /**
- * <p>A {@link PropertyConverter} for converting a string representation of a
+ * <p>A {@link Converter} for converting a string representation of a
  * given duration into a {@link Duration} instance.</p>
  *
  * <p>This converter supports the following string representations of a
@@ -38,23 +38,26 @@ import java.util.Objects;
  *     <li>All the period formats as defined in {@link PeriodConverter}.</li>
  *   </ol>
  */
-public class DurationConverter implements PropertyConverter<Duration> {
+public class DurationConverter implements Converter<Duration> {
 
     private PeriodConverter periodConverter = new PeriodConverter();
 
     @Override
-    public Duration convert(String value, ConversionContext context) {
+    public Duration convert(String value) {
         String trimmed = Objects.requireNonNull(value).trim();
-        addSupportedFormats(context);
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            addSupportedFormats(context);
+        }
         try {
             return Duration.parse(value);
         }catch(Exception e){
             Period period = null;
             if(value.startsWith("P")){
-                period = periodConverter.convert("P0Y0M0W"+value.substring(1), 
null);
+                period = periodConverter.convert("P0Y0M0W"+value.substring(1));
             }
             if(period == null){
-                period = periodConverter.convert("P0000-00-"+value, null);
+                period = periodConverter.convert("P0000-00-"+value);
             }
             if(period != null){
                 return period.toStandardDuration();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/InstantConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/InstantConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/InstantConverter.java
index 20d146b..2f29592 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/InstantConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/InstantConverter.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTime;
 import org.joda.time.Instant;
 import org.joda.time.format.*;
 
+import javax.config.spi.Converter;
 import java.util.Objects;
 
 /**
@@ -44,7 +44,7 @@ import java.util.Objects;
  *     <li>{@code yyyy-MM-dd'T'HHz}</li>
  * </ul>
  */
-public class InstantConverter implements PropertyConverter<Instant> {
+public class InstantConverter implements Converter<Instant> {
     static final String PARSER_FORMATS[] = {
         "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
         "yyyy-MM-dd'T'HH:mm:ss.SSSz",
@@ -88,8 +88,11 @@ public class InstantConverter implements 
PropertyConverter<Instant> {
     }
 
     @Override
-    public Instant convert(String value, ConversionContext context) {
-        context.addSupportedFormats(InstantConverter.class, PARSER_FORMATS);
+    public Instant convert(String value) {
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            context.addSupportedFormats(InstantConverter.class, 
PARSER_FORMATS);
+        }
 
         String trimmed = Objects.requireNonNull(value).trim();
         try {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalDateConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalDateConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalDateConverter.java
index 0739e93..75f6969 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalDateConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalDateConverter.java
@@ -18,14 +18,14 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.LocalDate;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.DateTimeFormatterBuilder;
 import org.joda.time.format.DateTimeParser;
 
+import javax.config.spi.Converter;
 import java.util.Objects;
 
 /**
@@ -41,7 +41,7 @@ import java.util.Objects;
  *     <li>{@code xxxx '-W' ww ['-' e]}</li>
  * </ul>
  */
-public class LocalDateConverter implements PropertyConverter<LocalDate> {
+public class LocalDateConverter implements Converter<LocalDate> {
     static final String PARSER_FORMATS[] = {
             "yyyy ['-' MM ['-' dd]]",
             "yyyy ['-' DDD]",
@@ -66,9 +66,11 @@ public class LocalDateConverter implements 
PropertyConverter<LocalDate> {
     }
 
     @Override
-    public LocalDate convert(String value, ConversionContext context) {
-        context.addSupportedFormats(LocalDateConverter.class, PARSER_FORMATS);
-
+    public LocalDate convert(String value) {
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            context.addSupportedFormats(LocalDateConverter.class, 
PARSER_FORMATS);
+        }
         String trimmed = Objects.requireNonNull(value).trim();
         LocalDate result = null;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalTimeConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalTimeConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalTimeConverter.java
index 22593c0..e8d89d8 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalTimeConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/LocalTimeConverter.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.LocalTime;
 import org.joda.time.format.*;
 
+import javax.config.spi.Converter;
 import java.util.Objects;
 
 /**
@@ -40,7 +40,7 @@ import java.util.Objects;
  *     <li>{@code fraction       = ('.' | ',') digit+ }</li>
  * </ul>
  */
-public class LocalTimeConverter implements PropertyConverter<LocalTime> {
+public class LocalTimeConverter implements Converter<LocalTime> {
     static final String PARSER_FORMATS[] = {
             "['T']` time-element\n" +
                     "time-element = HH [minute-element] | [fraction]\n" +
@@ -50,8 +50,11 @@ public class LocalTimeConverter implements 
PropertyConverter<LocalTime> {
     };
 
     @Override
-    public LocalTime convert(String value, ConversionContext context) {
-        context.addSupportedFormats(LocalTimeConverter.class, PARSER_FORMATS);
+    public LocalTime convert(String value) {
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            context.addSupportedFormats(LocalTimeConverter.class, 
PARSER_FORMATS);
+        }
 
         String trimmed = Objects.requireNonNull(value).trim();
         try {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java 
b/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java
index 2b946e2..defd487 100644
--- a/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java
+++ b/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java
@@ -18,19 +18,19 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.MutablePeriod;
 import org.joda.time.Period;
 import org.joda.time.format.ISOPeriodFormat;
 import org.joda.time.format.PeriodParser;
 
+import javax.config.spi.Converter;
 import java.util.Locale;
 import java.util.Objects;
 import java.util.regex.Pattern;
 
 /**
- * <p>A {@link PropertyConverter} for converting a string representation of a
+ * <p>A {@link Converter} for converting a string representation of a
  * given period into a {@link org.joda.time.Period} instance.</p>
  *
  * <p>This converter supports the following string representations of a
@@ -41,7 +41,7 @@ import java.util.regex.Pattern;
  *     <li>ISO format ({@code PyYmMwWdDThHmMsS})</li>
  *   </ol>
  */
-public class PeriodConverter implements 
PropertyConverter<org.joda.time.Period> {
+public class PeriodConverter implements Converter<Period> {
 
     private final static PeriodParser ISO_FORMAT = ISOPeriodFormat.standard()
                                                                   .getParser();
@@ -57,10 +57,13 @@ public class PeriodConverter implements 
PropertyConverter<org.joda.time.Period>
     private final static Pattern ALTERNATIVE_PATTERN = 
Pattern.compile(ALTERNATIVE_REGEX);
 
     @Override
-    public Period convert(String value, ConversionContext context) {
+    public Period convert(String value) {
         String trimmed = Objects.requireNonNull(value).trim();
 
-        addSupportedFormats(context);
+        ConversionContext context = ConversionContext.getContext();
+        if(context!=null) {
+            addSupportedFormats(context);
+        }
 
         MutablePeriod result = null;
         PeriodParser format = null;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/resources/META-INF/services/javax.config.spi.Converter
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/resources/META-INF/services/javax.config.spi.Converter 
b/jodatime/src/main/resources/META-INF/services/javax.config.spi.Converter
new file mode 100644
index 0000000..a8bb765
--- /dev/null
+++ b/jodatime/src/main/resources/META-INF/services/javax.config.spi.Converter
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the 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.jodatime.DateTimeConverter
+org.apache.tamaya.jodatime.DateTimeZoneConverter
+org.apache.tamaya.jodatime.PeriodConverter
+org.apache.tamaya.jodatime.DurationConverter
+org.apache.tamaya.jodatime.InstantConverter
+org.apache.tamaya.jodatime.LocalDateConverter
+org.apache.tamaya.jodatime.LocalTimeConverter

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git 
a/jodatime/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
 
b/jodatime/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
deleted file mode 100644
index a8bb765..0000000
--- 
a/jodatime/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ /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 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.jodatime.DateTimeConverter
-org.apache.tamaya.jodatime.DateTimeZoneConverter
-org.apache.tamaya.jodatime.PeriodConverter
-org.apache.tamaya.jodatime.DurationConverter
-org.apache.tamaya.jodatime.InstantConverter
-org.apache.tamaya.jodatime.LocalDateConverter
-org.apache.tamaya.jodatime.LocalTimeConverter

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterIT.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterIT.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterIT.java
index 85e7b6f..7bc9739 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterIT.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterIT.java
@@ -19,11 +19,10 @@
 package org.apache.tamaya.jodatime;
 
 
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ServiceContext;
 import org.apache.tamaya.spi.ServiceContextManager;
 import org.junit.Test;
 
+import javax.config.spi.Converter;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -33,13 +32,13 @@ import static org.hamcrest.Matchers.notNullValue;
 public class DateTimeConverterIT {
     @Test
     public void dateTimeConverterCanBeFoundAsServiceProvider() {
-        List<PropertyConverter> formats = 
ServiceContextManager.getServiceContext()
-                                                               
.getServices(PropertyConverter.class);
+        List<Converter> formats = ServiceContextManager.getServiceContext()
+                                                               
.getServices(Converter.class);
 
 
-        PropertyConverter<?> converter = null;
+        Converter<?> converter = null;
 
-        for (PropertyConverter format : formats) {
+        for (Converter format : formats) {
             if (format instanceof DateTimeConverter) {
                 converter = format;
                 break;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
index 483ee83..b2ec39c 100644
--- 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
+++ 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
@@ -18,9 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
@@ -74,10 +72,8 @@ public class DateTimeConverterTest {
              {"2007-08-31T16:47:01+00:00 ", 
FORMATTER.parseDateTime("2007-08-31T16:47:01.0+00:00")},
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (Object[] pair : inputResultPairs) {
-            DateTime date = converter.convert((String)pair[0], context);
+            DateTime date = converter.convert((String)pair[0]);
 
             assertThat("Converter failed to convert input value " + pair[0], 
date, notNullValue());
             assertThat(date.isEqual((DateTime)pair[1]), is(true));
@@ -90,10 +86,8 @@ public class DateTimeConverterTest {
              "00:00", "a", "-", "+ :00", "+00:"
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (String input : inputValues) {
-            DateTime date = converter.convert(input, context);
+            DateTime date = converter.convert(input);
 
             assertThat(date, nullValue());
         }
@@ -101,10 +95,11 @@ public class DateTimeConverterTest {
 
     @Test
     public void allSupportedFormatsAreAddedToTheConversionContext() {
-        ConversionContext context = new 
ConversionContext.Builder(TypeLiteral.of(DateTime.class)).build();
-
-        converter.convert("2007-08-31T16+00:00", context);
+        ConversionContext context = new ConversionContext.Builder(null, 
DateTime.class).build();
+        ConversionContext.setContext(context);
 
+        converter.convert("2007-08-31T16+00:00");
+        ConversionContext.reset();
         assertThat(context.getSupportedFormats(), 
hasSize(DateTimeConverter.PARSER_FORMATS.length));
 
         for (String format : DateTimeConverter.PARSER_FORMATS) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterIT.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterIT.java
 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterIT.java
index 0963408..35dd618 100644
--- 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterIT.java
+++ 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterIT.java
@@ -19,11 +19,11 @@
 package org.apache.tamaya.jodatime;
 
 
-import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.ServiceContext;
 import org.apache.tamaya.spi.ServiceContextManager;
 import org.junit.Test;
 
+import javax.config.spi.Converter;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -33,12 +33,12 @@ import static org.hamcrest.Matchers.notNullValue;
 public class DateTimeZoneConverterIT {
     @Test
     public void dateTimeZoneConverterCanBeFoundAsServiceProvider() {
-        List<PropertyConverter> formats = 
ServiceContextManager.getServiceContext()
-                                                               
.getServices(PropertyConverter.class);
+        List<Converter> formats = ServiceContextManager.getServiceContext()
+                                                               
.getServices(Converter.class);
 
-        PropertyConverter<?> converter = null;
+        Converter<?> converter = null;
 
-        for (PropertyConverter format : formats) {
+        for (Converter format : formats) {
             if (format instanceof DateTimeZoneConverter) {
                 converter = format;
                 break;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
index babbe06..032c439 100644
--- 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
+++ 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
@@ -18,9 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.ConversionContext.Builder;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTimeZone;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -57,10 +55,8 @@ public class DateTimeZoneConverterTest {
              {"+04:00", DateTimeZone.forID("+04:00")},
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (Object[] pair : inputResultPairs) {
-            DateTimeZone zone = converter.convert((String) pair[0], context);
+            DateTimeZone zone = converter.convert((String) pair[0]);
 
             assertThat("Converter failed to convert input value " + pair[0], 
zone, notNullValue());
             assertThat(zone, equalTo((DateTimeZone)pair[1]));
@@ -77,10 +73,8 @@ public class DateTimeZoneConverterTest {
              "2007-08-01+00:00"
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (String input : inputValues) {
-            DateTimeZone date = converter.convert(input, context);
+            DateTimeZone date = converter.convert(input);
 
             assertThat(date, nullValue());
         }
@@ -91,9 +85,11 @@ public class DateTimeZoneConverterTest {
         String firstFormat = "Time zone in the form [+-]hh:mm via the regex 
(\\+|-)?\\d+ (DateTimeZoneConverter)";
         String secondFormat = "All time zone ids supported by Joda Time 
(DateTimeZoneConverter)";
 
-        ConversionContext context = new 
Builder(TypeLiteral.of(DateTimeZone.class)).build();
+        ConversionContext context = new ConversionContext.Builder(null, 
DateTimeZone.class).build();
+        ConversionContext.setContext(context);
 
-        DateTimeZone result = converter.convert("+01:00", context);
+        DateTimeZone result = converter.convert("+01:00");
+        ConversionContext.reset();
 
         assertThat(result, notNullValue());
         assertThat(context.getSupportedFormats(), hasSize(2));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterIT.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterIT.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterIT.java
index 41288a8..cfcc601 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterIT.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterIT.java
@@ -19,10 +19,10 @@
 package org.apache.tamaya.jodatime;
 
 
-import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.ServiceContextManager;
 import org.junit.Test;
 
+import javax.config.spi.Converter;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -32,12 +32,12 @@ import static org.hamcrest.Matchers.notNullValue;
 public class DurationConverterIT {
     @Test
     public void durationperiodConverterCanBeFoundAsServiceProvider() {
-        List<PropertyConverter> formats = 
ServiceContextManager.getServiceContext()
-                                                               
.getServices(PropertyConverter.class);
+        List<Converter> formats = ServiceContextManager.getServiceContext()
+                                                               
.getServices(Converter.class);
 
-        PropertyConverter<?> converter = null;
+        Converter<?> converter = null;
 
-        for (PropertyConverter format : formats) {
+        for (Converter format : formats) {
             if (format instanceof DurationConverter) {
                 converter = format;
                 break;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
index 39cf41b..09d71fd 100644
--- 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
+++ 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
@@ -18,8 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.Duration;
 import org.joda.time.format.ISOPeriodFormat;
 import org.joda.time.format.PeriodFormatter;
@@ -58,10 +57,8 @@ public class DurationConverterTest {
 
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (Object[] pair : inputResultPairs) {
-            Duration duration = converter.convert((String) pair[0], context);
+            Duration duration = converter.convert((String) pair[0]);
 
             assertThat("Converter failed to convert input value " + pair[0], 
duration, notNullValue());
             assertThat(duration, equalTo((Duration) pair[1]));
@@ -78,10 +75,8 @@ public class DurationConverterTest {
                 "fooBar",
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (String input : inputValues) {
-            Duration duration = converter.convert(input, context);
+            Duration duration = converter.convert(input);
 
             assertThat(duration, nullValue());
         }
@@ -91,11 +86,12 @@ public class DurationConverterTest {
     public void allSupportedFormatsAreAddedToTheConversionContext() {
         String name = DurationConverter.class.getSimpleName();
 
-        ConversionContext context = new 
ConversionContext.Builder(TypeLiteral.of(Duration.class)).build();
-
-        converter.convert("P0DT0H0M0S", context);
+        ConversionContext context = new ConversionContext.Builder(null, 
Duration.class).build();
+        ConversionContext.setContext(context);
 
-        assertThat(context.getSupportedFormats(), hasSize(3));
+        converter.convert("P0DT0H0M0S");
+        ConversionContext.reset();
+        assertThat(context.getSupportedFormats(), hasSize(5));
         assertThat(context.getSupportedFormats(), hasItem("PdDThHmMsS (" + 
name + ")"));
         assertThat(context.getSupportedFormats(), hasItem("ddThh:mm:ss (" + 
name + ")"));
         assertThat(context.getSupportedFormats(), hasItem("PTa.bS 
("+name+")"));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
index ce9c414..a50dac2 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
@@ -18,17 +18,16 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
 import org.joda.time.MutablePeriod;
 import org.joda.time.Period;
 import org.joda.time.format.ISOPeriodFormat;
-import org.junit.Ignore;
 import org.junit.Test;
 
+import javax.config.Config;
+import javax.config.ConfigProvider;
+
 import java.util.Locale;
 
 import static org.hamcrest.CoreMatchers.equalTo;
@@ -41,10 +40,10 @@ public class FullStackIT {
     @Test
     public void retrieveJodaTimeValuesFromConfiguration() {
 
-        Configuration configuration = ConfigurationProvider.getConfiguration();
+        Config configuration = ConfigProvider.getConfig();
 
-        String dateTimeString = configuration.get("dateTimeValue");
-        DateTime dateTimeValue = configuration.get("dateTimeValue", 
DateTime.class);
+        String dateTimeString = configuration.getValue("dateTimeValue", 
String.class);
+        DateTime dateTimeValue = configuration.getValue("dateTimeValue", 
DateTime.class);
 
         assertThat(dateTimeString, notNullValue());
         assertThat(dateTimeString, equalTo("2010-08-08T14:00:15.5+10:00"));
@@ -54,16 +53,16 @@ public class FullStackIT {
 
     @Test
     public void retrieveDateTimeZoneValueFromConfiguration() {
-        Configuration configuration = ConfigurationProvider.getConfiguration();
+        Config configuration = ConfigProvider.getConfig();
 
-        String zoneAAsString = configuration.get("dateTimeZoneValueA");
-        DateTimeZone zoneA = configuration.get("dateTimeZoneValueA", 
DateTimeZone.class);
+        String zoneAAsString = configuration.getValue("dateTimeZoneValueA", 
String.class);
+        DateTimeZone zoneA = configuration.getValue("dateTimeZoneValueA", 
DateTimeZone.class);
 
         assertThat(zoneAAsString, equalTo("UTC"));
         assertThat(zoneA, equalTo(DateTimeZone.forID("UTC")));
 
-        String zoneBAsString = configuration.get("dateTimeZoneValueB");
-        DateTimeZone zoneB = configuration.get("dateTimeZoneValueB", 
DateTimeZone.class);
+        String zoneBAsString = configuration.getValue("dateTimeZoneValueB", 
String.class);
+        DateTimeZone zoneB = configuration.getValue("dateTimeZoneValueB", 
DateTimeZone.class);
 
         assertThat(zoneBAsString, equalTo("+01:00"));
         assertThat(zoneB, equalTo(DateTimeZone.forOffsetHours(1)));
@@ -71,15 +70,15 @@ public class FullStackIT {
 
     @Test
     public void retrievePeriodValueFromConfiguration() {
-        Configuration configuration = ConfigurationProvider.getConfiguration();
+        Config configuration = ConfigProvider.getConfig();
 
         MutablePeriod referenceValue = new MutablePeriod();
 
         ISOPeriodFormat.standard().getParser().parseInto(referenceValue, 
"P1Y1M1W1DT1H1M1S", 0,
                                                          Locale.ENGLISH);
 
-        String periodAsString = configuration.get("periodValueA");
-        Period period = configuration.get("periodValueA", Period.class);
+        String periodAsString = configuration.getValue("periodValueA", 
String.class);
+        Period period = configuration.getValue("periodValueA", Period.class);
 
         assertThat(periodAsString, equalTo("P1Y1M1W1DT1H1M1S"));
         assertThat(period, equalTo(referenceValue.toPeriod()));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterIT.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterIT.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterIT.java
index f110754..473b530 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterIT.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterIT.java
@@ -19,10 +19,10 @@
 package org.apache.tamaya.jodatime;
 
 
-import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.ServiceContextManager;
 import org.junit.Test;
 
+import javax.config.spi.Converter;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -32,12 +32,12 @@ import static org.hamcrest.Matchers.notNullValue;
 public class PeriodConverterIT {
     @Test
     public void periodConverterCanBeFoundAsServiceProvider() {
-        List<PropertyConverter> formats = 
ServiceContextManager.getServiceContext()
-                                                               
.getServices(PropertyConverter.class);
+        List<Converter> formats = ServiceContextManager.getServiceContext()
+                                                               
.getServices(Converter.class);
 
-        PropertyConverter<?> converter = null;
+        Converter<?> converter = null;
 
-        for (PropertyConverter format : formats) {
+        for (Converter format : formats) {
             if (format instanceof PeriodConverter) {
                 converter = format;
                 break;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
----------------------------------------------------------------------
diff --git 
a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java 
b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
index 0affb2c..6865abb 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
@@ -18,8 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.base.convert.ConversionContext;
 import org.joda.time.DateTime;
 import org.joda.time.Period;
 import org.joda.time.format.ISOPeriodFormat;
@@ -64,10 +63,8 @@ public class PeriodConverterTest {
              {"P0002-03-00T00:00:05", 
FORMATTER.parsePeriod("P2Y3M0W0DT0H0M5S")}
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (Object[] pair : inputResultPairs) {
-            Period period = converter.convert((String) pair[0], context);
+            Period period = converter.convert((String) pair[0]);
 
             assertThat("Converter failed to convert input value " + pair[0], 
period, notNullValue());
             assertThat(period, equalTo((Period)pair[1]));
@@ -82,10 +79,8 @@ public class PeriodConverterTest {
             "P0002T00:05"
         };
 
-        ConversionContext context = Mockito.mock(ConversionContext.class);
-
         for (String input : inputValues) {
-            Period period = converter.convert(input, context);
+            Period period = converter.convert(input);
 
             assertThat(period, nullValue());
         }
@@ -95,9 +90,9 @@ public class PeriodConverterTest {
     public void allSupportedFormatsAreAddedToTheConversionContext() {
         String name = PeriodConverter.class.getSimpleName();
 
-        ConversionContext context = new 
ConversionContext.Builder(TypeLiteral.of(Period.class)).build();
+        ConversionContext context = new ConversionContext.Builder(null, 
Period.class).build();
 
-        converter.convert("P7Y0M0W0DT0H0M0S", context);
+        converter.convert("P7Y0M0W0DT0H0M0S");
 
         assertThat(context.getSupportedFormats(), hasSize(2));
         assertThat(context.getSupportedFormats(), hasItem("PyYmMwWdDThHmMsS (" 
+ name + ")"));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/resources/META-INF/javaconfig.properties
----------------------------------------------------------------------
diff --git a/jodatime/src/test/resources/META-INF/javaconfig.properties 
b/jodatime/src/test/resources/META-INF/javaconfig.properties
new file mode 100644
index 0000000..e66e448
--- /dev/null
+++ b/jodatime/src/test/resources/META-INF/javaconfig.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# The space before the actual date is intended!
+dateTimeValue= 2010-08-08T14:00:15.5+10:00
+dateTimeZoneValueA=UTC
+dateTimeZoneValueB=+01:00
+periodValueA=P1Y1M1W1DT1H1M1S

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/117c0a91/jodatime/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/jodatime/src/test/resources/META-INF/javaconfiguration.properties 
b/jodatime/src/test/resources/META-INF/javaconfiguration.properties
deleted file mode 100644
index e66e448..0000000
--- a/jodatime/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.
-
-# The space before the actual date is intended!
-dateTimeValue= 2010-08-08T14:00:15.5+10:00
-dateTimeZoneValueA=UTC
-dateTimeZoneValueB=+01:00
-periodValueA=P1Y1M1W1DT1H1M1S


Reply via email to