You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/15 17:29:20 UTC
[3/6] incubator-tamaya git commit: Removed the attic
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java b/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
deleted file mode 100644
index bc6a4ec..0000000
--- a/attic/java8/core/src/main/java/org/apache/tamaya/core/provider/JavaConfigurationProvider.java
+++ /dev/null
@@ -1,58 +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.core.provider;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.core.propertysource.SimplePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * Provider which reads all {@code javaconfiguration.properties} files from classpath
- */
-public class JavaConfigurationProvider implements PropertySourceProvider {
- /** Default location in the classpath, where Tamaya looks for configuration by default. */
- public static final String DEFAULT_PROPERTIES_FILE_NAME="META-INF/javaconfiguration.properties";
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- List<PropertySource> propertySources = new ArrayList<>();
- try {
- Enumeration<URL> urls = Thread.currentThread().getContextClassLoader()
- .getResources(DEFAULT_PROPERTIES_FILE_NAME);
- while (urls.hasMoreElements()) {
- propertySources.add(new SimplePropertySource(urls.nextElement()));
- }
-
- } catch (IOException e) {
- throw new ConfigException("Error while loading javaconfiguration.properties", e);
- }
- return Collections.unmodifiableList(propertySources);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
deleted file mode 100644
index 4efa42e..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
+++ /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 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.
-#
-org.apache.tamaya.core.internal.DefaultConfigurationContextBuilder
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
deleted file mode 100644
index 7c0e249..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
+++ /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 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.
-#
-org.apache.tamaya.core.internal.DefaultConfigurationProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
deleted file mode 100644
index fff680a..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.core.internal.converters.BooleanConverter
-org.apache.tamaya.core.internal.converters.ByteConverter
-org.apache.tamaya.core.internal.converters.CharConverter
-org.apache.tamaya.core.internal.converters.ClassConverter
-org.apache.tamaya.core.internal.converters.DoubleConverter
-org.apache.tamaya.core.internal.converters.FloatConverter
-org.apache.tamaya.core.internal.converters.IntegerConverter
-org.apache.tamaya.core.internal.converters.LongConverter
-org.apache.tamaya.core.internal.converters.ShortConverter
-org.apache.tamaya.core.internal.converters.BigDecimalConverter
-org.apache.tamaya.core.internal.converters.BigIntegerConverter
-org.apache.tamaya.core.internal.converters.CurrencyConverter
-org.apache.tamaya.core.internal.converters.LocalDateConverter
-org.apache.tamaya.core.internal.converters.LocalDateTimeConverter
-org.apache.tamaya.core.internal.converters.LocalTimeConverter
-org.apache.tamaya.core.internal.converters.ZoneIdConverter
-org.apache.tamaya.core.internal.converters.NumberConverter
-org.apache.tamaya.core.internal.converters.URIConverter
-org.apache.tamaya.core.internal.converters.URLConverter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 1b8f8c0..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
-org.apache.tamaya.core.propertysource.SystemPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index 4535a09..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /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 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.
-#
-org.apache.tamaya.core.provider.JavaConfigurationProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 2721eff..0000000
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ /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 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.
-#
-org.apache.tamaya.core.internal.DefaultServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
deleted file mode 100644
index 3e2b160..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
+++ /dev/null
@@ -1,58 +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.core;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * This tests checks if the combination of 2 prioritized PropertySource return valid results on the final Configuration.
- */
-public class ConfigurationTest {
-
- @Test
- public void testAccess(){
- assertNotNull(ConfigurationProvider.getConfiguration());
- }
-
- @Test
- public void testContent(){
- assertEquals("Robin", ConfigurationProvider.getConfiguration().getOptional("name").get());
- assertEquals("Sabine", ConfigurationProvider.getConfiguration().getOptional("name2").get()); // from default
- assertEquals("Mapped to name: Robin", ConfigurationProvider.getConfiguration().getOptional("name3").get()); // oderridden default, mapped by filter to name property
- assertEquals("Sereina(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)(filtered)", ConfigurationProvider.getConfiguration().getOptional("name4").get()); // final only
- assertNull(ConfigurationProvider.getConfiguration().getOptional("name5").orElse(null)); // final only, but removed from filter
-
- System.out.println("name : " + ConfigurationProvider.getConfiguration().getOptional("name").get());
- System.out.println("name2: " + ConfigurationProvider.getConfiguration().getOptional("name2").get());
- System.out.println("name3: " + ConfigurationProvider.getConfiguration().getOptional("name3").get());
- System.out.println("name4: " + ConfigurationProvider.getConfiguration().getOptional("name4").get());
- System.out.println("name5: " + ConfigurationProvider.getConfiguration().getOptional("name5").orElse(null));
-
- System.out.println("ALL :");
- ConfigurationProvider.getConfiguration().getProperties().entrySet().forEach(e ->
- System.out.println(" " + e.getKey()+" = " + e.getValue()));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
deleted file mode 100644
index c2a35d8..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/NotMockedAnswer.java
+++ /dev/null
@@ -1,55 +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.core;
-
-import org.mockito.exceptions.base.MockitoException;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.io.Serializable;
-
-// @todo This is a duplicated class
-public class NotMockedAnswer implements Answer<Object>, Serializable {
- public final static NotMockedAnswer NOT_MOCKED_ANSWER = new NotMockedAnswer();
-
- private NotMockedAnswer() {
- }
-
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- StringBuilder msgBuilder = new StringBuilder();
-
- msgBuilder.append("Invocation of method not mocked: ")
- .append(invocation.getMethod().toGenericString());
-
- if (invocation.getArguments().length > 0) {
- msgBuilder.append(" Supplied arguments: ");
-
- for (int i = 0; i < invocation.getArguments().length; i++) {
- msgBuilder.append(invocation.getArguments()[i]);
-
- if (i - 1 < invocation.getArguments().length) {
- msgBuilder.append(", ");
- }
- }
- }
-
- throw new MockitoException(msgBuilder.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
deleted file mode 100644
index aa77a5d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/A.java
+++ /dev/null
@@ -1,29 +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.core.internal;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class A implements AutoCloseable{
- @Override
- public void close() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
deleted file mode 100644
index 31bafb6..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/B.java
+++ /dev/null
@@ -1,29 +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.core.internal;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class B extends A implements Runnable{
- @Override
- public void run() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java
deleted file mode 100644
index aad1ef9..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/C.java
+++ /dev/null
@@ -1,56 +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.core.internal;
-
-import java.io.IOException;
-import java.nio.CharBuffer;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class C extends B implements Readable{
-
- private String inValue;
-
- public C(String inValue){
- this.inValue = inValue;
- }
-
- @Override
- public int read(CharBuffer cb) throws IOException {
- return 0;
- }
-
- /**
- * Returns the input value, set on creation. Used for test assertion.
- * @return the in value.
- */
- public String getInValue() {
- return inValue;
- }
-
- @Override
- public String toString() {
- return "C{" +
- "inValue='" + inValue + '\'' +
- '}';
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
deleted file mode 100644
index 62b8c9d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/CTestConverter.java
+++ /dev/null
@@ -1,31 +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.core.internal;
-
-import org.apache.tamaya.spi.PropertyConverter;
-
-/**
- * Created by Anatole on 13.06.2015.
- */
-public class CTestConverter implements PropertyConverter<C>{
- @Override
- public C convert(String value) {
- return new C(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
deleted file mode 100644
index 539cd8d..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationTest.java
+++ /dev/null
@@ -1,204 +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.core.internal;
-
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import javax.annotation.Priority;
-import java.util.ArrayList;
-import java.util.List;
-
-import static java.util.Collections.singletonList;
-import static org.apache.tamaya.core.NotMockedAnswer.NOT_MOCKED_ANSWER;
-import static org.apache.tamaya.spi.PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-public class DefaultConfigurationTest {
- private TestAppendingAFilter FILTER_APPENDING_A = new TestAppendingAFilter();
- private TestPrependingBFilter FILTER_PREPENDING_B = new TestPrependingBFilter();
- private TestPrependingCFilter FILTER_PREPENDING_C = new TestPrependingCFilter();
- private TestPrependingDFilter FILTER_PREPENDING_D = new TestPrependingDFilter();
-
- /* =
- * =- Section with tests for filtering properties with PropertyFilters
- * =
- */
-
- @Test
- public void filteringOfGivenValueWorksWithOneFilterWithoutPriority() {
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(singletonList(FILTER_APPENDING_A)).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("VA$"));
- }
-
- @Test
- public void filteringOfGivenValueWorksWithTwoFiltersWithoutPriority() {
- List<PropertyFilter> filters = new ArrayList<>();
-
- TestAppendingAFilter filterA = spy(FILTER_APPENDING_A);
- TestPrependingBFilter filterB = spy(FILTER_PREPENDING_B);
- filters.add(filterA);
- filters.add(filterB);
-
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(filters).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- assertThat(value, equalTo("$BVA$"));
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
- }
-
- @Test
- public void filteringOfGivenValueWorksWithOneFilterWithPriority() {
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(singletonList(FILTER_PREPENDING_C)).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("$CV"));
- }
-
- @Test
- public void filteringOfGivenValueWorksWithTwoFiltersWithDifferentPriorities() {
- assertThat(FILTER_PREPENDING_C.getClass().isAnnotationPresent(Priority.class), is(true));
- assertThat(FILTER_PREPENDING_D.getClass().isAnnotationPresent(Priority.class), is(true));
-
- List<PropertyFilter> filters = new ArrayList<>();
-
- filters.add(FILTER_PREPENDING_C);
- filters.add(FILTER_PREPENDING_D);
-
- PropertySource source = Mockito.mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("V").when(source).get(eq("key"));
- doReturn(0).when(source).getOrdinal();
- doReturn("source").when(source).getName();
-
- ConfigurationContext context = Mockito.mock(ConfigurationContext.class, NOT_MOCKED_ANSWER);
-
- doReturn(singletonList(source)).when(context).getPropertySources();
- doReturn(filters).when(context).getPropertyFilters();
- doReturn(DEFAULT_OVERRIDING_COLLECTOR).when(context).getPropertyValueCombinationPolicy();
-
- DefaultConfiguration configuration = new DefaultConfiguration(context);
-
- String value = configuration.get("key");
-
- verify(source, atLeastOnce()).get(eq("key"));
- verifyNoMoreInteractions(source);
-
- assertThat(value, equalTo("$D$CV"));
- }
-
- private static class TestAppendingAFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.endsWith("A$")
- ? value
- : value + "A$";
- }
- }
-
- private static class TestPrependingBFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.startsWith("$B")
- ? value
- : "$B" + value;
- }
- }
-
- @Priority(987)
- private static class TestPrependingCFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.contains("$C")
- ? value
- : "$C" + value;
- }
- }
-
- @Priority(111)
- private static class TestPrependingDFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- return value.contains("$D")
- ? value
- : "$D" + value;
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
deleted file mode 100644
index abbe944..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/DefaultServiceContextTest.java
+++ /dev/null
@@ -1,128 +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.core.internal;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.annotation.Priority;
-import java.util.List;
-
-public class DefaultServiceContextTest {
-
- /**
- * context to test
- */
- private DefaultServiceContext context = new DefaultServiceContext();
-
-
- @Test
- public void testGetService() {
- ConfigurationProviderSpi providerSpi = context.getService(ConfigurationProviderSpi.class);
- Assert.assertNotNull(providerSpi);
- Assert.assertTrue(providerSpi instanceof DefaultConfigurationProvider);
- }
-
- @Test(expected = ConfigException.class)
- public void testGetService_multipleServicesWithoutPriority_shouldThrowConfigException() {
- context.getService(InvalidPriorityInterface.class);
- }
-
- @Test
- public void testGetService_multipleService_shouldReturnServiceWithHighestPriority() {
- MultiImplsInterface service = context.getService(MultiImplsInterface.class);
-
- Assert.assertNotNull(service);
- Assert.assertTrue(service instanceof MultiImpl2);
- }
-
- @Test
- public void testGetService_noImpl_shouldReturnEmptyOpional() {
- NoImplInterface service = context.getService(NoImplInterface.class);
- Assert.assertNull(service);
- }
-
-
- @Test
- public void testGetServices_shouldReturnServices() {
- {
- List<InvalidPriorityInterface> services = context.getServices(InvalidPriorityInterface.class);
- Assert.assertNotNull(services);
- Assert.assertEquals(2, services.size());
-
- for (InvalidPriorityInterface service : services) {
- Assert.assertTrue(service instanceof InvalidPriorityImpl1 || service instanceof InvalidPriorityImpl2);
- }
- }
-
- {
- List<MultiImplsInterface> services = context.getServices(MultiImplsInterface.class);
- Assert.assertNotNull(services);
- Assert.assertEquals(3, services.size());
-
- for (MultiImplsInterface service : services) {
- Assert.assertTrue(service instanceof MultiImpl1 ||
- service instanceof MultiImpl2 ||
- service instanceof MultiImpl3);
- }
- }
- }
-
- @Test
- public void testGetServices_noImpl_shouldReturnEmptyList() {
- List<NoImplInterface> services = context.getServices(NoImplInterface.class);
- Assert.assertNotNull(services);
- Assert.assertTrue(services.isEmpty());
- }
-
-
- // some test interfaces and classes
-
- public static interface InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl1 implements InvalidPriorityInterface {
- }
-
- @Priority(value = 50)
- public static class InvalidPriorityImpl2 implements InvalidPriorityInterface {
- }
-
-
- public static interface MultiImplsInterface {
- }
-
- public static class MultiImpl1 implements MultiImplsInterface {
- }
-
- @Priority(value = 500)
- public static class MultiImpl2 implements MultiImplsInterface {
- }
-
- @Priority(value = -10)
- public static class MultiImpl3 implements MultiImplsInterface {
- }
-
-
- private static interface NoImplInterface {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
deleted file mode 100644
index 9b413aa..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/PropertyConverterManagerTest.java
+++ /dev/null
@@ -1,162 +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.core.internal;
-
-
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.TypeLiteral;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-
-public class PropertyConverterManagerTest {
- @Test
- public void customTypeWithFactoryMethodOfIsRecognizedAsSupported() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- assertThat(manager.isTargetTypeSupported(TypeLiteral.of(MyType.class)),
- is(true));
- }
-
- @Test
- public void factoryMethodOfIsUsedAsConverter() {
- PropertyConverterManager manager = new PropertyConverterManager();
-
- List<PropertyConverter<Object>> converters = manager.getPropertyConverters(TypeLiteral.of(MyType.class));
-
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Object> converter = converters.get(0);
-
- Object result = converter.convert("IN");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(MyType.class));
- assertThat(((MyType)result).getValue(), equalTo("IN"));
- }
-
- public static class MyType {
- private String typeValue;
-
- private MyType(String value) {
- typeValue = value;
- }
-
- public static MyType of(String source) {
- return new MyType(source);
- }
-
- public String getValue() {
- return typeValue;
- }
-
- }
-
- @Test
- public void testDirectConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<C>> converters = manager.getPropertyConverters(TypeLiteral.of(C.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<C> converter = converters.get(0);
- C result = converter.convert("testDirectConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectConverterMapping"));
- }
-
- @Test
- public void testDirectSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<B>> converters = manager.getPropertyConverters(TypeLiteral.of(B.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<B> converter = converters.get(0);
- B result = converter.convert("testDirectSuperclassConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectSuperclassConverterMapping"));
- }
-
- @Test
- public void testTransitiveSuperclassConverterMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<A>> converters = manager.getPropertyConverters(TypeLiteral.of(A.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<A> converter = converters.get(0);
- A result = converter.convert("testTransitiveSuperclassConverterMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveSuperclassConverterMapping"));
- }
-
- @Test
- public void testDirectInterfaceMapping(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Readable>> converters = manager.getPropertyConverters(TypeLiteral.of(Readable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Readable> converter = converters.get(0);
- Readable result = converter.convert("testDirectInterfaceMapping");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testDirectInterfaceMapping"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping1(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<Runnable>> converters = manager.getPropertyConverters(TypeLiteral.of(Runnable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<Runnable> converter = converters.get(0);
- Runnable result = converter.convert("testTransitiveInterfaceMapping1");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping1"));
- }
-
- @Test
- public void testTransitiveInterfaceMapping2(){
- PropertyConverterManager manager = new PropertyConverterManager();
- List<PropertyConverter<AutoCloseable>> converters = manager.getPropertyConverters(TypeLiteral.of(AutoCloseable.class));
- assertThat(converters, hasSize(1));
-
- PropertyConverter<AutoCloseable> converter = converters.get(0);
- AutoCloseable result = converter.convert("testTransitiveInterfaceMapping2");
-
- assertThat(result, notNullValue());
- assertThat(result, instanceOf(C.class));
- assertThat(((C)result).getInValue(), equalTo("testTransitiveInterfaceMapping2"));
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
deleted file mode 100644
index 9c4449a..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BigDecimalConverterTest.java
+++ /dev/null
@@ -1,104 +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.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BigDecimalConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.decimal", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal(101));
- }
-
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.hex.lowerX", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal("47"));
- valueRead = config.getOptional("tests.converter.bd.hex.upperX", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), new BigDecimal("63"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.foo", BigDecimal.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.big", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("101666666666666662333337263723628763821638923628193612983618293628763"),
- valueRead.get());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_BigDecimal_BigFloatValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<BigDecimal> valueRead = config.getOptional("tests.converter.bd.bigFloat", BigDecimal.class);
- assertTrue(valueRead.isPresent());
- assertEquals(new BigDecimal("1016666666666666623333372637236287638216389293628763.1016666666666666623333372" +
- "63723628763821638923628193612983618293628763"), valueRead.get());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
deleted file mode 100644
index a9671f0..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/BooleanConverterTest.java
+++ /dev/null
@@ -1,131 +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.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the default converter for bytes.
- */
-public class BooleanConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- // trues
- Optional<Boolean> valueRead = config.getOptional("tests.converter.boolean.y1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.y2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.yes3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.true3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.t1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.t2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertTrue(valueRead.get().booleanValue());
- // falses
- valueRead = config.getOptional("tests.converter.boolean.n1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.n2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.no3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.false3", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.f1", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.f2", Boolean.class);
- assertTrue(valueRead.isPresent());
- assertFalse(valueRead.get().booleanValue());
- valueRead = config.getOptional("tests.converter.boolean.foo", Boolean.class);
- assertFalse(valueRead.isPresent());
- }
- /*
-
- case "tests.converter.boolean.n1":
- return "n";
- case "tests.converter.boolean.n2":
- return "N";
- case "tests.converter.boolean.no1":
- return "no";
- case "tests.converter.boolean.no2":
- return "No";
- case "tests.converter.boolean.no3":
- return "nO";
- case "tests.converter.boolean.false1":
- return "false";
- case "tests.converter.boolean.false2":
- return "False";
- case "tests.converter.boolean.false3":
- return "falSe";
- case "tests.converter.boolean.f1":
- return "f";
- case "tests.converter.boolean.f2":
- return "F";
- */
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
deleted file mode 100644
index 3d3fe3e..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ByteConverterTest.java
+++ /dev/null
@@ -1,113 +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.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class ByteConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Decimal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.decimal", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), 101);
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Octal() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.octal", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("02").byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_Hex() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.hex.lowerX", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("0x2F").byteValue());
- valueRead = config.getOptional("tests.converter.byte.hex.upperX", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().byteValue(), Byte.decode("0X3F").byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.foo", Byte.class);
- assertFalse(valueRead.isPresent());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MinValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.min", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Byte.MIN_VALUE, valueRead.get().byteValue());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Byte_MaxValue() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.max", Byte.class);
- assertTrue(valueRead.isPresent());
- assertEquals(Byte.MAX_VALUE, valueRead.get().byteValue());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
deleted file mode 100644
index 6a124bd..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CharConverterTest.java
+++ /dev/null
@@ -1,90 +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.core.internal.converters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Optional;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-/**
- * Tests conversion of the {@link org.apache.tamaya.core.internal.converters.CharConverter}.
- */
-public class CharConverterTest {
-
- @Test
- public void testConvert_Character() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-numeric", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), (char)101);
- }
-
- @Test
- public void testConvert_Character_Quoted() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.d", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'd');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-before", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-after", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_Character_WithWhitspace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.f-around", Character.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().charValue(), 'f');
- }
-
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Character> valueRead = config.getOptional("tests.converter.char.foo", Character.class);
- assertFalse(valueRead.isPresent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
deleted file mode 100644
index 32d0b93..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/ConverterTestsPropertySource.java
+++ /dev/null
@@ -1,252 +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.core.internal.converters;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Test Property Source used by converter tests.
- */
-public class ConverterTestsPropertySource implements PropertySource{
- @Override
- public int getOrdinal() {
- return 0;
- }
-
- @Override
- public String getName() {
- return "ConverterTestsPropertySource";
- }
-
- @Override
- public String get(String key) {
- switch(key){
- // Bytes
- case "tests.converter.byte.decimal":
- return "101";
- case "tests.converter.byte.octal":
- return "02";
- case "tests.converter.byte.hex.lowerX":
- return "0x2F";
- case "tests.converter.byte.hex.upperX":
- return "0X3F";
- case "tests.converter.byte.min":
- return "min";
- case "tests.converter.byte.max":
- return "MAX_Value";
- // Boolean
- case "tests.converter.boolean.y1":
- return "y";
- case "tests.converter.boolean.y2":
- return "Y";
- case "tests.converter.boolean.yes1":
- return "yes";
- case "tests.converter.boolean.yes2":
- return "Yes";
- case "tests.converter.boolean.yes3":
- return "yeS";
- case "tests.converter.boolean.true1":
- return "true";
- case "tests.converter.boolean.true2":
- return "True";
- case "tests.converter.boolean.true3":
- return "trUe";
- case "tests.converter.boolean.t1":
- return "t";
- case "tests.converter.boolean.t2":
- return "T";
- case "tests.converter.boolean.n1":
- return "n";
- case "tests.converter.boolean.n2":
- return "N";
- case "tests.converter.boolean.no1":
- return "no";
- case "tests.converter.boolean.no2":
- return "No";
- case "tests.converter.boolean.no3":
- return "nO";
- case "tests.converter.boolean.false1":
- return "false";
- case "tests.converter.boolean.false2":
- return "False";
- case "tests.converter.boolean.false3":
- return "falSe";
- case "tests.converter.boolean.f1":
- return "f";
- case "tests.converter.boolean.f2":
- return "F";
- // Character
- case "tests.converter.char.f":
- return "f";
- case "tests.converter.char.d":
- return "'d'";
- case "tests.converter.char.f-before":
- return " f";
- case "tests.converter.char.f-after":
- return "f ";
- case "tests.converter.char.f-around":
- return " f ";
- case "tests.converter.char.f-numeric":
- return "101";
- // currency
- case "tests.converter.currency.code1":
- return "CHF";
- case "tests.converter.currency.code2":
- return "cHf";
- case "tests.converter.currency.code3":
- return " CHF";
- case "tests.converter.currency.code4":
- return "CHF ";
- case "tests.converter.currency.code5":
- return " CHF ";
- case "tests.converter.currency.code-numeric1":
- return "100";
- case "tests.converter.currency.code-numeric2":
- return " 100";
- case "tests.converter.currency.code-numeric3":
- return "100 ";
- case "tests.converter.currency.code-numeric4":
- return " 100 ";
- case "tests.converter.currency.code-locale1":
- return "DE";
- case "tests.converter.currency.code-locale2":
- return " DE";
- case "tests.converter.currency.code-locale3":
- return "DE ";
- case "tests.converter.currency.code-locale4":
- return " DE ";
- //double
- case "tests.converter.double.decimal":
- return "1.23456789";
- case "tests.converter.double.decimalNegative":
- return "-1.23456789";
- case "tests.converter.double.integer":
- return " 100";
- case "tests.converter.double.hex1":
- return " 0XFF";
- case "tests.converter.double.hex2":
- return "-0xFF ";
- case "tests.converter.double.hex3":
- return "#FF";
- case "tests.converter.double.octal":
- return "0013";
- case "tests.converter.double.min":
- return "MIN_Value";
- case "tests.converter.double.max":
- return "max";
- case "tests.converter.double.nan":
- return "NAN";
- case "tests.converter.double.pi":
- return "positive_infinity";
- case "tests.converter.double.ni":
- return "Negative_Infinity";
- //float
- case "tests.converter.float.decimal":
- return "1.23456789";
- case "tests.converter.float.decimalNegative":
- return "-1.23456789";
- case "tests.converter.float.integer":
- return " 100";
- case "tests.converter.float.hex1":
- return " 0XFF";
- case "tests.converter.float.hex2":
- return "-0xFF ";
- case "tests.converter.float.hex3":
- return "#FF";
- case "tests.converter.float.octal":
- return "0013";
- case "tests.converter.float.min":
- return "MIN_Value";
- case "tests.converter.float.max":
- return "max";
- case "tests.converter.float.nan":
- return "NAN";
- case "tests.converter.float.pi":
- return "positive_infinity";
- case "tests.converter.float.ni":
- return "Negative_Infinity";
- // Integer
- case "tests.converter.integer.decimal":
- return "101";
- case "tests.converter.integer.octal":
- return "02";
- case "tests.converter.integer.hex.lowerX":
- return "0x2F";
- case "tests.converter.integer.hex.upperX":
- return "0X3F";
- case "tests.converter.integer.min":
- return "min";
- case "tests.converter.integer.max":
- return "MAX_Value";
- // Long
- case "tests.converter.long.decimal":
- return "101";
- case "tests.converter.long.octal":
- return "02";
- case "tests.converter.long.hex.lowerX":
- return "0x2F";
- case "tests.converter.long.hex.upperX":
- return "0X3F";
- case "tests.converter.long.min":
- return "min";
- case "tests.converter.long.max":
- return "MAX_Value";
- // Short
- case "tests.converter.short.decimal":
- return "101";
- case "tests.converter.short.octal":
- return "02";
- case "tests.converter.short.hex.lowerX":
- return "0x2F";
- case "tests.converter.short.hex.upperX":
- return "0X3F";
- case "tests.converter.short.min":
- return "min";
- case "tests.converter.short.max":
- return "MAX_Value";
- // BigDecimal
- case "tests.converter.bd.decimal":
- return "101";
- case "tests.converter.bd.float":
- return "101.36438746";
- case "tests.converter.bd.big":
- return "101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.bigFloat":
- return "1016666666666666623333372637236287638216389293628763.101666666666666662333337263723628763821638923628193612983618293628763";
- case "tests.converter.bd.hex.lowerX":
- return "0x2F";
- case "tests.converter.bd.hex.upperX":
- return "0X3F";
- }
- return null;
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.emptyMap();
- }
-
- @Override
- public boolean isScannable() {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ccc0842b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java b/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
deleted file mode 100644
index 4c498f6..0000000
--- a/attic/java8/core/src/test/java/org/apache/tamaya/core/internal/converters/CurrencyConverterTest.java
+++ /dev/null
@@ -1,155 +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.core.internal.converters;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Currency;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the default converter for bytes.
- */
-public class CurrencyConverterTest {
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_cHf() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Before() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_After() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_CHF_Whitespace_Around() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code5", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get(), Currency.getInstance("CHF"));
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Numeric() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code-numeric1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- valueRead = config.getOptional("tests.converter.currency.code-numeric4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getNumericCode(), Currency.getInstance("BGL").getNumericCode());
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_Currency_Code_Locale() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Currency> valueRead = config.getOptional("tests.converter.currency.code-locale1", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale2", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale3", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- valueRead = config.getOptional("tests.converter.currency.code-locale4", Currency.class);
- assertTrue(valueRead.isPresent());
- assertEquals(valueRead.get().getCurrencyCode(), "EUR");
- }
-
- /**
- * Test conversion. The value are provided by
- * {@link ConverterTestsPropertySource}.
- * @throws Exception
- */
- @Test
- public void testConvert_NotPresent() throws Exception {
- Configuration config = ConfigurationProvider.getConfiguration();
- Optional<Byte> valueRead = config.getOptional("tests.converter.byte.foo", Byte.class);
- assertFalse(valueRead.isPresent());
- }
-}
\ No newline at end of file