Repository: incubator-tamaya-extensions
Updated Branches:
  refs/heads/master 346a4f387 -> 304824b69


TAMAYA-238: Added test with unresolvable deps.


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

Branch: refs/heads/master
Commit: 304824b69eacd22d8e4a4f58827b4ddfa64f972b
Parents: 346a4f3
Author: anatole <anat...@apache.org>
Authored: Mon Mar 20 08:55:08 2017 +0100
Committer: anatole <anat...@apache.org>
Committed: Mon Mar 20 08:55:08 2017 +0100

----------------------------------------------------------------------
 .../tamaya/cdi/ConfigurationProducerTest.java   |  18 ---
 .../tamaya/cdi/ConfigurationResolverTest.java   | 112 -------------
 .../org/apache/tamaya/cdi/ConfiguredTest.java   |   5 +
 .../org/apache/tamaya/cdi/EnvironmentsTest.java |  83 ----------
 .../apache/tamaya/cdi/InterpolationTest.java    |  62 --------
 .../apache/tamaya/cdi/NotFoundNoDefault.java    | 159 ++++++++++---------
 6 files changed, 86 insertions(+), 353 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java
 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java
index 127deb2..b62eb66 100644
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java
+++ 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationProducerTest.java
@@ -87,14 +87,6 @@ public class ConfigurationProducerTest {
         @Config(value = "defaultFile.value", defaultValue = "./")
         private File defaultFile;
 
-//        @Inject
-//        @Config(value = "duration.value", defaultValue = "2 hours and 54 
minutes")
-//        private Duration duration;
-//
-//        @Inject
-//        @Config(value = "defaultDuration.value", defaultValue = "2 hours and 
54 minutes")
-//        private Duration defaultDuration;
-
         @Inject
         @Config(value = "boolean.value", defaultValue = "true")
         private Boolean aBoolean;
@@ -119,10 +111,6 @@ public class ConfigurationProducerTest {
             return file;
         }
 
-//        public Duration getDuration() {
-//            return duration;
-//        }
-
         public Boolean getaBoolean() {
             return aBoolean;
         }
@@ -139,10 +127,6 @@ public class ConfigurationProducerTest {
             return defaultFile;
         }
 
-//        public Duration getDefaultDuration() {
-//            return defaultDuration;
-//        }
-
         public Boolean getDefaultBoolean() {
             return defaultBoolean;
         }
@@ -158,8 +142,6 @@ public class ConfigurationProducerTest {
                     ", defaultString='" + defaultString + '\'' +
                     ", file=" + file +
                     ", defaultFile=" + defaultFile +
-//                    ", duration=" + duration +
-//                    ", defaultDuration=" + defaultDuration +
                     ", aBoolean=" + aBoolean +
                     ", defaultBoolean=" + defaultBoolean +
                     ", integer=" + integer +

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java
 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java
deleted file mode 100644
index f7e501d..0000000
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfigurationResolverTest.java
+++ /dev/null
@@ -1,112 +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.
-// */
-package org.apache.tamaya.cdi;
-//
-//import org.apache.openejb.loader.SystemInstance;
-//import org.junit.Before;
-//import org.junit.Test;
-//
-//import static org.junit.Assert.*;
-//
-//public class ConfigurationResolverTest {
-//
-//    private ConfigurationResolver resolver;
-//
-//    @Before
-//    public void cleanEnv() {
-//        SystemInstance.reset();
-//        System.clearProperty("environment");
-//
-//        resolver = new ConfigurationResolver();
-//    }
-//
-//    @Test
-//    public void defaultEnvironment() {
-//        assertEquals("test", resolver.getEnvironment());
-//    }
-//
-//    @Test
-//    public void overrideDefaultEnvironment() {
-//        System.setProperty("environment", "dev");
-//
-//        // don't use the field cause before is invoked before we have a 
chance to set the environment
-//        assertEquals("dev", new ConfigurationResolver().getEnvironment());
-//    }
-//
-//    @Test
-//    public void isResolvable() {
-//
-//        { // precondition
-//            try {
-//                resolver.isResolvableConfig(null, "value");
-//                fail("a null key is not resolvable");
-//
-//            } catch (final NullPointerException e) {
-//                // expected
-//            }
-//        }
-//        { // precondition
-//            try {
-//                resolver.isResolvableConfig("key", null);
-//                fail("a null default value is not resolvable");
-//
-//            } catch (final NullPointerException e) {
-//                // expected
-//            }
-//        }
-//
-//        // loaded from test.properties
-//        assertTrue(resolver.isResolvableConfig("remote.wsdl.location", ""));
-//        assertFalse(resolver.isResolvableConfig("something", ""));
-//
-//        // loaded from base.properties
-//        assertTrue(resolver.isResolvableConfig("remote.username", ""));
-//        assertFalse(resolver.isResolvableConfig("bla", ""));
-//    }
-//
-//    @Test
-//    public void found() {
-//
-//        { // precondition
-//            try {
-//                resolver.isResolvableConfig(null, "value");
-//                fail("a null key is not resolvable");
-//
-//            } catch (final NullPointerException e) {
-//                // expected
-//            }
-//        }
-//        { // precondition
-//            try {
-//                resolver.isResolvableConfig("key", null);
-//                fail("a null default value is not resolvable");
-//
-//            } catch (final NullPointerException e) {
-//                // expected
-//            }
-//        }
-//
-//        // loaded from test.properties
-//        assertEquals("classpath:/service-wsdl.xml", 
resolver.resolve("remote.wsdl.location", ""));
-//        assertEquals("something-else", resolver.resolve("something", 
"something-else"));
-//
-//        // loaded from base.properties
-//        assertEquals("joecool", resolver.resolve("remote.username", ""));
-//        assertEquals("blabla", resolver.resolve("bla", "blabla"));
-//    }
-//
-//}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfiguredTest.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfiguredTest.java 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfiguredTest.java
index 2c36a52..f45f445 100644
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfiguredTest.java
+++ 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/ConfiguredTest.java
@@ -80,4 +80,9 @@ public class ConfiguredTest{
         assertTrue(injectedClass.configContext == 
injectedClass.configContext2);
     }
 
+    @Test(expected=Exception.class)
+    public void test_error_Injection() {
+        NotFoundNoDefault injectedClass = 
CDI.current().select(NotFoundNoDefault.class).get();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/EnvironmentsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/EnvironmentsTest.java
 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/EnvironmentsTest.java
deleted file mode 100644
index b697d27..0000000
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/EnvironmentsTest.java
+++ /dev/null
@@ -1,83 +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.
-// */
-//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/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/InterpolationTest.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/InterpolationTest.java
 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/InterpolationTest.java
deleted file mode 100644
index 9b3ca4d..0000000
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/InterpolationTest.java
+++ /dev/null
@@ -1,62 +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.
- */
-package org.apache.tamaya.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/304824b6/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java
----------------------------------------------------------------------
diff --git 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java
 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java
index 56151ec..e08dac3 100644
--- 
a/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java
+++ 
b/modules/injection/cdi/src/test/java/org/apache/tamaya/cdi/NotFoundNoDefault.java
@@ -1,78 +1,81 @@
-///*
-// * 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
+/*
+ * 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.cdi;
+
+import org.apache.tamaya.inject.api.Config;
+import org.tomitribe.util.Duration;
+
+import javax.enterprise.inject.Alternative;
+import javax.inject.Inject;
+import java.io.File;
+
+
+@Alternative
+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

Reply via email to