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/25 21:23:53 UTC
[05/50] [abbrv] incubator-tamaya-sandbox git commit: TAMAYA-60
Removed the modules package for the package hierarchy.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/ConfigurationBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/ConfigurationBuilderTest.java b/src/test/java/org/apache/tamaya/modules/builder/ConfigurationBuilderTest.java
deleted file mode 100644
index a5062bd..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/ConfigurationBuilderTest.java
+++ /dev/null
@@ -1,896 +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.modules.builder;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.modules.builder.util.types.CustomTypeA;
-import org.apache.tamaya.modules.builder.util.types.CustomTypeB;
-import org.apache.tamaya.modules.builder.util.types.CustomTypeC;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matchers;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-
-import java.io.IOException;
-import java.net.URL;
-
-import static java.util.Arrays.asList;
-import static org.apache.tamaya.modules.builder.util.mockito.NotMockedAnswer.NOT_MOCKED_ANSWER;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.CALLS_REAL_METHODS;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-
-public class ConfigurationBuilderTest {
-
- @Test
- public void buildCanBuildEmptyConfiguration() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.build();
-
- assertThat(config, notNullValue());
- }
-
- @Test(expected = IllegalStateException.class)
- public void buildCanBeCalledOnlyOnce() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.build();
- builder.build();
- }
-
- /*********************************************************************
- * Tests for adding P r o p e r t y S o u r c e s
- */
-
- @Test(expected = NullPointerException.class)
- public void addPropertySourcesDoesNotAcceptNullValue() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertySources((PropertySource[])null);
- }
-
- @Test(expected = IllegalStateException.class)
- public void propertySourceCanNotBeAddedAfterBuildingTheConfiguration() {
- PropertySource first = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("first").when(first).getName();
- doReturn(100).when(first).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(first);
-
- builder.build();
-
- PropertySource second = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("second").when(first).getName();
-
- builder.addPropertySources(second);
- }
-
- @Test
- public void singleAddedPropertySourceIsUsed() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(source).getName();
- doReturn("a").when(source).get("keyOfA");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(source);
-
- Configuration config = builder.build();
-
- String valueOfA = config.get("keyOfA");
-
- assertThat(valueOfA, notNullValue());
- assertThat(valueOfA, equalTo("a"));
- }
-
- @Test
- public void twoAddedPropertySourcesAreUsed() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn("b").when(sourceOne).get("keyOfA");
- doReturn(10).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn("a").when(sourceTwo).get("keyOfA");
- doReturn(10).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne)
- .addPropertySources(sourceTwo);
-
- Configuration config = builder.build();
-
- String valueOfA = config.get("keyOfA");
-
- assertThat(valueOfA, notNullValue());
- assertThat(valueOfA, equalTo("a"));
- }
-
- @Ignore
- @Test(expected = ConfigException.class)
- public void twoPropertySourcesSamePrioritySameKey() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn("b").when(sourceOne).get("keyOfA");
- doReturn(20).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn("a").when(sourceTwo).get("keyOfA");
- doReturn(20).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne)
- .addPropertySources(sourceTwo);
-
- Configuration config = builder.build();
-
- config.get("keyOfA");
- }
-
- @Test
- public void twoPropertySourcesDiffPrioritySameKeyLowerAddedFirst() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn("b").when(sourceOne).get("keyOfA");
- doReturn(10).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn("a").when(sourceTwo).get("keyOfA");
- doReturn(20).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne)
- .addPropertySources(sourceTwo);
-
- Configuration config = builder.build();
-
- String valueOfA = config.get("keyOfA");
-
- assertThat(valueOfA, notNullValue());
- assertThat(valueOfA, equalTo("a"));
- }
-
- @Test
- public void twoPropertySourcesDiffPrioritySameKeyHigherAddedFirst() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn("b").when(sourceOne).get("keyOfA");
- doReturn(30).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn("a").when(sourceTwo).get("keyOfA");
- doReturn(20).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne, sourceTwo);
-
- Configuration config = builder.build();
-
- String valueOfA = config.get("keyOfA");
-
- assertThat(valueOfA, notNullValue());
- assertThat(valueOfA, equalTo("b"));
- }
-
- @Test
- public void consecutiveCallsToAddPropertySourceArePossible() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn(null).when(sourceOne).get(anyString());
- doReturn("b").when(sourceOne).get("b");
- doReturn(30).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn(null).when(sourceTwo).get(anyString());
- doReturn("a").when(sourceTwo).get("a");
- doReturn(30).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne)
- .addPropertySources(sourceTwo);
-
- Configuration config = builder.build();
-
- assertThat(config.get("b"), equalTo("b"));
- assertThat(config.get("a"), equalTo("a"));
- }
-
- @Test
- public void addMultiplePropertySourcesWhereOneIsNull() {
- PropertySource sourceOne = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("one").when(sourceOne).getName();
- doReturn(null).when(sourceOne).get(anyString());
- doReturn("b").when(sourceOne).get("b");
- doReturn(30).when(sourceOne).getOrdinal();
-
- PropertySource sourceTwo = mock(PropertySource.class, NOT_MOCKED_ANSWER);
- doReturn("two").when(sourceTwo).getName();
- doReturn(null).when(sourceTwo).get(anyString());
- doReturn("a").when(sourceTwo).get("a");
- doReturn(30).when(sourceTwo).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(sourceOne, null, sourceTwo);
-
- Configuration config = builder.build();
-
- assertThat(config.get("b"), equalTo("b"));
- assertThat(config.get("a"), equalTo("a"));
- }
-
- /**
- * ******************************************************************
- * Tests for adding P r o p e r t y C o n v e r t e r
- */
-
- @Test(expected = NullPointerException.class)
- public void canNotAddNullPropertyConverter() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertyConverter(TypeLiteral.of(CustomTypeA.class), null);
- }
-
- @Test(expected = NullPointerException.class)
- public void canNotAddNullTypeLiteralButPropertyConverter() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertyConverter((TypeLiteral<CustomTypeA>)null,
- prop -> new CustomTypeA(prop, prop));
- }
-
- @Test
- public void addedPropertyConverterWithTypeLiteralIsUsedByConfiguration() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertyConverter(TypeLiteral.of(CustomTypeA.class),
- prop -> new CustomTypeA(prop, prop))
- .addPropertySources(source);
-
- Configuration config = builder.build();
-
- Object resultRaw = config.get("key", CustomTypeA.class);
-
- assertThat(resultRaw, CoreMatchers.notNullValue());
-
- CustomTypeA result = (CustomTypeA)resultRaw;
-
- assertThat(result.getName(), equalTo("AA"));
- }
-
- @Test
- public void addedPropertyConverterWithClassIsUsedByConfiguration() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertyConverter(CustomTypeA.class,
- prop -> new CustomTypeA(prop, prop))
- .addPropertySources(source);
-
- Configuration config = builder.build();
-
- Object resultRaw = config.get("key", CustomTypeA.class);
-
- assertThat(resultRaw, CoreMatchers.notNullValue());
-
- CustomTypeA result = (CustomTypeA)resultRaw;
-
- assertThat(result.getName(), equalTo("AA"));
- }
-
- @Test
- public void canGetAndConvertPropertyViaOfMethod() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertySources(source);
-
- Configuration config = builder.build();
-
- Object resultRaw = config.get("key", CustomTypeB.class);
-
- assertThat(resultRaw, CoreMatchers.notNullValue());
-
- CustomTypeB result = (CustomTypeB)resultRaw;
-
- assertThat(result.getName(), equalTo("A"));
- }
-
- /*********************************************************************
- * Tests for adding P r o p e r t y F i l t e r
- */
-
- @Test(expected = NullPointerException.class)
- public void canNotAddNullAsPropertyFilter() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertyFilters(null);
- }
-
- @Test
- public void canAddNonSPIPropertyFilter() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("M").when(source).get("key");
- doReturn("source").when(source).getName();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySources(source)
- .addPropertyFilters(new TestNonSPIPropertyFilterA())
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, CoreMatchers.containsString("ABC"));
- }
-
- @Test
- public void canAddNonSPIPropertyFiltersViaConsecutiveCalls() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("M").when(source).get("key");
- doReturn("source").when(source).getName();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySources(source)
- .addPropertyFilters(new TestNonSPIPropertyFilterA())
- .addPropertyFilters(new TestNonSPIPropertyFilterB())
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, CoreMatchers.containsString("ABC"));
- assertThat(property, CoreMatchers.containsString("XYZ"));
- }
-
- @Test
- public void canAddMultipleNonSPIPropertyFiltersWhileOneIsNull() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("M").when(source).get("key");
- doReturn("source").when(source).getName();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySources(source)
- .addPropertyFilters(new TestNonSPIPropertyFilterA(),
- null,
- new TestNonSPIPropertyFilterB())
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, CoreMatchers.containsString("ABC"));
- assertThat(property, CoreMatchers.containsString("XYZ"));
- }
-
- @Test
- public void overhandedNullPropertyFilterIsSafelyHandled() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("M").when(source).get("key");
- doReturn("source").when(source).getName();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySources(source)
- .addPropertyFilters((PropertyFilter)null) // The cast is needed!
- .addPropertyFilters(new TestNonSPIPropertyFilterB())
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, CoreMatchers.containsString("XYZ"));
- }
-
- @Test
- public void canAddMultipleNonSPIPropertyFilter() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("M").when(source).get("key");
- doReturn("source").when(source).getName();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySources(source)
- .addPropertyFilters(new TestNonSPIPropertyFilterA(),
- new TestNonSPIPropertyFilterB())
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, CoreMatchers.containsString("ABC"));
- assertThat(property, CoreMatchers.containsString("XYZ"));
- }
-
- /*********************************************************************
- * Tests for adding
- * P r o p e r t y S o u r c e P r o v i d e r s
- */
-
- @Test
- public void handlesSafelyPropertyProviderReturningNullInsteadOfPropertySource() {
- PropertySourceProvider nullReturning = mock(PropertySourceProvider.class, NOT_MOCKED_ANSWER);
-
- doReturn(asList((PropertySource)null)).when(nullReturning).getPropertySources();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySourceProviders(new TestPropertySourceProviderB(),
- nullReturning,
- new TestPropertySourceProvider())
- .build();
-
- assertThat(config.get("tpsp_a"), Matchers.equalTo("A"));
- assertThat(config.get("tpsp_b"), Matchers.equalTo("B"));
- assertThat(config.get("tpsp_x"), Matchers.equalTo("X"));
- assertThat(config.get("tpsp_y"), Matchers.equalTo("Y"));
-
- verify(nullReturning).getPropertySources();
- }
-
- @Test(expected = NullPointerException.class)
- public void cannotAddNullAsPropertyProvider() {
- new ConfigurationBuilder().addPropertySourceProviders(null);
- }
-
- @Test
- public void canAddMultipleNonSPIPropertySourceProviders() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySourceProviders(new TestPropertySourceProviderB(),
- new TestPropertySourceProvider())
- .build();
-
- assertThat(config.get("tpsp_a"), Matchers.equalTo("A"));
- assertThat(config.get("tpsp_b"), Matchers.equalTo("B"));
- assertThat(config.get("tpsp_x"), Matchers.equalTo("X"));
- assertThat(config.get("tpsp_y"), Matchers.equalTo("Y"));
- }
-
- @Test
- public void canAddMultipleNonSPIPropertySourceProvidersWhileOfOfThemIsNull() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySourceProviders(new TestPropertySourceProviderB(), null,
- new TestPropertySourceProvider())
- .build();
-
- assertThat(config.get("tpsp_a"), Matchers.equalTo("A"));
- assertThat(config.get("tpsp_b"), Matchers.equalTo("B"));
- assertThat(config.get("tpsp_x"), Matchers.equalTo("X"));
- assertThat(config.get("tpsp_y"), Matchers.equalTo("Y"));
- }
-
-
- /*********************************************************************
- * Tests for adding
- * P r o p e r t y V a l u e C o m b i n a t i o n P o l i c y
- */
-
- // @todo TAYAMA-60 Write more tests
-
- /*********************************************************************
- * Tests for enabling and disabling of automatic loading of
- * P r o p e r t y S o u r c e s
- */
-
- @Test
- public void enablingOfProvidedPropertySourceServiceProvidersIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.disableProvidedPropertyConverters()
- .enableProvidedPropertyConverters();
-
- assertThat(builder.isPropertyConverterLoadingEnabled(), is(true));
- }
-
- @Test
- public void disablingOfProvidedPropertySourceServiceProvidersIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.enableProvidedPropertyConverters()
- .disableProvidedPropertyConverters();
-
- assertThat(builder.isPropertyConverterLoadingEnabled(), is(false));
- }
-
- @Test(expected = ConfigException.class)
- public void loadingOrPropertyConvertersCanBeDisabled() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(source)
- .enableProvidedPropertyConverters()
- .disableProvidedPropertyConverters();
-
- Configuration config = builder.build();
-
- config.get("key", CustomTypeC.class);
- }
-
- @Test
- public void loadingOfPropertyConvertersCanBeEnabled() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder().addPropertySources(source)
- .disableProvidedPropertyConverters()
- .enableProvidedPropertyConverters();
-
- Configuration config = builder.build();
-
- CustomTypeC result = config.get("key", CustomTypeC.class);
-
- assertThat(result, notNullValue());
- assertThat(result.getValue(), equalTo("A"));
- }
-
- /*********************************************************************
- * Tests for enabling and disabling of automatic loading of
- * P r o p e r t y S o u r c e s
- */
-
- @Test
- public void enablingOfPropertySourceLoadingIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.disableProvidedPropertySources()
- .enableProvidedPropertySources();
-
- assertThat(builder.isPropertySourcesLoadingEnabled(), is(true));
- }
-
- @Test
- public void disablingPropertySourceLoadingIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.enableProvidedPropertySources()
- .disableProvidedPropertySources();
-
- assertThat(builder.isPropertySourcesLoadingEnabled(), is(false));
- }
-
- @Test
- public void loadingOfPropertySourcesCanBeEnabled() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.disableProvidedPropertySources()
- .enableProvidedPropertySources()
- .build();
-
-
- assertThat(builder.isPropertySourcesLoadingEnabled(), is(true));
- assertThat(config.get("tps_a"), Matchers.equalTo("A"));
- }
-
- @Test
- public void loadingOfPropertySourcesCanBeDisabled() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.enableProvidedPropertySources()
- .disableProvidedPropertySources()
- .build();
-
-
- assertThat(builder.isPropertySourcesLoadingEnabled(), is(false));
- assertThat(config.get("tps_c"), Matchers.nullValue());
- }
-
- /*********************************************************************
- * Tests for enabling and disabling of automatic loading of
- * P r o p e r t y F i l t e r s
- */
-
- @Test
- public void enablingOfPropertyFiltersLoadingIsOk() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.disableProvidedPropertyFilters()
- .enabledProvidedPropertyFilters()
- .addPropertySources(source)
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, Matchers.equalTo("AinBerlin"));
- }
-
- @Test
- public void disablingOfPropertyFiltersLoadingIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.enabledProvidedPropertyFilters()
- .disableProvidedPropertyFilters();
-
- assertThat(builder.isPropertyFilterLoadingEnabled(), is(false));
- }
-
- @Test
- public void loadingOfPropertyFiltersCanBeDisabled() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.disableProvidedPropertyFilters()
- .enabledProvidedPropertyFilters();
-
- assertThat(builder.isPropertyFilterLoadingEnabled(), is(true));
- }
-
- @Test
- public void loadingOfPropertyFiltersCanBeEnabled() {
- PropertySource source = mock(PropertySource.class, NOT_MOCKED_ANSWER);
-
- doReturn("source").when(source).getName();
- doReturn("A").when(source).get("key");
- doReturn(100).when(source).getOrdinal();
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.enabledProvidedPropertyFilters()
- .disableProvidedPropertyFilters()
- .addPropertySources(source)
- .build();
-
- String property = config.get("key");
-
- assertThat(property, CoreMatchers.notNullValue());
- assertThat(property, Matchers.equalTo("A"));
- }
-
- /*********************************************************************
- * Tests for enabling and disabling of automatic loading of
- * P r o p e r t y S o u r c e P r o v i d e r s
- */
-
- @Test
- public void disablingOfPropertySourceProvidersIsOk() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.enableProvidedPropertySourceProviders()
- .disableProvidedPropertySourceProviders()
- .build();
-
- assertThat(builder.isPropertySourceProvidersLoadingEnabled(), is(false));
- }
-
- @Test
- public void enablingOfPropertySourceProvidersIsOk() {
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.disableProvidedPropertySourceProviders()
- .enableProvidedPropertySourceProviders()
- .build();
-
- assertThat(builder.isPropertySourceProvidersLoadingEnabled(), is(true));
- }
-
- @Test
- public void loadingOfPropertySourceProvidersCanBeEnabled() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.disableProvidedPropertySourceProviders()
- .enableProvidedPropertySourceProviders()
- .build();
-
- assertThat(builder.isPropertySourceProvidersLoadingEnabled(), is(true));
- assertThat(config.get("tpsp_x"), Matchers.equalTo("X"));
- assertThat(config.get("tpsp_y"), Matchers.equalTo("Y"));
- }
-
- @Test
- public void loadingOfPropertySourceProvidersCanBeDisabled() {
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.enableProvidedPropertySourceProviders()
- .disableProvidedPropertySourceProviders()
- .build();
-
- assertThat(builder.isPropertySourceProvidersLoadingEnabled(), is(false));
- assertThat(config.get("tpsp_x"), nullValue());
- assertThat(config.get("tpsp_x"), nullValue());
- }
-
- @Test(expected = ConfigException.class)
- public void ioExceptionIsTurnedInConfigExceptionWhenLoadingResourceViaURL() throws Exception {
- URL resource = this.getClass().getResource("/configfiles/json/simple.json");
-
- assertThat(resource, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = mock(ConfigurationBuilder.class, CALLS_REAL_METHODS);
-
- doThrow(IOException.class).when(builder).getConfigurationDataFromURL(Mockito.eq(resource));
-
- builder.addPropertySource(resource).build();
- }
-
- /*********************************************************************
- * Tests for loading resources via URL (as String)
- */
-
- @Test(expected = ConfigException.class)
- public void tryToLoadOneUnsupportedPropertySourceViaStringURL() {
- URL resource = this.getClass().getResource("/configfiles/other/simple.oml");
-
- assertThat(resource, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- builder.addPropertySource(resource.toString()).build();
- }
-
- @Test
- public void loadOneJSONPropertySourceViaStringURL() {
- URL resource = this.getClass().getResource("/configfiles/json/simple.json");
-
- assertThat(resource, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySource(resource.toString())
- .build();
-
- assertThat(config, CoreMatchers.notNullValue());
- assertThat(config.get("a"), equalTo("A"));
- assertThat(config.get("b"), equalTo("B"));
- }
-
- @Test
- public void loadMultipleJSONPropertySourceViaStringURL() {
- URL first = this.getClass().getResource("/configfiles/json/first.json");
- URL second = this.getClass().getResource("/configfiles/json/second.json");
- URL third = this.getClass().getResource("/configfiles/json/third.json");
-
- assertThat(first, CoreMatchers.notNullValue());
- assertThat(second, CoreMatchers.notNullValue());
- assertThat(third, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySource(first.toString(), second.toString(),
- null, third.toString())
- .build();
-
- assertThat(config, CoreMatchers.notNullValue());
-
- // from first.json
- assertThat(config.get("d"), equalTo("D"));
- assertThat(config.get("e"), equalTo("E"));
-
- // from second.json
- assertThat(config.get("m"), equalTo("M"));
- assertThat(config.get("n"), equalTo("N"));
-
- // from thrid.json
- assertThat(config.get("p"), equalTo("P"));
- assertThat(config.get("q"), equalTo("Q"));
- }
-
- /**
- * ******************************************************************
- * Tests for loading resources via URL (as URL object)
- */
-
- @Test
- public void loadOneJSONPropertySourceViaURL() {
- URL resource = this.getClass().getResource("/configfiles/json/simple.json");
-
- assertThat(resource, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySource(resource)
- .build();
-
- assertThat(config, CoreMatchers.notNullValue());
- assertThat(config.get("a"), equalTo("A"));
- assertThat(config.get("b"), equalTo("B"));
- }
-
- @Test
- public void loadMultipleJSONPropertySourceViaURL() {
- URL first = this.getClass().getResource("/configfiles/json/first.json");
- URL second = this.getClass().getResource("/configfiles/json/second.json");
- URL third = this.getClass().getResource("/configfiles/json/third.json");
-
- assertThat(first, CoreMatchers.notNullValue());
- assertThat(second, CoreMatchers.notNullValue());
- assertThat(third, CoreMatchers.notNullValue());
-
- ConfigurationBuilder builder = new ConfigurationBuilder();
-
- Configuration config = builder.addPropertySource(first, second,
- null, third)
- .build();
-
- assertThat(config, CoreMatchers.notNullValue());
-
- // from first.json
- assertThat(config.get("d"), equalTo("D"));
- assertThat(config.get("e"), equalTo("E"));
-
- // from second.json
- assertThat(config.get("m"), equalTo("M"));
- assertThat(config.get("n"), equalTo("N"));
-
- // from thrid.json
- assertThat(config.get("p"), equalTo("P"));
- assertThat(config.get("q"), equalTo("Q"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterA.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterA.java b/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterA.java
deleted file mode 100644
index 7d899dc..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterA.java
+++ /dev/null
@@ -1,34 +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.modules.builder;
-
-import org.apache.tamaya.spi.PropertyFilter;
-
-public class TestNonSPIPropertyFilterA implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- String result = value;
-
- if (!result.contains(("ABC"))) {
- result = value + "ABC";
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterB.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterB.java b/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterB.java
deleted file mode 100644
index d7f7a40..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestNonSPIPropertyFilterB.java
+++ /dev/null
@@ -1,34 +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.modules.builder;
-
-import org.apache.tamaya.spi.PropertyFilter;
-
-public class TestNonSPIPropertyFilterB implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- String result = value;
-
- if (!result.contains(("XYZ"))) {
- result = value + "XYZ";
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestPropertyFilter.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestPropertyFilter.java b/src/test/java/org/apache/tamaya/modules/builder/TestPropertyFilter.java
deleted file mode 100644
index 6e9f5ae..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestPropertyFilter.java
+++ /dev/null
@@ -1,34 +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.modules.builder;
-
-import org.apache.tamaya.spi.PropertyFilter;
-
-public class TestPropertyFilter implements PropertyFilter {
- @Override
- public String filterProperty(String key, String value) {
- String result = value;
-
- if (!result.contains(("inBerlin"))) {
- result = value + "inBerlin";
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestPropertySource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySource.java b/src/test/java/org/apache/tamaya/modules/builder/TestPropertySource.java
deleted file mode 100644
index 8c9fc00..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySource.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.modules.builder;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.Map;
-
-public class TestPropertySource
- implements PropertySource
-{
- private Map<String, String> properties;
-
- {
- properties = new Hashtable<>(3);
- properties.put("tps_a", "A");
- properties.put("tps_b", "B");
- properties.put("tps_c", "C");
- }
-
- @Override
- public int getOrdinal() {
- return 456;
- }
-
- @Override
- public String getName() {
- return "TestPropertySource";
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return Collections.unmodifiableMap(properties);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProvider.java b/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProvider.java
deleted file mode 100644
index a753c25..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProvider.java
+++ /dev/null
@@ -1,89 +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.modules.builder;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-public class TestPropertySourceProvider
- implements PropertySourceProvider
-{
- @Override
- public Collection<PropertySource> getPropertySources() {
- ArrayList<PropertySource> sources = new ArrayList<>(2);
-
- sources.add(new XProvidingPropertySource());
- sources.add(new YProvidingPropertySource());
-
- return sources;
- }
-
- private class YProvidingPropertySource implements PropertySource {
- private Map<String, String> props = Collections.singletonMap("tpsp_x", "X");
-
- @Override
- public int getOrdinal() {
- return 100;
- }
-
- @Override
- public String getName() {
- return "YProvidingPropertySource";
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return props;
- }
- }
-
- private class XProvidingPropertySource implements PropertySource {
- private Map<String, String> props = Collections.singletonMap("tpsp_y", "Y");
-
- @Override
- public Map<String, String> getProperties() {
- return props;
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public int getOrdinal() {
- return 100;
- }
-
- @Override
- public String getName() {
- return "XProvidingPropertySource";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProviderB.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProviderB.java b/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProviderB.java
deleted file mode 100644
index 890b166..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/TestPropertySourceProviderB.java
+++ /dev/null
@@ -1,89 +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.modules.builder;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-public class TestPropertySourceProviderB
- implements PropertySourceProvider
-{
- @Override
- public Collection<PropertySource> getPropertySources() {
- ArrayList<PropertySource> sources = new ArrayList<>(2);
-
- sources.add(new AProvidingPropertySource());
- sources.add(new BProvidingPropertySource());
-
- return sources;
- }
-
- private class BProvidingPropertySource implements PropertySource {
- private Map<String, String> props = Collections.singletonMap("tpsp_b", "B");
-
- @Override
- public int getOrdinal() {
- return 100;
- }
-
- @Override
- public String getName() {
- return "BProvidingPropertySource";
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return props;
- }
- }
-
- private class AProvidingPropertySource implements PropertySource {
- private Map<String, String> props = Collections.singletonMap("tpsp_a", "A");
-
- @Override
- public Map<String, String> getProperties() {
- return props;
- }
-
- @Override
- public String get(String key) {
- return getProperties().get(key);
- }
-
- @Override
- public int getOrdinal() {
- return 100;
- }
-
- @Override
- public String getName() {
- return "AProvidingPropertySource";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/util/mockito/NotMockedAnswer.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/util/mockito/NotMockedAnswer.java b/src/test/java/org/apache/tamaya/modules/builder/util/mockito/NotMockedAnswer.java
deleted file mode 100644
index d754305..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/util/mockito/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.modules.builder.util.mockito;
-
-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-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeA.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeA.java b/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeA.java
deleted file mode 100644
index 378a131..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeA.java
+++ /dev/null
@@ -1,34 +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.modules.builder.util.types;
-
-/**
- * Custom type with two argument constructor.
- */
-public class CustomTypeA {
- private String name;
-
- public CustomTypeA(String name, String other) {
- this.name = name + other;
- }
-
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeB.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeB.java b/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeB.java
deleted file mode 100644
index a00abda..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeB.java
+++ /dev/null
@@ -1,39 +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.modules.builder.util.types;
-
-/**
- * Custom type with factory method
- * {@link org.apache.tamaya.builder.util.types.CustomTypeB#of(String)}
- */
-public class CustomTypeB {
- private String name;
-
- private CustomTypeB(String value) {
- this.name = value;
- }
-
- public String getName() {
- return name;
- }
-
- public static CustomTypeB of(String source) {
- return new CustomTypeB(source);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeC.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeC.java b/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeC.java
deleted file mode 100644
index a75af2b..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeC.java
+++ /dev/null
@@ -1,36 +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.modules.builder.util.types;
-
-public class CustomTypeC {
- private String value;
-
-
- public CustomTypeC(String in, @SuppressWarnings("unused") int iHideThisConstructorForTamaya) {
- value = in;
- }
-
- public String getValue() {
- return value;
- }
-
- public static CustomTypeC produceFrom(String in) {
- return new CustomTypeC(in, -1);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeCPropertyConverter.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeCPropertyConverter.java b/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeCPropertyConverter.java
deleted file mode 100644
index ede9fda..0000000
--- a/src/test/java/org/apache/tamaya/modules/builder/util/types/CustomTypeCPropertyConverter.java
+++ /dev/null
@@ -1,28 +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.modules.builder.util.types;
-
-import org.apache.tamaya.PropertyConverter;
-
-public class CustomTypeCPropertyConverter implements PropertyConverter<org.apache.tamaya.modules.builder.util.types.CustomTypeC> {
- @Override
- public org.apache.tamaya.modules.builder.util.types.CustomTypeC convert(String value) {
- return org.apache.tamaya.modules.builder.util.types.CustomTypeC.produceFrom(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/resources/META-INF/services/org.apache.tamaya.PropertyConverter
----------------------------------------------------------------------
diff --git a/src/test/resources/META-INF/services/org.apache.tamaya.PropertyConverter b/src/test/resources/META-INF/services/org.apache.tamaya.PropertyConverter
index 9510492..b9e0d44 100644
--- a/src/test/resources/META-INF/services/org.apache.tamaya.PropertyConverter
+++ b/src/test/resources/META-INF/services/org.apache.tamaya.PropertyConverter
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.modules.builder.util.types.CustomTypeCPropertyConverter
\ No newline at end of file
+org.apache.tamaya.builder.util.types.CustomTypeCPropertyConverter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
----------------------------------------------------------------------
diff --git a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
index d69635f..f35e9c5 100644
--- a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
+++ b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.modules.builder.TestPropertyFilter
+org.apache.tamaya.builder.TestPropertyFilter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
index c0cc7f7..64d1b0d 100644
--- a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.modules.builder.TestPropertySource
+org.apache.tamaya.builder.TestPropertySource
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/f78f6a11/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
index 12aa505..9a19ea0 100644
--- a/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ b/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.modules.builder.TestPropertySourceProvider
+org.apache.tamaya.builder.TestPropertySourceProvider