You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2014/12/13 09:48:05 UTC
incubator-tamaya git commit: TAMAYA-3: Fixed compile issues.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 79c6e7f81 -> 1af5a7db6
TAMAYA-3: Fixed compile issues.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/1af5a7db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/1af5a7db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/1af5a7db
Branch: refs/heads/master
Commit: 1af5a7db655d675ee46491ed9b288e647d8f9319
Parents: 79c6e7f
Author: anatole <an...@apache.org>
Authored: Sat Dec 13 09:47:58 2014 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Dec 13 09:47:58 2014 +0100
----------------------------------------------------------------------
.../java/metamodel/ext/cdi/ConfiguredClass.java | 132 -------------------
.../java/metamodel/ext/cdi/ConfiguredTest.java | 52 --------
.../metamodel/ext/cdi/TestConfigProvider.java | 65 ---------
.../tamaya/integration/cdi/ConfiguredClass.java | 132 +++++++++++++++++++
.../tamaya/integration/cdi/ConfiguredTest.java | 52 ++++++++
.../integration/cdi/TestConfigProvider.java | 69 ++++++++++
6 files changed, 253 insertions(+), 249 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredClass.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredClass.java b/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredClass.java
deleted file mode 100644
index 823b472..0000000
--- a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredClass.java
+++ /dev/null
@@ -1,132 +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.
- *
- */
-package main.java.metamodel.ext.cdi;
-
-import org.apache.tamaya.annotation.ObservesConfigChange;
-import org.apache.tamaya.annotation.ConfiguredProperty;
-import org.apache.tamaya.annotation.DefaultValue;
-import org.apache.tamaya.annotation.WithConfig;
-
-import javax.inject.Singleton;
-import java.beans.PropertyChangeEvent;
-import java.math.BigDecimal;
-
-/**
- * Created by Anatole on 08.09.2014.
- */
-@Singleton
-public class ConfiguredClass{
-
- @WithConfig("test")
- @ConfiguredProperty
- private String testProperty;
-
- @ConfiguredProperty("a.b.c.key1")
- @ConfiguredProperty("a.b.c.key2")
- @ConfiguredProperty("a.b.c.key3")
- @DefaultValue("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
- String value1;
-
- @WithConfig("test")
- @ConfiguredProperty("foo")
- @ConfiguredProperty("a.b.c.key2")
- private String value2;
-
- @ConfiguredProperty
- @DefaultValue("N/A")
- private String runtimeVersion;
-
- @ConfiguredProperty
- @DefaultValue("${sys:java.version}")
- private String javaVersion2;
-
- @ConfiguredProperty
- @DefaultValue("5")
- private Integer int1;
-
- @WithConfig("test")
- @ConfiguredProperty
- private int int2;
-
- @WithConfig("test")
- @ConfiguredProperty
- private boolean booleanT;
-
- @WithConfig("test")
- @ConfiguredProperty("BD")
- private BigDecimal bigNumber;
-
- @WithConfig("test")
- @ConfiguredProperty("double1")
- private double doubleValue;
-
- @ObservesConfigChange
- public void changeListener1(PropertyChangeEvent configChange){
- // will be called
- }
-
- public String getTestProperty() {
- return testProperty;
- }
-
- public String getValue1() {
- return value1;
- }
-
- public String getValue2() {
- return value2;
- }
-
- public String getRuntimeVersion() {
- return runtimeVersion;
- }
-
- public String getJavaVersion2() {
- return javaVersion2;
- }
-
- public Integer getInt1() {
- return int1;
- }
-
- public int getInt2() {
- return int2;
- }
-
- public boolean isBooleanT() {
- return booleanT;
- }
-
- public BigDecimal getBigNumber() {
- return bigNumber;
- }
-
- public double getDoubleValue() {
- return doubleValue;
- }
-
- public String toString(){
- return super.toString() + ": testProperty="+testProperty+", value1="+value1+", value2="+value2
- +", int1="+int1+", int2="+int2+", booleanT="+booleanT+", bigNumber="+bigNumber
- +", runtimeVersion="+runtimeVersion+", javaVersion2="+javaVersion2;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredTest.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredTest.java b/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredTest.java
deleted file mode 100644
index 5f09194..0000000
--- a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/ConfiguredTest.java
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
-package main.java.metamodel.ext.cdi;
-
-import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
-import org.hamcrest.MatcherAssert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.enterprise.inject.spi.CDI;
-
-import static org.hamcrest.core.Is.is;
-
-/**
- * Created by Anatole on 08.09.2014.
- */
-@RunWith(CdiTestRunner.class)
-public class ConfiguredTest{
-
- @Ignore
- @Test
- public void testInjection(){
- ConfiguredClass item = CDI.current().select(ConfiguredClass.class).get();
- System.out.println("********************************************");
- System.out.println(item);
- System.out.println("********************************************");
-
- double actual = 1234.5678;
-
- MatcherAssert.assertThat(item.getDoubleValue(), is(actual));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/TestConfigProvider.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/TestConfigProvider.java b/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/TestConfigProvider.java
deleted file mode 100644
index c345929..0000000
--- a/modules/integration/cdi/src/test/java/main/java/metamodel/ext/cdi/TestConfigProvider.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 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.
- */
-package main.java.metamodel.ext.cdi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.MetaInfoBuilder;
-import org.apache.tamaya.PropertyProviderBuilder;
-import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by Anatole on 29.09.2014.
- */
-public class TestConfigProvider implements ConfigurationProviderSpi
-{
-
- private Configuration testConfig;
-
- public TestConfigProvider(){
- final Map<String,String> config = new HashMap<>();
- config.put("a.b.c.key1", "value current a.b.c.key1");
- config.put("a.b.c.key2", "value current a.b.c.key2");
- config.put("a.b.key3", "value current a.b.key3");
- config.put("a.b.key4", "value current a.b.key4");
- config.put("a.key5", "value current a.key5");
- config.put("a.key6", "value current a.key6");
- config.put("int1", "123456");
- config.put("int2", "111222");
- config.put("testProperty", "testPropertyValue!");
- config.put("booleanT", "true");
- config.put("double1", "1234.5678");
- config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789");
- config.put("testProperty", "value current testProperty");
- config.put("runtimeVersion", "${java.version}");
- testConfig = PropertyProviderBuilder.create("test").addMap(config).build().toConfiguration();
- }
-
- @Override
- public String getConfigName(){
- return "test";
- }
-
- @Override
- public Configuration getConfiguration(){
- return testConfig;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
new file mode 100644
index 0000000..20dfa71
--- /dev/null
+++ b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.tamaya.annotation.ObservesConfigChange;
+import org.apache.tamaya.annotation.ConfiguredProperty;
+import org.apache.tamaya.annotation.DefaultValue;
+import org.apache.tamaya.annotation.WithConfig;
+
+import javax.inject.Singleton;
+import java.beans.PropertyChangeEvent;
+import java.math.BigDecimal;
+
+/**
+ * Created by Anatole on 08.09.2014.
+ */
+@Singleton
+public class ConfiguredClass{
+
+ @WithConfig("test")
+ @ConfiguredProperty
+ private String testProperty;
+
+ @ConfiguredProperty("a.b.c.key1")
+ @ConfiguredProperty("a.b.c.key2")
+ @ConfiguredProperty("a.b.c.key3")
+ @DefaultValue("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
+ String value1;
+
+ @WithConfig("test")
+ @ConfiguredProperty("foo")
+ @ConfiguredProperty("a.b.c.key2")
+ private String value2;
+
+ @ConfiguredProperty
+ @DefaultValue("N/A")
+ private String runtimeVersion;
+
+ @ConfiguredProperty
+ @DefaultValue("${sys:java.version}")
+ private String javaVersion2;
+
+ @ConfiguredProperty
+ @DefaultValue("5")
+ private Integer int1;
+
+ @WithConfig("test")
+ @ConfiguredProperty
+ private int int2;
+
+ @WithConfig("test")
+ @ConfiguredProperty
+ private boolean booleanT;
+
+ @WithConfig("test")
+ @ConfiguredProperty("BD")
+ private BigDecimal bigNumber;
+
+ @WithConfig("test")
+ @ConfiguredProperty("double1")
+ private double doubleValue;
+
+ @ObservesConfigChange
+ public void changeListener1(PropertyChangeEvent configChange){
+ // will be called
+ }
+
+ public String getTestProperty() {
+ return testProperty;
+ }
+
+ public String getValue1() {
+ return value1;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public String getRuntimeVersion() {
+ return runtimeVersion;
+ }
+
+ public String getJavaVersion2() {
+ return javaVersion2;
+ }
+
+ public Integer getInt1() {
+ return int1;
+ }
+
+ public int getInt2() {
+ return int2;
+ }
+
+ public boolean isBooleanT() {
+ return booleanT;
+ }
+
+ public BigDecimal getBigNumber() {
+ return bigNumber;
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public String toString(){
+ return super.toString() + ": testProperty="+testProperty+", value1="+value1+", value2="+value2
+ +", int1="+int1+", int2="+int2+", booleanT="+booleanT+", bigNumber="+bigNumber
+ +", runtimeVersion="+runtimeVersion+", javaVersion2="+javaVersion2;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
new file mode 100644
index 0000000..376df10
--- /dev/null
+++ b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.hamcrest.MatcherAssert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.enterprise.inject.spi.CDI;
+
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Created by Anatole on 08.09.2014.
+ */
+@RunWith(CdiTestRunner.class)
+public class ConfiguredTest{
+
+ @Ignore
+ @Test
+ public void testInjection(){
+ ConfiguredClass item = CDI.current().select(ConfiguredClass.class).get();
+ System.out.println("********************************************");
+ System.out.println(item);
+ System.out.println("********************************************");
+
+ double actual = 1234.5678;
+
+ MatcherAssert.assertThat(item.getDoubleValue(), is(actual));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1af5a7db/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/TestConfigProvider.java
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/TestConfigProvider.java b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/TestConfigProvider.java
new file mode 100644
index 0000000..8ab08ae
--- /dev/null
+++ b/modules/integration/cdi/src/test/java/org/apache/tamaya/integration/cdi/TestConfigProvider.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.tamaya.integration.cdi;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Anatole on 29.09.2014.
+ */
+public class TestConfigProvider implements ConfigurationProviderSpi
+{
+
+ private Configuration testConfig;
+
+ public TestConfigProvider(){
+ final Map<String,String> config = new HashMap<>();
+ config.put("a.b.c.key1", "value current a.b.c.key1");
+ config.put("a.b.c.key2", "value current a.b.c.key2");
+ config.put("a.b.key3", "value current a.b.key3");
+ config.put("a.b.key4", "value current a.b.key4");
+ config.put("a.key5", "value current a.key5");
+ config.put("a.key6", "value current a.key6");
+ config.put("int1", "123456");
+ config.put("int2", "111222");
+ config.put("testProperty", "testPropertyValue!");
+ config.put("booleanT", "true");
+ config.put("double1", "1234.5678");
+ config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789");
+ config.put("testProperty", "value current testProperty");
+ config.put("runtimeVersion", "${java.version}");
+ testConfig = PropertySourceBuilder.create("test").addMap(config).build().toConfiguration();
+ }
+
+ @Override
+ public String getConfigName(){
+ return "test";
+ }
+
+ @Override
+ public Configuration getConfiguration(){
+ return testConfig;
+ }
+
+ @Override
+ public void reload() {
+
+ }
+}