Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master a44a2ab61 -> 346a4f387
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java new file mode 100644 index 0000000..4ae8b07 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredClass.java @@ -0,0 +1,111 @@ +/* + * + * 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.inject.api.Config; + +import javax.inject.Singleton; +import java.math.BigDecimal; + +/** + * Class to be loaded from CDI to ensure fields are correctly configured using CDI injection mechanisms. + */ +@Singleton +public class ConfiguredClass{ + + @Config + private String testProperty; + + @Config(value = {"a.b.c.key1","a.b.c.key2","a.b.c.key3"}, defaultValue = "The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.") + String value1; + + @Config({"foo","a.b.c.key2"}) + private String value2; + + @Config(defaultValue = "N/A") + private String runtimeVersion; + + @Config(defaultValue = "${sys:java.version}") + private String javaVersion2; + + @Config(defaultValue = "5") + private Integer int1; + + @Config + private int int2; + + @Config + private boolean booleanT; + + @Config("BD") + private BigDecimal bigNumber; + + @Config("double1") + private double doubleValue; + + 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; + } + + @Override + 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-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java new file mode 100644 index 0000000..69e8ef9 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/ConfiguredTest.java @@ -0,0 +1,83 @@ +/* + * 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.TestControl; +import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner; +import org.hamcrest.MatcherAssert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.spi.CDI; +import javax.inject.Singleton; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * Tests for CDI integration. + */ +@RunWith(CdiTestRunner.class) +@TestControl(startScopes = {ApplicationScoped.class, Singleton.class}) +public class ConfiguredTest{ + + @Test + public void test_Configuration_is_injected_correctly(){ + 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)); + } + + @Test + public void test_Default_injections_are_accessible(){ + InjectedClass injectedClass = CDI.current().select(InjectedClass.class).get(); + System.out.println("********************************************"); + System.out.println(injectedClass); + System.out.println("********************************************"); + assertNotNull(injectedClass.builder1); + assertNotNull(injectedClass.builder2); + assertNotNull(injectedClass.config); + assertNotNull(injectedClass.configContext); + } + + @Test + public void test_Injected_builders_are_notSame(){ + InjectedClass injectedClass = CDI.current().select(InjectedClass.class).get(); + assertTrue(injectedClass.builder1 != injectedClass.builder2); + } + + @Test + public void test_Injected_configs_are_same(){ + InjectedClass injectedClass = CDI.current().select(InjectedClass.class).get(); + assertTrue(injectedClass.config == injectedClass.config2); + } + + @Test + public void test_Injected_configContexts_are_same(){ + InjectedClass injectedClass = CDI.current().select(InjectedClass.class).get(); + assertTrue(injectedClass.configContext == injectedClass.configContext2); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java new file mode 100644 index 0000000..b697d27 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/EnvironmentsTest.java @@ -0,0 +1,83 @@ +///* +// * 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. +// */ +//package org.apache.tamaya.integration.cdi; +// +//import org.junit.Test; +// +//import java.util.Map; +//import java.util.Properties; +// +//import static org.junit.Assert.assertEquals; +// +///** +// * Tests the related environment properties exist +// */ +//public class EnvironmentsTest { +// +// @Test +// public void testGetProperties() throws Exception { +// +// final Properties test = Environments.getProperties("test"); +// +// // loaded from test.properties +// assertEquals("classpath:/test-service-wsdl.xml", test.getProperty("remote.wsdl.location")); +// +// // loaded from base.properties +// assertEquals("joecool", test.getProperty("remote.username")); +// } +// +// @Test(expected = IllegalArgumentException.class) +// public void noEnvFound() { +// Environments.getProperties("does not exists"); +// } +// +// @Test +// public void dev() throws Exception { +// +// final Properties test = Environments.getProperties("dev"); +// +// assertEquals("org.apache.openejb.cipher.StaticDESPasswordCipher", test.getProperty("cipher")); +// assertEquals("NjAq6q2agYVnvSMz+eYUZg==", test.getProperty("remote.password")); +// assertEquals("1443", test.getProperty("remote.port")); +// assertEquals("https://srv1114.supertribe.org:1443/remote/service/url", test.getProperty("remote.target.url")); +// assertEquals("srv1114.supertribe.org:1443", test.getProperty("remote.address")); +// assertEquals("srv1114.supertribe.org", test.getProperty("remote.host")); +// assertEquals("classpath:/service-wsdl.xml", test.getProperty("remote.wsdl.location")); +// assertEquals("joecool", test.getProperty("remote.username")); +// } +// +// @Test +// public void cert() throws Exception { +// final Properties test = Environments.getProperties("cert"); +// assertEquals("srv1016.supertribe.org", test.getProperty("remote.host")); +// assertEquals("joecool", test.getProperty("remote.username")); +// } +// +// @Test +// public void prod() throws Exception { +// final Properties test = Environments.getProperties("prod"); +// assertEquals("remotedb001.supertribe.org", test.getProperty("remote.host")); +// assertEquals("joecool", test.getProperty("remote.username")); +// } +// +// +// private static void generateAsserts(Properties test) { +// for (Map.Entry<Object, Object> entry : test.entrySet()) { +// System.out.printf("assertEquals(\"%s\", test.getProperty(\"%s\"));%n", entry.getProperty(), entry.getKey()); +// } +// } +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InjectedClass.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InjectedClass.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InjectedClass.java new file mode 100644 index 0000000..9b7bd23 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InjectedClass.java @@ -0,0 +1,62 @@ +/* + * 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.spi.ConfigurationContext; +import org.apache.tamaya.spi.ConfigurationContextBuilder; + +import javax.inject.Inject; +import javax.inject.Singleton; + +/** + * Class loaded by CDI to test correct injection of Configuration API artifacts. + */ +@Singleton +public class InjectedClass { + + @Inject + Configuration config; + + @Inject + Configuration config2; + + @Inject + ConfigurationContext configContext; + + @Inject + ConfigurationContext configContext2; + + @Inject + ConfigurationContextBuilder builder1; + + @Inject + ConfigurationContextBuilder builder2; + + @Override + public String toString() { + return "InjectedClass{" + + "config=" + config + + ", configContext=" + configContext + + ", builder1=" + builder1 + + ", builder2=" + builder2 + + '}'; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InterpolationTest.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InterpolationTest.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InterpolationTest.java new file mode 100644 index 0000000..56cc8c9 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/InterpolationTest.java @@ -0,0 +1,62 @@ +/* + * 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. + */ +package org.apache.tamaya.integration.cdi; +// +//import org.junit.Test; +//import org.tomitribe.util.IO; +// +//import java.net.URL; +//import java.util.Properties; +// +//import static org.junit.Assert.assertEquals; +// +//public class InterpolationTest { +// +// @Test +// public void testInterpolate() throws Exception { +// final Properties interpolated; +// { +// final Properties properties = new Properties(); +// properties.setProperty("foo.host", "localhost"); +// properties.setProperty("foo.port", "1234"); +// properties.setProperty("address", "http://${foo.host}:${foo.port}"); +// properties.setProperty("url", "${address}/webapp"); +// properties.setProperty("urlUnchanged", "${not an address}/webapp"); +// +// interpolated = Interpolation.interpolate(properties); +// } +// +// assertEquals("localhost", interpolated.getProperty("foo.host")); +// assertEquals("1234", interpolated.getProperty("foo.port")); +// assertEquals("http://localhost:1234", interpolated.getProperty("address")); +// assertEquals("http://localhost:1234/webapp", interpolated.getProperty("url")); +// assertEquals("${not an address}/webapp", interpolated.getProperty("urlUnchanged")); +// } +// +// @Test +// public void test() throws Exception { +// +// final ClassLoader loader = Thread.currentThread().getContextClassLoader(); +// +// final URL resource = loader.getResource("test.properties"); +// final Properties properties = Interpolation.interpolate(IO.readProperties(resource)); +// +// //remote.wsdl.location = classpath:/lx01116-zhr-active-partner-service-wsdl.xml +// assertEquals("classpath:/test-service-wsdl.xml", properties.getProperty("remote.wsdl.location")); +// } +// +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/NotFoundNoDefault.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/NotFoundNoDefault.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/NotFoundNoDefault.java new file mode 100644 index 0000000..56151ec --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/NotFoundNoDefault.java @@ -0,0 +1,78 @@ +///* +// * 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. +// */ +//package org.apache.tamaya.integration.cdi; +// +//import org.apache.tamaya.inject.api.Config; +//import org.tomitribe.util.Duration; +// +//import javax.inject.Inject; +//import java.io.File; +// +//public class NotFoundNoDefault { +// +// @Inject +// @Config("string.bla") +// private String string; +// +// @Inject +// @Config("file.bla") +// private File file; +// +// @Inject +// @Config("duration.bla") +// private Duration duration; +// +// @Inject +// @Config("boolean.bla") +// private Boolean aBoolean; +// +// @Inject +// @Config("integer.bla") +// private Integer integer; +// +// public String getString() { +// return string; +// } +// +// public File getFile() { +// return file; +// } +// +// public Duration getDuration() { +// return duration; +// } +// +// public Boolean getaBoolean() { +// return aBoolean; +// } +// +// public Integer getInteger() { +// return integer; +// } +// +// @Override +// public String toString() { +// return "NotFoundNoDefault{" + +// "string='" + string + '\'' + +// ", file=" + file + +// ", duration=" + duration + +// ", aBoolean=" + aBoolean + +// ", integer=" + integer + +// '}'; +// } +// +// } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java new file mode 100644 index 0000000..90692f3 --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/ProvidedPropertySource.java @@ -0,0 +1,66 @@ +/* + * 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.cfg; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; + +import javax.enterprise.inject.Vetoed; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Anatole on 17.09.2015. + */ +@Vetoed +class ProvidedPropertySource implements PropertySource{ + + final Map<String,PropertyValue> config = new HashMap<>(); + + public ProvidedPropertySource(){ + config.put("a.b.c.key3", PropertyValue.of("a.b.c.key3","keys current a.b.c.key3",getName())); + config.put("a.b.c.key4", PropertyValue.of("a.b.c.key4","keys current a.b.c.key4", getName())); + } + + @Override + public int getOrdinal() { + return 10; + } + + @Override + public String getName() { + return getClass().getName(); + } + + @Override + public PropertyValue get(String key) { + return config.get(key); + } + + @Override + public Map<String, PropertyValue> getProperties() { + return config; + } + + @Override + public boolean isScannable() { + return true; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java new file mode 100644 index 0000000..7b89fba --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestConfigProvider.java @@ -0,0 +1,45 @@ +/* + * 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.cfg; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertySourceProvider; + +import javax.enterprise.context.ApplicationScoped; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Created by Anatole on 29.09.2014. + */ +@ApplicationScoped +public class TestConfigProvider implements PropertySourceProvider { + + private List<PropertySource> configs = new ArrayList<>(); + + public TestConfigProvider(){ + configs.add(new ProvidedPropertySource()); + } + + @Override + public Collection<PropertySource> getPropertySources() { + return configs; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java new file mode 100644 index 0000000..6e86b8d --- /dev/null +++ b/modules/injection/cdi/src/test/java/org/apache/tamaya/integration/cdi/cfg/TestPropertySource.java @@ -0,0 +1,82 @@ +/* + * 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.cfg; + +import org.apache.tamaya.spi.PropertySource; +import org.apache.tamaya.spi.PropertyValue; + +import javax.inject.Singleton; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Anatole on 17.09.2015. + */ +@Singleton +public class TestPropertySource implements PropertySource{ + + final Map<String,String> config = new HashMap<>(); + + public TestPropertySource(){ + config.put("a.b.c.key1", "keys current a.b.c.key1"); + config.put("a.b.c.key2", "keys current a.b.c.key2"); + config.put("a.b.key3", "keys current a.b.key3"); + config.put("a.b.key4", "keys current a.b.key4"); + config.put("a.key5", "keys current a.key5"); + config.put("a.key6", "keys 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", "keys current testProperty"); + config.put("runtimeVersion", "${java.version}"); + config.put("{meta}source.type:"+getClass().getName(), "PropertySource"); + } + + public int getOrdinal() { + return 10; + } + + @Override + public String getName() { + return getClass().getName(); + } + + @Override + public PropertyValue get(String key) { + String val = this.config.get(key); + if(val!=null) { + return PropertyValue.of(key, val, getName()); + } + return null; + } + + @Override + public Map<String, PropertyValue> getProperties() { + return PropertyValue.map(config ,getName()); + } + + @Override + public boolean isScannable() { + return true; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/META-INF/beans.xml ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/META-INF/beans.xml b/modules/injection/cdi/src/test/resources/META-INF/beans.xml new file mode 100644 index 0000000..adee378 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/META-INF/beans.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd"> + +</beans> + http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/META-INF/javaconfiguration.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/META-INF/javaconfiguration.properties b/modules/injection/cdi/src/test/resources/META-INF/javaconfiguration.properties new file mode 100644 index 0000000..c72446e --- /dev/null +++ b/modules/injection/cdi/src/test/resources/META-INF/javaconfiguration.properties @@ -0,0 +1,35 @@ +# 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. +# +double1=1234.5678 +int2=13 +booleanT=y +remote.wsdl.location = classpath:/service-wsdl.xml +remote.port=1443 +remote.address=${remote.host}:${remote.port} +remote.target.url = https://${remote.address}/remote/service/url +remote.username = joecool + +# ciphered using built in StaticDESPasswordCipher +remote.password = NjAq6q2agYVnvSMz+eYUZg== +cipher=org.apache.openejb.cipher.StaticDESPasswordCipher + +string.value = hello +file.value = ./conf +duration.value = 10 minutes and 57 seconds +boolean.value = true +integer.value = 123 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/base.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/base.properties b/modules/injection/cdi/src/test/resources/base.properties new file mode 100644 index 0000000..a4d9896 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/base.properties @@ -0,0 +1,32 @@ +# +# 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. +# +remote.wsdl.location = classpath:/service-wsdl.xml +remote.port=1443 +remote.address=${remote.host}:${remote.port} +remote.target.url = https://${remote.address}/remote/service/url +remote.username = joecool +# ciphered using built in StaticDESPasswordCipher +remote.password = NjAq6q2agYVnvSMz+eYUZg== +cipher=org.apache.openejb.cipher.StaticDESPasswordCipher + +string.value = hello +file.value = ./conf +duration.value = 10 minutes and 57 seconds +boolean.value = true +integer.value = 123 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/cert.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/cert.properties b/modules/injection/cdi/src/test/resources/cert.properties new file mode 100644 index 0000000..c2c3712 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/cert.properties @@ -0,0 +1,20 @@ +# +# 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. +# +remote.host=srv1016.supertribe.org +remote.password=vm9oNWJpN8Y= http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/dev.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/dev.properties b/modules/injection/cdi/src/test/resources/dev.properties new file mode 100644 index 0000000..abd3e03 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/dev.properties @@ -0,0 +1,19 @@ +# +# 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. +# +remote.host=srv1114.supertribe.org http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/prod.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/prod.properties b/modules/injection/cdi/src/test/resources/prod.properties new file mode 100644 index 0000000..9f1ad67 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/prod.properties @@ -0,0 +1,20 @@ +# +# 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. +# +remote.host=remotedb001.supertribe.org +remote.password=vm9oNWJpN8Y= http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/qa.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/qa.properties b/modules/injection/cdi/src/test/resources/qa.properties new file mode 100644 index 0000000..3f43795 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/qa.properties @@ -0,0 +1,20 @@ +# +# 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. +# +remote.host=srv1115.supertribe.org +remote.password=vm9oNWJpN8Y= http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/b3bcddcb/modules/injection/cdi/src/test/resources/test.properties ---------------------------------------------------------------------- diff --git a/modules/injection/cdi/src/test/resources/test.properties b/modules/injection/cdi/src/test/resources/test.properties new file mode 100644 index 0000000..8e08405 --- /dev/null +++ b/modules/injection/cdi/src/test/resources/test.properties @@ -0,0 +1,20 @@ +# +# 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. +# +remote.wsdl.location = classpath:/test-service-wsdl.xml +