tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [2/2] incubator-tamaya git commit: TAMAYA-91 Added integration test
Date Thu, 10 Mar 2016 22:22:43 GMT
TAMAYA-91 Added integration test


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

Branch: refs/heads/master
Commit: 44354af19c54771da090f380ee2667cef7eee5ce
Parents: 231ad17
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Thu Mar 10 23:22:38 2016 +0100
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Thu Mar 10 23:22:38 2016 +0100

----------------------------------------------------------------------
 .../org/apache/tamaya/jodatime/FullStackIT.java | 22 ++++++++++++++++++++
 .../META-INF/javaconfiguration.properties       |  1 +
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/44354af1/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
----------------------------------------------------------------------
diff --git a/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java b/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
index d046a71..60d8cbc 100644
--- a/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
+++ b/sandbox/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
@@ -20,11 +20,17 @@ 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 java.util.Locale;
+
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -62,4 +68,20 @@ public class FullStackIT {
         assertThat(zoneBAsString, equalTo("+01:00"));
         assertThat(zoneB, equalTo(DateTimeZone.forOffsetHours(1)));
     }
+
+    @Test
+    public void retrievePeriodValueFromConfiguration() {
+        Configuration configuration = ConfigurationProvider.getConfiguration();
+
+        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);
+
+        assertThat(periodAsString, equalTo("P1Y1M1W1DT1H1M1S"));
+        assertThat(period, equalTo(referenceValue.toPeriod()));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/44354af1/sandbox/jodatime/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/sandbox/jodatime/src/test/resources/META-INF/javaconfiguration.properties b/sandbox/jodatime/src/test/resources/META-INF/javaconfiguration.properties
index daf763a..e66e448 100644
--- a/sandbox/jodatime/src/test/resources/META-INF/javaconfiguration.properties
+++ b/sandbox/jodatime/src/test/resources/META-INF/javaconfiguration.properties
@@ -19,3 +19,4 @@
 dateTimeValue= 2010-08-08T14:00:15.5+10:00
 dateTimeZoneValueA=UTC
 dateTimeZoneValueB=+01:00
+periodValueA=P1Y1M1W1DT1H1M1S


Mime
View raw message