You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by po...@apache.org on 2017/10/21 19:57:27 UTC
[4/4] incubator-tamaya-extensions git commit: TAMAYA-294: Add unicode
test case, update deps
TAMAYA-294: Add unicode test case, update deps
Johnzon update does not work and Injection tests fail locally as on Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/7184ac59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/7184ac59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/7184ac59
Branch: refs/heads/master
Commit: 7184ac59ec974b62a463ff111890cc6ed99a8330
Parents: 8d38122
Author: Phil Ottlinger <po...@apache.org>
Authored: Sat Oct 21 21:56:57 2017 +0200
Committer: Phil Ottlinger <po...@apache.org>
Committed: Sat Oct 21 21:56:57 2017 +0200
----------------------------------------------------------------------
.../yaml/CommonJSONTestCaseCollection.java | 54 ++++++++++++--------
.../tamaya/yaml/JSONPropertySourceTest.java | 13 +++--
.../src/test/resources/configs/valid/kanji.json | 21 ++++++++
pom.xml | 3 +-
4 files changed, 62 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/7184ac59/modules/formats/json/src/test/java/org/apache/tamaya/yaml/CommonJSONTestCaseCollection.java
----------------------------------------------------------------------
diff --git a/modules/formats/json/src/test/java/org/apache/tamaya/yaml/CommonJSONTestCaseCollection.java b/modules/formats/json/src/test/java/org/apache/tamaya/yaml/CommonJSONTestCaseCollection.java
index 1d93d20..e1f94cf 100644
--- a/modules/formats/json/src/test/java/org/apache/tamaya/yaml/CommonJSONTestCaseCollection.java
+++ b/modules/formats/json/src/test/java/org/apache/tamaya/yaml/CommonJSONTestCaseCollection.java
@@ -18,7 +18,15 @@
*/
package org.apache.tamaya.yaml;
-import org.apache.tamaya.ConfigException;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URL;
+
import org.apache.tamaya.spi.PropertySource;
import org.apache.tamaya.spi.PropertyValue;
import org.apache.tamaya.spisupport.PropertySourceComparator;
@@ -26,16 +34,6 @@ import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.junit.Test;
-import java.io.IOException;
-import java.net.URL;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertTrue;
-
/**
* Class with a collection of common test cases each JSON processing
* class must be able to pass.
@@ -46,7 +44,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test
public void canReadNonLatinCharacters() throws Exception {
- URL configURL = JSONPropertySourceTest.class
+ URL configURL = CommonJSONTestCaseCollection.class
.getResource("/configs/valid/cyrillic.json");
assertThat(configURL, Matchers.notNullValue());
@@ -60,8 +58,22 @@ public abstract class CommonJSONTestCaseCollection {
}
@Test
+ public void canReadUnicodeCharacters() throws Exception {
+ URL configURL = CommonJSONTestCaseCollection.class
+ .getResource("/configs/valid/kanji.json");
+
+ assertThat(configURL, Matchers.notNullValue());
+
+ PropertySource propertySource = getPropertiesFrom(configURL);
+
+ assertThat(propertySource.get("onamae"), Matchers.notNullValue());
+ // 霊屋 = Tamaya
+ assertThat(propertySource.get("onamae").getValue(), equalTo("\u970a\u5c4b"));
+ }
+
+ @Test
public void canReadNestedStringOnlyJSONConfigFile2() throws Exception {
- URL configURL = JSONPropertySourceTest.class
+ URL configURL = CommonJSONTestCaseCollection.class
.getResource("/configs/valid/simple-nested-string-only-config-1.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -85,7 +97,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test
public void canReadNestedStringOnlyJSONConfigFileWithObjectInTheMiddle()
throws Exception {
- URL configURL = JSONPropertySourceTest.class
+ URL configURL = CommonJSONTestCaseCollection.class
.getResource("/configs/valid/simple-nested-string-only-config-2.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -111,7 +123,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test(expected = IOException.class)
public void canHandleIllegalJSONFileWhichContainsAnArray() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/invalid/with-array.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/invalid/with-array.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -120,7 +132,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test(expected = IOException.class)
public void canHandleIllegalJSONFileConsistingOfOneOpeningBracket() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/invalid/only-opening-bracket.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/invalid/only-opening-bracket.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -129,7 +141,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test(expected = IOException.class)
public void canHandleIllegalJSONFileWhichIsEmpty() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/invalid/empty-file.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/invalid/empty-file.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -138,7 +150,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test
public void priorityInConfigFileOverwriteExplicitlyGivenPriority() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/valid/with-explicit-priority.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/valid/with-explicit-priority.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -149,7 +161,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test
public void canReadFlatStringOnlyJSONConfigFile() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/valid/simple-flat-string-only-config.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/valid/simple-flat-string-only-config.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -171,7 +183,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test(expected = IOException.class)
public void emptyJSONFileResultsInConfigException() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/invalid/empty-file.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/invalid/empty-file.json");
assertThat(configURL, CoreMatchers.notNullValue());
@@ -182,7 +194,7 @@ public abstract class CommonJSONTestCaseCollection {
@Test
public void canHandleEmptyJSONObject() throws Exception {
- URL configURL = JSONPropertySourceTest.class.getResource("/configs/valid/empty-object-config.json");
+ URL configURL = CommonJSONTestCaseCollection.class.getResource("/configs/valid/empty-object-config.json");
assertThat(configURL, CoreMatchers.notNullValue());
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/7184ac59/modules/formats/json/src/test/java/org/apache/tamaya/yaml/JSONPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/formats/json/src/test/java/org/apache/tamaya/yaml/JSONPropertySourceTest.java b/modules/formats/json/src/test/java/org/apache/tamaya/yaml/JSONPropertySourceTest.java
index e2cd404..0555bb8 100644
--- a/modules/formats/json/src/test/java/org/apache/tamaya/yaml/JSONPropertySourceTest.java
+++ b/modules/formats/json/src/test/java/org/apache/tamaya/yaml/JSONPropertySourceTest.java
@@ -18,17 +18,16 @@
*/
package org.apache.tamaya.yaml;
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.json.JSONPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.net.URL;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import org.apache.tamaya.json.JSONPropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
public class JSONPropertySourceTest extends CommonJSONTestCaseCollection {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/7184ac59/modules/formats/json/src/test/resources/configs/valid/kanji.json
----------------------------------------------------------------------
diff --git a/modules/formats/json/src/test/resources/configs/valid/kanji.json b/modules/formats/json/src/test/resources/configs/valid/kanji.json
new file mode 100644
index 0000000..3ba1b77
--- /dev/null
+++ b/modules/formats/json/src/test/resources/configs/valid/kanji.json
@@ -0,0 +1,21 @@
+/*
+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.
+*/
+{
+ "onamae" : "霊屋"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/7184ac59/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f5ea9f5..0b7497d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,8 @@ under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<json.spec.version>1.0-alpha-1</json.spec.version>
- <johnzon.version>1.1.4</johnzon.version>
+ <!--johnzon.version>1.1.4</johnzon.version-->
+ <johnzon.version>0.9-incubating</johnzon.version>
<junit.version>4.12</junit.version>
<assertj.version>3.8.0</assertj.version>