[2/2] incubator-tamaya git commit: TAMAYA-87 Implemeted support for org.joda.time.DateTimeZone.

2016-03-06 Thread plexus
TAMAYA-87 Implemeted support for org.joda.time.DateTimeZone.


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

Branch: refs/heads/master
Commit: 80ece9835c210c23cb0c5dcec79bb3fb9af8bbab
Parents: e4971a1
Author: Oliver B. Fischer 
Authored: Sun Mar 6 23:24:01 2016 +0100
Committer: Oliver B. Fischer 
Committed: Sun Mar 6 23:24:01 2016 +0100

--
 .../tamaya/jodatime/DateTimeZoneConverter.java  | 22 +---
 .../jodatime/DateTimeZoneConverterTest.java | 20 ++
 2 files changed, 35 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/80ece983/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
--
diff --git 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
index bf18393..198a345 100644
--- 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
+++ 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
@@ -26,14 +26,25 @@ import java.util.regex.Pattern;
 
 import static java.util.Objects.requireNonNull;
 
+/**
+ * Converter, converting from {@code String} to Joda-Time's
+ * {@code DateTimeZone}.
+ *
+ * This converter supports the conversion from a numerich time zone
+ * information in the format {@code [+-]hh:mm} as well as from
+ * all time zone ids supported by Joda Time.
+ *
+ * @see DateTimeZone
+ * @see DateTimeZone#getAvailableIDs()
+ */
 public class DateTimeZoneConverter implements PropertyConverter {
-private static final Pattern IS_INTEGER_VALUE = 
Pattern.compile("(\\+|-)?\\d+");
+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) {
-if (true == true) throw new RuntimeException("Method must catch up 
with the current API!");
-
 String trimmed = requireNonNull(value).trim();
+addSupportedFormats(context);
 
 DateTimeZone result = null;
 
@@ -52,6 +63,11 @@ public class DateTimeZoneConverter implements 
PropertyConverter {
 return result;
 }
 
+private void addSupportedFormats(ConversionContext context) {
+context.addSupportedFormats(DateTimeZoneConverter.class, "Time zone in 
the form [+-]hh:mm via the regex " + PATTERN_REGEX);
+context.addSupportedFormats(DateTimeZoneConverter.class, "All time 
zone ids supported by Joda Time");
+}
+
 private boolean isSingleIntegerValue(String value) {
 boolean match = IS_INTEGER_VALUE.matcher(value).matches();
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/80ece983/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
--
diff --git 
a/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
 
b/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
index 6620044..babbe06 100644
--- 
a/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
+++ 
b/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
@@ -18,7 +18,9 @@
  */
 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.joda.time.DateTimeZone;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -28,11 +30,13 @@ import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasSize;
 
 public class DateTimeZoneConverterTest {
 private DateTimeZoneConverter converter = new DateTimeZoneConverter();
 
-@Ignore
 @Test
 public void canConvertDateTimeZoneInformation() {
 Object[][] inputResultPairs = {
@@ -63,7 +67,6 @@ public class DateTimeZoneConverterTest {
 }
 }
 
-@Ignore
 @Test
 public void invalidInputValuesResultInReturningNull() {
 String[] 

incubator-tamaya git commit: TAMAYA-72 Adapted the API of the Joda Time module to the current API of Tamaya. Tests must be adapted.

2016-03-06 Thread plexus
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 64b7c249b -> de34e67ad


TAMAYA-72 Adapted the API of the Joda Time module to the current API of Tamaya. 
Tests must be adapted.


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

Branch: refs/heads/master
Commit: de34e67ad09591b6335f656bb2d8518d2b8ae645
Parents: 64b7c24
Author: Oliver B. Fischer 
Authored: Sun Mar 6 12:56:05 2016 +0100
Committer: Oliver B. Fischer 
Committed: Sun Mar 6 12:56:05 2016 +0100

--
 sandbox/jodatime/pom.xml  |  6 ++
 .../apache/tamaya/jodatime/DateTimeConverter.java |  5 -
 .../tamaya/jodatime/DateTimeZoneConverter.java|  5 -
 .../apache/tamaya/jodatime/PeriodConverter.java   |  8 +---
 .../tamaya/jodatime/DateTimeConverterIT.java  | 17 -
 .../tamaya/jodatime/DateTimeConverterTest.java| 16 ++--
 .../tamaya/jodatime/DateTimeZoneConverterIT.java  | 16 +++-
 .../jodatime/DateTimeZoneConverterTest.java   | 18 --
 .../tamaya/jodatime/PeriodConverterTest.java  | 13 -
 9 files changed, 84 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/de34e67a/sandbox/jodatime/pom.xml
--
diff --git a/sandbox/jodatime/pom.xml b/sandbox/jodatime/pom.xml
index 13d7c29..71ffc7a 100644
--- a/sandbox/jodatime/pom.xml
+++ b/sandbox/jodatime/pom.xml
@@ -65,6 +65,12 @@ under the License.
 
 
 
+org.mockito
+mockito-core
+test
+
+
+
 org.hamcrest
 java-hamcrest
 test

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/de34e67a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
--
diff --git 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
index 2de2e5b..f584f76 100644
--- 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
+++ 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeConverter.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
+import org.apache.tamaya.spi.ConversionContext;
 import org.apache.tamaya.spi.PropertyConverter;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormat;
@@ -73,7 +74,9 @@ public class DateTimeConverter implements 
PropertyConverter {
 }
 
 @Override
-public DateTime convert(String value) {
+public DateTime convert(String value, ConversionContext context) {
+if (true == true) throw new RuntimeException("Method must catch up 
with the current API!");
+
 String trimmed = Objects.requireNonNull(value).trim();
 DateTime result = null;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/de34e67a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
--
diff --git 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
index 72b523b..bf18393 100644
--- 
a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
+++ 
b/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/DateTimeZoneConverter.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.jodatime;
 
+import org.apache.tamaya.spi.ConversionContext;
 import org.apache.tamaya.spi.PropertyConverter;
 import org.joda.time.DateTimeZone;
 
@@ -29,7 +30,9 @@ public class DateTimeZoneConverter implements 
PropertyConverter {
 private static final Pattern IS_INTEGER_VALUE = 
Pattern.compile("(\\+|-)?\\d+");
 
 @Override
-public DateTimeZone convert(String value) {
+public DateTimeZone convert(String value, ConversionContext context) {
+if (true == true) throw new RuntimeException("Method must catch up 
with the current API!");
+
 String trimmed = requireNonNull(value).trim();
 
 DateTimeZone result = null;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/de34e67a/sandbox/jodatime/src/main/java/org/apache/tamaya/jodatime/PeriodConverter.java
--
diff --git