Added tests for filter module. Checked in missing files.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/3fffcb09 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/3fffcb09 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/3fffcb09 Branch: refs/heads/master Commit: 3fffcb09793fc059160117b04ae35d482a6abd1a Parents: 3cb7f8d Author: anatole <anat...@apache.org> Authored: Thu Feb 11 20:20:13 2016 +0100 Committer: Oliver B. Fischer <ple...@apache.org> Committed: Fri Sep 30 21:29:37 2016 +0200 ---------------------------------------------------------------------- .../tamaya/filter/DefaultMetadataFilter.java | 42 --------------- .../filter/internal/DefaultMetadataFilter.java | 43 +++++++++++++++ .../tamaya/filter/ConfigurationFilterTest.java | 41 ++++++++++++++ .../tamaya/filter/ProgrammableFilterTest.java | 56 ++++++++++++++++++++ .../tamaya/filter/RegexPropertyFilterTest.java | 19 +++++++ 5 files changed, 159 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/3fffcb09/src/main/java/org/apache/tamaya/filter/DefaultMetadataFilter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/tamaya/filter/DefaultMetadataFilter.java b/src/main/java/org/apache/tamaya/filter/DefaultMetadataFilter.java deleted file mode 100644 index 389d9fa..0000000 --- a/src/main/java/org/apache/tamaya/filter/DefaultMetadataFilter.java +++ /dev/null @@ -1,42 +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.filter; - -import org.apache.tamaya.spi.FilterContext; -import org.apache.tamaya.spi.PropertyFilter; - -/** - * Default property filter that hides metadta entries starting with an '_', similar ti {@code etcd}. - */ -public final class DefaultMetadataFilter implements PropertyFilter{ - @Override - public String filterProperty(String valueToBeFiltered, FilterContext context) { - if(context.isSinglePropertyScoped()){ - // When accessing keys explicitly, do not hide anything. - return valueToBeFiltered; - } - if(ConfigurationFilter.THREADED_METADATA_FILTERED.get()) { - if (context.getKey().startsWith("_")) { - // Hide metadata entries. - return null; - } - } - return valueToBeFiltered; - } -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/3fffcb09/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java new file mode 100644 index 0000000..1119cba --- /dev/null +++ b/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java @@ -0,0 +1,43 @@ +/* + * 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.filter.internal; + +import org.apache.tamaya.filter.ConfigurationFilter; +import org.apache.tamaya.spi.FilterContext; +import org.apache.tamaya.spi.PropertyFilter; + +/** + * Default property filter that hides metadta entries starting with an '_', similar ti {@code etcd}. + */ +public final class DefaultMetadataFilter implements PropertyFilter{ + @Override + public String filterProperty(String valueToBeFiltered, FilterContext context) { + if(context.isSinglePropertyScoped()){ + // When accessing keys explicitly, do not hide anything. + return valueToBeFiltered; + } + if(ConfigurationFilter.THREADED_METADATA_FILTERED.get()) { + if (context.getKey().startsWith("_")) { + // Hide metadata entries. + return null; + } + } + return valueToBeFiltered; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/3fffcb09/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java b/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java new file mode 100644 index 0000000..b4f3fa3 --- /dev/null +++ b/src/test/java/org/apache/tamaya/filter/ConfigurationFilterTest.java @@ -0,0 +1,41 @@ +package org.apache.tamaya.filter; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Created by atsticks on 11.02.16. + */ +public class ConfigurationFilterTest { + + @Test + public void testIsMetadataFiltered() throws Exception { + + } + + @Test + public void testSetMetadataFiltered() throws Exception { + + } + + @Test + public void testGetSingleFilters() throws Exception { + + } + + @Test + public void testGetMapFilters() throws Exception { + + } + + @Test + public void testClearFilters() throws Exception { + + } + + @Test + public void testFilterProperty() throws Exception { + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/3fffcb09/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java b/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java new file mode 100644 index 0000000..0a30dc4 --- /dev/null +++ b/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java @@ -0,0 +1,56 @@ +package org.apache.tamaya.filter; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Created by atsticks on 11.02.16. + */ +public class ProgrammableFilterTest { + + @Test + public void testAddFilter() throws Exception { + + } + + @Test + public void testAddFilter1() throws Exception { + + } + + @Test + public void testRemoveFilter() throws Exception { + + } + + @Test + public void testClearFilters() throws Exception { + + } + + @Test + public void testSetFilters() throws Exception { + + } + + @Test + public void testSetFilters1() throws Exception { + + } + + @Test + public void testGetFilters() throws Exception { + + } + + @Test + public void testFilterProperty() throws Exception { + + } + + @Test + public void testToString() throws Exception { + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/3fffcb09/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java b/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java new file mode 100644 index 0000000..7583a86 --- /dev/null +++ b/src/test/java/org/apache/tamaya/filter/RegexPropertyFilterTest.java @@ -0,0 +1,19 @@ +package org.apache.tamaya.filter; + +import static org.junit.Assert.*; + +/** + * Created by atsticks on 11.02.16. + */ +public class RegexPropertyFilterTest { + + @org.junit.Test + public void testFilterProperty() throws Exception { + + } + + @org.junit.Test + public void testToString() throws Exception { + + } +} \ No newline at end of file