You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by jo...@apache.org on 2017/09/21 03:06:42 UTC
[1/2] incubator-tamaya-sandbox git commit: TAMAYA-260 - Removing code
copied in from MicroProfile Config 1.1
Repository: incubator-tamaya-sandbox
Updated Branches:
refs/heads/TAMAYA-260-mp-11 [created] 73839b317
TAMAYA-260 - Removing code copied in from MicroProfile Config 1.1
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/20f54006
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/20f54006
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/20f54006
Branch: refs/heads/TAMAYA-260-mp-11
Commit: 20f540066cf64ad97fa374139b9d8f7e99b962a0
Parents: 99ce49e
Author: John D. Ament <jo...@gmail.com>
Authored: Wed Sep 20 23:03:49 2017 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Wed Sep 20 23:03:49 2017 -0400
----------------------------------------------------------------------
.../AutoDiscoveredConfigSourceTest.java | 66 -----
.../imported/CDIPlainInjectionTest.java | 261 -------------------
.../imported/CdiOptionalInjectionTest.java | 69 -----
.../imported/ConfigProviderTest.java | 122 ---------
.../microprofile/imported/ConverterTest.java | 233 -----------------
.../imported/CustomConfigSourceTest.java | 40 ---
.../imported/OptionalValuesBean.java | 62 -----
.../imported/broken/ConfigOwner.java | 39 ---
.../imported/broken/CustomConverterBean.java | 46 ----
.../CustomConfigSourceProvider.java | 53 ----
.../configsources/CustomDbConfigSource.java | 69 -----
.../configsources/SampleYamlConfigSource.java | 58 -----
.../microprofile/imported/converters/Duck.java | 36 ---
.../imported/converters/DuckConverter.java | 33 ---
.../microprofile/imported/converters/Pizza.java | 42 ---
.../imported/converters/PizzaConverter.java | 34 ---
.../imported/matchers/AdditionalMatchers.java | 61 -----
...eclipse.microprofile.config.spi.ConfigSource | 19 --
...microprofile.config.spi.ConfigSourceProvider | 18 --
...rg.eclipse.microprofile.config.spi.Converter | 18 --
20 files changed, 1379 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/AutoDiscoveredConfigSourceTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/AutoDiscoveredConfigSourceTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/AutoDiscoveredConfigSourceTest.java
deleted file mode 100644
index 57cbc5d..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/AutoDiscoveredConfigSourceTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *******************************************************************************/
-package org.apache.tamaya.microprofile.imported;
-
-import org.apache.tamaya.microprofile.imported.converters.Pizza;
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.logging.Logger;
-
-/**
- * Verify the method addDiscoveredSources() on ConfigBuilder.
- *
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class AutoDiscoveredConfigSourceTest {
-
- @Test
- public void testAutoDiscoveredConfigureSources() {
- Config config = ConfigProviderResolver.instance().getBuilder().addDefaultSources().addDiscoveredSources().build();
- Assert.assertEquals(config.getValue("tck.config.test.customDbConfig.key1", String.class), "valueFromDb1");
- }
-
- @Test
- public void testAutoDiscoveredConverterManuallyAdded() {
-
- Config config = ConfigProviderResolver.instance().getBuilder().addDefaultSources().addDiscoveredSources().addDiscoveredConverters().build();
- Pizza dVaule = config.getValue("tck.config.test.customDbConfig.key3", Pizza.class);
- Assert.assertEquals(dVaule.getSize(), "big");
- Assert.assertEquals(dVaule.getFlavor(), "cheese");
- }
-
- @Test
- public void testAutoDiscoveredConverterNotAddedAutomatically() {
- Config config = ConfigProviderResolver.instance().getBuilder().addDefaultSources().addDiscoveredSources().build();
- try {
- // Pizza is too simple, so Tamaya find's a way to construct it.
- Pizza dVaule = config.getValue("tck.config.test.customDbConfig.key3", Pizza.class);
- System.out.println("WARNING: The auto discovered converter should not be added automatically.");
- }
- catch (Exception e) {
- Assert.assertTrue( e instanceof IllegalArgumentException);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CDIPlainInjectionTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CDIPlainInjectionTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CDIPlainInjectionTest.java
deleted file mode 100644
index e3b137e..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CDIPlainInjectionTest.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- */
-
-package org.apache.tamaya.microprofile.imported;
-
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Classes;
-import org.apache.openejb.testing.Module;
-import org.apache.tamaya.microprofile.cdi.*;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-import org.eclipse.microprofile.config.spi.ConfigSource;
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-import javax.inject.Provider;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test cases for CDI-based API that test retrieving values from the configuration.
- * The tests depend only on CDI 1.2.
- * @author Ondrej Mihalyi
- */
-@RunWith(ApplicationComposer.class)
-public class CDIPlainInjectionTest{
-
- private static final String DEFAULT_PROPERTY_BEAN_KEY =
- "org.apache.tamaya.microprofile.imported.CDIPlainInjectionTest.defaultPropertyBean.configProperty";
-
- static{
- System.setProperty("my.string.property", "text");
- System.setProperty("my.boolean.property", "true");
- System.setProperty("my.int.property", "5");
- System.setProperty("my.long.property", "10");
- System.setProperty("my.float.property", "10.5");
- System.setProperty("my.double.property", "11.5");
- System.setProperty(DEFAULT_PROPERTY_BEAN_KEY, "pathConfigValue");
- }
-
- @Inject
- private Instance<Object> instance;
-
- @Module
- @Classes(cdi = true, value = {
- SimpleValuesBean.class, DynamicValuesBean.class, DefaultPropertyBean.class,
- MicroprofileCDIExtension.class,
- MicroprofileConfigurationProducer.class,
- ConfiguredType.class, ConfiguredMethod.class, ConfiguredField.class,
- })
- public EjbJar jar() {
- ensure_all_property_values_are_defined();
- return new EjbJar("config");
- }
-
-
- @Test
- public void can_inject_simple_values_when_defined() {
- ensure_all_property_values_are_defined();
-
- SimpleValuesBean bean = getBeanOfType(SimpleValuesBean.class);
-
- assertThat(bean.stringProperty, is(equalTo("text")));
- assertThat(bean.booleanProperty, is(true));
- assertThat(bean.intProperty, is(equalTo(5)));
- assertThat(bean.longProperty, is(equalTo(10L)));
- assertEquals(bean.floatProperty, 10.5f, 0.1f);
- assertThat(bean.doubleProperty, is(closeTo(11.5, 0.1)));
-
- assertThat(bean.booleanObjProperty, is(true));
- assertThat(bean.integerProperty, is(equalTo(5)));
- assertThat(bean.longObjProperty, is(equalTo(10L)));
- assertEquals(bean.floatObjProperty, 10.5f, 0.1f);
- assertThat(bean.doubleObjProperty, is(closeTo(11.5, 0.1)));
-
- assertThat(bean.doublePropertyWithDefaultValue, is(closeTo(3.1415, 0.1)));
- }
-
- @Test
- public void can_inject_dynamic_values_via_CDI_provider() {
- clear_all_property_values();
-
- DynamicValuesBean bean = getBeanOfType(DynamicValuesBean.class);
-
- //X TODO clarify how Provider<T> should behave for missing values assertThat(bean.getIntProperty(), is(nullValue()));
-
- ensure_all_property_values_are_defined();
-
- assertThat(bean.getIntProperty(), is(equalTo(5)));
- }
-
- @Test
- public void can_inject_default_property_path() {
- clear_all_property_values();
-
- ensure_all_property_values_are_defined();
-
- DefaultPropertyBean bean = getBeanOfType(DefaultPropertyBean.class);
-
- assertThat(bean.getConfigProperty(), is(equalTo("pathConfigValue")));
- }
-
- private void ensure_all_property_values_are_defined() {
- System.setProperty("my.string.property", "text");
- System.setProperty("my.boolean.property", "true");
- System.setProperty("my.int.property", "5");
- System.setProperty("my.long.property", "10");
- System.setProperty("my.float.property", "10.5");
- System.setProperty("my.double.property", "11.5");
- System.setProperty(DEFAULT_PROPERTY_BEAN_KEY, "pathConfigValue");
- }
-
- @After
- public void clear_all_property_values() {
- System.getProperties().remove("my.string.property");
- System.getProperties().remove("my.boolean.property");
- System.getProperties().remove("my.int.property");
- System.getProperties().remove("my.long.property");
- System.getProperties().remove("my.float.property");
- System.getProperties().remove("my.double.property");
- System.getProperties().remove(DEFAULT_PROPERTY_BEAN_KEY);
- }
-
- private <T> T getBeanOfType(Class<T> beanClass) {
- return instance.select(beanClass).get();
- }
-
- @Dependent
- public static class SimpleValuesBean {
-
- @Inject
- @ConfigProperty(name="my.string.property")
- private String stringProperty;
-
- @Inject
- @ConfigProperty(name="my.boolean.property")
- private Boolean booleanObjProperty;
-
- @Inject
- @ConfigProperty(name="my.boolean.property")
- private boolean booleanProperty;
-
- @Inject
- @ConfigProperty(name="my.int.property")
- private Integer integerProperty;
-
- @Inject
- @ConfigProperty(name="my.int.property")
- private int intProperty;
-
- @Inject
- @ConfigProperty(name="my.long.property")
- private Long longObjProperty;
-
- @Inject
- @ConfigProperty(name="my.long.property")
- private long longProperty;
-
- @Inject
- @ConfigProperty(name="my.float.property")
- private Float floatObjProperty;
-
- @Inject
- @ConfigProperty(name="my.float.property")
- private float floatProperty;
-
- @Inject
- @ConfigProperty(name="my.double.property")
- private Double doubleObjProperty;
-
- @Inject
- @ConfigProperty(name="my.double.property")
- private double doubleProperty;
-
- // the property is not configured in any ConfigSource but its defaultValue will
- // be used to set the field.
- @Inject
- @ConfigProperty(name="my.not.configured.double.property", defaultValue = "3.1415")
- private Double doublePropertyWithDefaultValue;
-
- }
-
- @Dependent
- public static class DynamicValuesBean {
-
- @Inject
- @ConfigProperty(name="my.int.property")
- private Provider<Integer> intPropertyProvider;
-
- public Integer getIntProperty() {
- return intPropertyProvider.get();
- }
-
- }
-
- @Dependent
- public static class DefaultPropertyBean {
- @Inject
- @ConfigProperty
- private String configProperty;
-
- public String getConfigProperty() {
- return configProperty;
- }
- }
-
- public static class TestConfigSource implements ConfigSource {
-
- private Map<String, String> properties;
-
- public TestConfigSource() {
- properties = new HashMap<>();
- properties.put("my.string.property", "text");
- properties.put("my.boolean.property", "true");
- properties.put("my.int.property", "5");
- properties.put("my.long.property", "10");
- properties.put("my.float.property", "10.5");
- properties.put("my.double.property", "11.5");
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public String getValue(String propertyName) {
- return properties.get(propertyName);
- }
-
- @Override
- public String getName() {
- return this.getClass().getName();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java
deleted file mode 100644
index e156644..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CdiOptionalInjectionTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported;
-
-import org.apache.deltaspike.testcontrol.api.TestControl;
-import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Classes;
-import org.apache.openejb.testing.Module;
-import org.apache.tamaya.microprofile.cdi.MicroprofileCDIExtension;
-import org.apache.tamaya.microprofile.cdi.MicroprofileConfigurationProducer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- * Verify injection of {@code Optional<T>} fields.
- *
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-@RunWith(ApplicationComposer.class)
-public class CdiOptionalInjectionTest{
-
- @Module
- @Classes(cdi = true, value = {
- OptionalValuesBean.class,
- MicroprofileCDIExtension.class,
- MicroprofileConfigurationProducer.class
- })
- public EjbJar jar() {
- return new EjbJar("config");
- }
-
- private @Inject OptionalValuesBean optionalValuesBean;
-
- @Test
- public void testOptionalInjection() {
- Assert.assertTrue(optionalValuesBean.getIntProperty().isPresent());
- Assert.assertEquals(optionalValuesBean.getIntProperty().get(), Integer.valueOf(1234));
-
- Assert.assertFalse(optionalValuesBean.getNotexistingProperty().isPresent());
-
- Assert.assertTrue(optionalValuesBean.getStringValue().isPresent());
- Assert.assertEquals(optionalValuesBean.getStringValue().get(), "hello");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConfigProviderTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConfigProviderTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConfigProviderTest.java
deleted file mode 100644
index d7368ea..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConfigProviderTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- */
-package org.apache.tamaya.microprofile.imported;
-
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.ConfigProvider;
-import org.eclipse.microprofile.config.spi.ConfigSource;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.*;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Properties;
-
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class ConfigProviderTest {
-
- private Config config = ConfigProvider.getConfig();
-
- @Test
- public void testEnvironmentConfigSource() {
- Map<String, String> env = System.getenv();
- for (Map.Entry<String, String> envEntry : env.entrySet()) {
- Assert.assertEquals(envEntry.getValue(), config.getValue(envEntry.getKey(), String.class));
- }
- }
-
- @Test
- public void testPropertyConfigSource() {
- Properties properties = System.getProperties();
-
- for (Map.Entry<Object, Object> propEntry : properties.entrySet()) {
- if(!String.class.equals(propEntry.getValue().getClass())){
- continue;
- }
- String propValue = propEntry.getValue().toString();
- if (propValue != null && propValue.length() > 0) {
- Assert.assertEquals(propValue, config.getValue((String) propEntry.getKey(), String.class));
- }
- }
- }
-
- @Test
- public void testDynamicValueInPropertyConfigSource() {
- String configKey = "tck.config.test.systemproperty.dynamic.value";
- String configValue = "myDynamicValue;";
-
- System.setProperty(configKey, configValue);
- Assert.assertEquals(config.getValue(configKey, String.class), configValue);
- }
-
- @Test
- public void testJavaConfigPropertyFilesConfigSource() {
- Assert.assertEquals(config.getValue("tck.config.test.javaconfig.properties.key1", String.class), "VALue1");
- }
-
- @Test
- public void testNonExistingConfigKey() {
- Assert.assertFalse(config.getOptionalValue("tck.config.test.keydoesnotexist", String.class).isPresent());
- }
-
- @Test(expected = NoSuchElementException.class)
- public void testNonExistingConfigKeyGet() {
- config.getValue("tck.config.test.keydoesnotexist", String.class);
- }
-
- @Test
- public void testGetConfigSources() {
- Iterable<ConfigSource> configSources = config.getConfigSources();
- Assert.assertNotNull(configSources);
-
- // check descending sorting
- int prevOrdinal = Integer.MAX_VALUE;
- for (ConfigSource configSource : configSources) {
- Assert.assertTrue(configSource.getOrdinal() <= prevOrdinal);
- prevOrdinal = configSource.getOrdinal();
- }
-
- }
-
- @Test
- public void testInjectedConfigSerializable() {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- try (ObjectOutputStream out = new ObjectOutputStream(byteArrayOutputStream)) {
- out.writeObject(config);
- } catch (IOException ex) {
- ex.printStackTrace();
- System.out.println("WARNING: Injected config should be serializable, but could not serialize it");
- }
- Object readObject = null;
- try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()))) {
- readObject = in.readObject();
- MatcherAssert.assertThat("Deserialized object", readObject, CoreMatchers.instanceOf(Config.class));
- } catch (IOException | ClassNotFoundException ex) {
- ex.printStackTrace();
- System.out.println("WARNING: Injected config should be serializable, but could not deserialize a previously serialized instance");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConverterTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConverterTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConverterTest.java
deleted file mode 100644
index 465a666..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/ConverterTest.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported;
-
-import org.apache.tamaya.microprofile.imported.converters.Duck;
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.ConfigProvider;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.time.*;
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- * @author <a href="mailto:john.d.ament@gmail.com">John D. Ament</a>
- */
-public class ConverterTest {
-
- private Config config = ConfigProvider.getConfig();
-
- @Test
- public void testCustomConverter() {
- Duck namedDuck = config.getValue("tck.config.test.javaconfig.converter.duckname", Duck.class);
- Assert.assertNotNull(namedDuck);
- Assert.assertEquals(namedDuck.getName(), "Hannelore");
- }
-
- @Test
- public void testInteger() {
- Integer value = config.getValue("tck.config.test.javaconfig.converter.integervalue", Integer.class);
- Assert.assertEquals(value, Integer.valueOf(1234));
- }
-
- @Test
- public void testInt() {
- int value = config.getValue("tck.config.test.javaconfig.converter.integervalue", int.class);
- Assert.assertEquals(value, 1234);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testInteger_Broken() {
- Integer value = config.getValue("tck.config.test.javaconfig.converter.integervalue.broken", Integer.class);
- }
-
- @Test
- public void testLong() {
- Long value = config.getValue("tck.config.test.javaconfig.converter.longvalue", Long.class);
- Assert.assertEquals(value, Long.valueOf(1234567890));
- }
-
- @Test
- public void testlong() {
- long primitiveValue = config.getValue("tck.config.test.javaconfig.converter.longvalue", long.class);
- Assert.assertEquals(primitiveValue, 1234567890L);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testLong_Broken() {
- config.getValue("tck.config.test.javaconfig.converter.longvalue.broken", Long.class);
- }
-
- @Test
- public void testFloat() {
- Float value = config.getValue("tck.config.test.javaconfig.converter.floatvalue", Float.class);
- Assert.assertEquals(value, 12.34f, 0.0f);
- }
-
- @Test
- public void testfloat() {
- float value = config.getValue("tck.config.test.javaconfig.converter.floatvalue", float.class);
- Assert.assertEquals(value, 12.34f, 0f);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testFloat_Broken() {
- config.getValue("tck.config.test.javaconfig.converter.floatvalue.broken", Float.class);
- }
-
- @Test
- public void testDouble() {
- Double value = config.getValue("tck.config.test.javaconfig.converter.doublevalue", Double.class);
- Assert.assertEquals(value, 12.34d, 0.0d);
- }
-
- @Test
- public void testdouble() {
- double value = config.getValue("tck.config.test.javaconfig.converter.doublevalue", double.class);
- Assert.assertEquals(value,12.34d, 0d);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testDouble_Broken() {
- Double value = config.getValue("tck.config.test.javaconfig.converter.doublevalue.broken", Double.class);
- }
-
- @Test
- public void testDuration() {
- Duration value = config.getValue("tck.config.test.javaconfig.converter.durationvalue", Duration.class);
- Assert.assertEquals(value, Duration.parse("PT15M"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testDuration_Broken() {
- Duration value = config.getValue("tck.config.test.javaconfig.converter.durationvalue.broken", Duration.class);
- }
-
- @Test
- public void testLocalTime() {
- LocalTime value = config.getValue("tck.config.test.javaconfig.converter.localtimevalue", LocalTime.class);
- Assert.assertEquals(value, LocalTime.parse("10:37"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testLocalTime_Broken() {
- LocalTime value = config.getValue("tck.config.test.javaconfig.converter.localtimevalue.broken", LocalTime.class);
- }
-
- @Test
- public void testLocalDate() {
- LocalDate value = config.getValue("tck.config.test.javaconfig.converter.localdatevalue", LocalDate.class);
- Assert.assertEquals(value, LocalDate.parse("2017-12-24"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testLocalDate_Broken() {
- LocalDate value = config.getValue("tck.config.test.javaconfig.converter.localdatevalue.broken", LocalDate.class);
- }
-
- @Test
- public void testLocalDateTime() {
- LocalDateTime value = config.getValue("tck.config.test.javaconfig.converter.localdatetimevalue", LocalDateTime.class);
- Assert.assertEquals(value, LocalDateTime.parse("2017-12-24T10:25:30"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testLocalDateTime_Broken() {
- LocalDateTime value = config.getValue("tck.config.test.javaconfig.converter.localdatetimevalue.broken", LocalDateTime.class);
- }
-
- @Test
- public void testOffsetDateTime() {
- OffsetDateTime value = config.getValue("tck.config.test.javaconfig.converter.offsetdatetimevalue", OffsetDateTime.class);
- Assert.assertEquals(value, OffsetDateTime.parse("2007-12-03T10:15:30+01:00"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testOffsetDateTime_Broken() {
- OffsetDateTime value = config.getValue("tck.config.test.javaconfig.converter.offsetdatetimevalue.broken", OffsetDateTime.class);
- }
-
- @Test
- public void testOffsetTime() {
- OffsetTime value = config.getValue("tck.config.test.javaconfig.converter.offsettimevalue", OffsetTime.class);
- OffsetTime parsed = OffsetTime.parse("13:45:30.123456789+02:00");
- Assert.assertEquals(value, parsed);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testOffsetTime_Broken() {
- OffsetTime value = config.getValue("tck.config.test.javaconfig.converter.offsettimevalue.broken", OffsetTime.class);
- }
-
- @Test
- public void testInstant() {
- Instant value = config.getValue("tck.config.test.javaconfig.converter.instantvalue", Instant.class);
- Assert.assertEquals(value, Instant.parse("2015-06-02T21:34:33.616Z"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testInstant_Broken() {
- Instant value = config.getValue("tck.config.test.javaconfig.converter.instantvalue.broken", Instant.class);
- }
-
- @Test
- public void testBoolean() {
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.true", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.true", boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.true_uppercase", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.true_mixedcase", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.false", Boolean.class));
-
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.one", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.zero", Boolean.class));
-// Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.seventeen", Boolean.class));
-
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.yes", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.yes_uppercase", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.yes_mixedcase", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.no", Boolean.class));
-
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.y", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.y_uppercase", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.n", Boolean.class));
-
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.on", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.on_uppercase", Boolean.class));
- Assert.assertTrue(config.getValue("tck.config.test.javaconfig.configvalue.boolean.on_mixedcase", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.off", Boolean.class));
- Assert.assertFalse(config.getValue("tck.config.test.javaconfig.configvalue.boolean.off", boolean.class));
- }
-
-
- @Test
- public void testURLConverter() throws MalformedURLException {
- URL url = config.getValue("tck.config.test.javaconfig.converter.urlvalue", URL.class);
- Assert.assertEquals(url, new URL("http://microprofile.io"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testURLConverterBroken() throws Exception {
- URL ignored = config.getValue("tck.config.test.javaconfig.converter.urlvalue.broken", URL.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CustomConfigSourceTest.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CustomConfigSourceTest.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CustomConfigSourceTest.java
deleted file mode 100644
index 2fe702e..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/CustomConfigSourceTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported;
-
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.ConfigProvider;
-import org.junit.Assert;
-import org.junit.Test;
-
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class CustomConfigSourceTest {
-
- private Config config = ConfigProvider.getConfig();
-
-
- @Test
- public void testConfigSourceProvider() {
- Assert.assertEquals(config.getValue("tck.config.test.customDbConfig.key1", String.class), "valueFromDb1");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/OptionalValuesBean.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/OptionalValuesBean.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/OptionalValuesBean.java
deleted file mode 100644
index 397116e..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/OptionalValuesBean.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported;
-/**
- * Declare a bean for config property injections.
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- */
-
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-import javax.enterprise.context.Dependent;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import java.util.Optional;
-
-@Singleton
-public class OptionalValuesBean {
- @Inject
- @ConfigProperty(name="my.optional.int.property")
- private Optional<Integer> intProperty;
-
- @Inject
- @ConfigProperty(name="my.notexisting.property")
- private Optional<Integer> notexistingProperty;
-
- private Optional<String> stringValue;
-
- @Inject
- public void setStringValue(@ConfigProperty(name="my.optional.string.property") Optional<String> stringValue) {
- this.stringValue = stringValue;
- }
-
- public Optional<String> getStringValue() {
- return stringValue;
- }
-
- public Optional<Integer> getIntProperty() {
- return intProperty;
- }
-
- public Optional<Integer> getNotexistingProperty() {
- return notexistingProperty;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/ConfigOwner.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/ConfigOwner.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/ConfigOwner.java
deleted file mode 100644
index fbdd875..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/ConfigOwner.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.broken;
-
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-//
-///**
-// * A bean contains a config property injection
-// *
-// * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
-// * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
-// */
-//@RequestScoped
-//public class ConfigOwner {
-//
-// @Inject
-// @ConfigProperty(name="my.long.value")
-// private Long configValue;
-//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/CustomConverterBean.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/CustomConverterBean.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/CustomConverterBean.java
deleted file mode 100644
index 30ec35b..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/broken/CustomConverterBean.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.broken;
-
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-/**
- * A bean contains a config property injection, which converts to CustomType
- *
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- */
-
-//public class CustomConverterBean {
-//
-// @RequestScoped
-// public static class ConfigOwner {
-//
-// @Inject
-// @ConfigProperty(name="my.customtype.value")
-// private CustomType configValue;
-// }
-//
-// public static class CustomType {
-// }
-//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomConfigSourceProvider.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomConfigSourceProvider.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomConfigSourceProvider.java
deleted file mode 100644
index 003f73a..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomConfigSourceProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.configsources;
-
-import org.eclipse.microprofile.config.spi.ConfigSource;
-import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class CustomConfigSourceProvider implements ConfigSourceProvider {
-
- @Override
- public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
- List<ConfigSource> detectedConfigSources = new ArrayList<>();
-
- Enumeration<URL> yamlFiles = null;
- try {
- yamlFiles = forClassLoader.getResources("sampleconfig.yaml");
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- while (yamlFiles.hasMoreElements()) {
- detectedConfigSources.add(new SampleYamlConfigSource(yamlFiles.nextElement()));
- }
- return detectedConfigSources;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomDbConfigSource.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomDbConfigSource.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomDbConfigSource.java
deleted file mode 100644
index 28ba343..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/CustomDbConfigSource.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.configsources;
-
-import org.eclipse.microprofile.config.spi.ConfigSource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class CustomDbConfigSource implements ConfigSource {
-
- private Map<String, String> configValues = new HashMap<>();
-
- public CustomDbConfigSource() {
- configValues.put("tck.config.test.customDbConfig.key1", "valueFromDb1");
- configValues.put("tck.config.test.customDbConfig.key2", "valueFromDb2");
- configValues.put("tck.config.test.customDbConfig.key3", "big:cheese");
- }
-
- @Override
- public int getOrdinal() {
- return 112;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return readPropertiesFromDb();
- }
-
- @Override
- public String getValue(String key) {
- return readPropertyFromDb(key);
- }
-
- @Override
- public String getName() {
- return "customDbConfig";
- }
-
- private Map<String, String> readPropertiesFromDb() {
- return configValues;
- }
-
- private String readPropertyFromDb(String key) {
- return configValues.get(key);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/SampleYamlConfigSource.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/SampleYamlConfigSource.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/SampleYamlConfigSource.java
deleted file mode 100644
index 34a612e..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/configsources/SampleYamlConfigSource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.configsources;
-
-import org.eclipse.microprofile.config.spi.ConfigSource;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class SampleYamlConfigSource implements ConfigSource {
- private Map<String, String> config = new HashMap<>();
-
- public SampleYamlConfigSource(URL url) {
- config.put("tck.config.test.sampleyaml.key1", "yamlvalue1");
- }
-
- @Override
- public int getOrdinal() {
- return 110;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return config;
- }
-
- @Override
- public String getValue(String key) {
- return config.get(key);
- }
-
- @Override
- public String getName() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Duck.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Duck.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Duck.java
deleted file mode 100644
index e5bf4b1..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Duck.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.converters;
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class Duck {
- private final String name;
-
-
- public Duck(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/DuckConverter.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/DuckConverter.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/DuckConverter.java
deleted file mode 100644
index a8eff34..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/DuckConverter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.converters;
-
-import org.eclipse.microprofile.config.spi.Converter;
-
-/**
- * @author <a href="mailto:struberg@apache.org">Mark Struberg</a>
- */
-public class DuckConverter implements Converter<Duck> {
-
- @Override
- public Duck convert(String value) {
- return new Duck(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Pizza.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Pizza.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Pizza.java
deleted file mode 100644
index bba1100..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/Pizza.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.converters;
-
-/**
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- */
-public class Pizza {
- private String flavor;
- private String size;
-
-
- public Pizza(String size, String flavor) {
- this.size = size;
- this.flavor = flavor;
- }
-
- public String getSize() {
- return size;
- }
-
- public String getFlavor() {
- return flavor;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/PizzaConverter.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/PizzaConverter.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/PizzaConverter.java
deleted file mode 100644
index 9717405..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/converters/PizzaConverter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- *
- */
-package org.apache.tamaya.microprofile.imported.converters;
-
-import org.eclipse.microprofile.config.spi.Converter;
-
-/**
- * @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
- */
-public class PizzaConverter implements Converter<Pizza> {
-
- @Override
- public Pizza convert(String value) {
- String[] parts = value.split(":");
- return new Pizza(parts[0], parts[1]);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/matchers/AdditionalMatchers.java
----------------------------------------------------------------------
diff --git a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/matchers/AdditionalMatchers.java b/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/matchers/AdditionalMatchers.java
deleted file mode 100644
index 31024d2..0000000
--- a/microprofile/src/test/java/org/apache/tamaya/microprofile/imported/matchers/AdditionalMatchers.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * Licensed 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.
- */
-
-package org.apache.tamaya.microprofile.imported.matchers;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-
-import static org.hamcrest.Matchers.closeTo;
-
-/**
- *
- * @author Ondrej Mihalyi
- */
-public final class AdditionalMatchers {
-
- private AdditionalMatchers() {
- // utility class
- }
-
- public static Matcher<Float> floatCloseTo(float value, float range) {
- return new BaseMatcher<Float>() {
-
- private Matcher<Double> doubleMatcher = null;
-
- @Override
- public boolean matches(Object item) {
- if (item instanceof Float) {
- return (doubleMatcher = closeTo(value, range)).matches(((Float)item).doubleValue());
- }
- else {
- return (doubleMatcher = closeTo(value, range)).matches(item);
- }
- }
-
- @Override
- public void describeTo(Description description) {
- doubleMatcher.describeTo(description);
- }
- };
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
----------------------------------------------------------------------
diff --git a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource b/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
deleted file mode 100644
index dbffc2a..0000000
--- a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
+++ /dev/null
@@ -1,19 +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.
-#
-org.apache.tamaya.microprofile.imported.configsources.CustomDbConfigSource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider
----------------------------------------------------------------------
diff --git a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider b/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider
deleted file mode 100644
index 68c6ace..0000000
--- a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (c) 2016-2017 Mark Struberg and others
-#
-# Licensed 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.
-#
-
-org.apache.tamaya.microprofile.imported.configsources.CustomConfigSourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/20f54006/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.Converter
----------------------------------------------------------------------
diff --git a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.Converter b/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.Converter
deleted file mode 100644
index 7d5dcd6..0000000
--- a/microprofile/src/test/resources/META-INF/services/org.eclipse.microprofile.config.spi.Converter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (c) 2016-2017 Mark Struberg and others
-#
-# Licensed 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.
-#
-
-org.apache.tamaya.microprofile.imported.converters.PizzaConverter
\ No newline at end of file
[2/2] incubator-tamaya-sandbox git commit: TAMAYA-260 - Beginning
alignment to the MicroProfile Config 1.1 spec.
Posted by jo...@apache.org.
TAMAYA-260 - Beginning alignment to the MicroProfile Config 1.1 spec.
- Change the default property name for injection.
- Do something with classloader setting (but ignore the field for now)
- Clean up pom file.
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/73839b31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/73839b31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/73839b31
Branch: refs/heads/TAMAYA-260-mp-11
Commit: 73839b31765f3115ad79b055d94ab7b41c5e0aa1
Parents: 20f5400
Author: John D. Ament <jo...@gmail.com>
Authored: Wed Sep 20 23:06:14 2017 -0400
Committer: John D. Ament <jo...@gmail.com>
Committed: Wed Sep 20 23:06:14 2017 -0400
----------------------------------------------------------------------
microprofile/pom.xml | 58 +++-----------------
.../microprofile/MicroprofileConfigBuilder.java | 7 ++-
.../cdi/MicroprofileConfigurationProducer.java | 20 ++-----
3 files changed, 18 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/73839b31/microprofile/pom.xml
----------------------------------------------------------------------
diff --git a/microprofile/pom.xml b/microprofile/pom.xml
index 37bbb2b..9273e4f 100644
--- a/microprofile/pom.xml
+++ b/microprofile/pom.xml
@@ -33,17 +33,16 @@ under the License.
<properties>
<maven.compile.sourceLevel>1.8</maven.compile.sourceLevel>
<maven.compile.targetLevel>1.8</maven.compile.targetLevel>
- <microprofile.version>1.0</microprofile.version>
+ <microprofile.config.version>1.1</microprofile.config.version>
<geronimo-atinject-1.0-spec.version>1.0</geronimo-atinject-1.0-spec.version>
<geronimo-jcdi-1.1-spec.version>1.0</geronimo-jcdi-1.1-spec.version>
<version.shrinkwrap.resolvers>2.2.6</version.shrinkwrap.resolvers>
- <org.apache.tomcat.version>6.0.53</org.apache.tomcat.version>
<tamaya-version>0.4-incubating-SNAPSHOT</tamaya-version>
<arquillian.version>1.1.13.Final</arquillian.version>
<arquillian-weld-embedded.version>2.0.0.Beta5</arquillian-weld-embedded.version>
- <cdi2-api.version>2.0</cdi2-api.version>
- <weld-shaded.version>3.0.0.Final</weld-shaded.version>
- <weld.version>2.2.7.Final</weld.version>
+ <cdi-api.version>2.0</cdi-api.version>
+ <weld-shaded.version>3.0.1.Final</weld-shaded.version>
+ <weld.version>3.0.1.Final</weld.version>
<deltaspike.version>1.1.0</deltaspike.version>
<openejb.version>4.7.1</openejb.version>
</properties>
@@ -84,44 +83,20 @@ under the License.
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
- <version>1.0</version>
+ <version>${microprofile.config.version}</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
- <version>1.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.1_spec</artifactId>
- <version>${geronimo-jcdi-1.1-spec.version}</version>
+ <version>${cdi-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se</artifactId>
+ <artifactId>weld-se-shaded</artifactId>
<version>${weld.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.deltaspike.cdictrl</groupId>
- <artifactId>deltaspike-cdictrl-weld</artifactId>
- <version>${deltaspike.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.modules</groupId>
- <artifactId>deltaspike-test-control-module-api</artifactId>
- <version>${deltaspike.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.modules</groupId>
- <artifactId>deltaspike-test-control-module-impl</artifactId>
- <version>${deltaspike.version}</version>
- <scope>test</scope>
- </dependency>
<!-- Microprofile TCK support only -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
@@ -142,12 +117,6 @@ under the License.
<scope>test</scope>
<type>pom</type>
</dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-core</artifactId>
- <version>${openejb.version}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<profiles>
@@ -160,13 +129,7 @@ under the License.
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-tck</artifactId>
- <version>1.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se-shaded</artifactId>
- <version>${weld-shaded.version}</version>
+ <version>${microprofile.config.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -175,11 +138,6 @@ under the License.
<version>${arquillian-weld-embedded.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <version>${cdi2-api.version}</version>
- </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/73839b31/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
----------------------------------------------------------------------
diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
index 7947e63..896311c 100644
--- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
+++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfigBuilder.java
@@ -39,6 +39,7 @@ import java.util.Objects;
final class MicroprofileConfigBuilder implements ConfigBuilder{
private ConfigurationContextBuilder contextBuilder;
+ private ClassLoader classLoader;
MicroprofileConfigBuilder(ConfigurationContextBuilder contextBuilder){
this.contextBuilder = Objects.requireNonNull(contextBuilder);
@@ -66,8 +67,7 @@ final class MicroprofileConfigBuilder implements ConfigBuilder{
new SystemPropertySource(400),
new EnvironmentPropertySource(300),
new MicroprofileDefaultProperties());
- contextBuilder.sortPropertySources(PropertySourceComparator.getInstance()
- .setOrdinalKey("config_ordinal"));
+ contextBuilder.sortPropertySources(PropertySourceComparator.getInstance());
return this;
}
@@ -106,7 +106,8 @@ final class MicroprofileConfigBuilder implements ConfigBuilder{
@Override
public ConfigBuilder forClassLoader(ClassLoader loader) {
- return null;
+ this.classLoader = loader;
+ return this;
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/73839b31/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
----------------------------------------------------------------------
diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
index eb1ac61..758a87f 100644
--- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
+++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/MicroprofileConfigurationProducer.java
@@ -16,8 +16,10 @@
*/
package org.apache.tamaya.microprofile.cdi;
-import org.apache.commons.lang.StringUtils;
-import org.apache.tamaya.*;
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import org.eclipse.microprofile.config.Config;
@@ -26,20 +28,15 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
-import javax.annotation.Priority;
import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.*;
+import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Provider;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Type;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import static org.apache.commons.lang.WordUtils.uncapitalize;
-
/**
* Producer bean for configuration properties.
*/
@@ -75,12 +72,7 @@ public class MicroprofileConfigurationProducer {
static String getDefaultKey(InjectionPoint injectionPoint) {
String memberName = injectionPoint.getMember().getName();
- String beanClassNames[] = injectionPoint.getBean().getBeanClass().getName().split("\\$");
- if(beanClassNames.length==1) {
- return beanClassNames[0] + "." + uncapitalize(memberName);
- }else{
- return beanClassNames[0] + "." + uncapitalize(beanClassNames[1]) + "." + uncapitalize(memberName);
- }
+ return memberName;
}
static ConversionContext createConversionContext(String key, InjectionPoint injectionPoint) {