Added docs for usage module.

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/12261be2
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/12261be2
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/12261be2

Branch: refs/heads/master
Commit: 12261be2d9fe4b5f5169530aa6ec159c87f728a0
Parents: e6ceeec
Author: anatole <anat...@apache.org>
Authored: Sun May 1 18:03:34 2016 +0200
Committer: anatole <anat...@apache.org>
Committed: Sun May 1 21:02:06 2016 +0200

----------------------------------------------------------------------
 .../apache/tamaya/model/ConfigModelManager.java |  54 +-----
 .../apache/tamaya/model/ConfigUsageStats.java   | 128 ++++++++++++++
 .../java/org/apache/tamaya/model/Usage.java     |  76 +++++---
 .../model/internal/DefaultConfigUsageStats.java | 176 +++++++++++++++++++
 .../model/internal/DefaultUsageTracker.java     | 166 -----------------
 .../model/internal/UsageTrackerFilter.java      |   4 +-
 .../tamaya/model/spi/ConfigUsageStatsSpi.java   |  98 +++++++++++
 .../tamaya/model/spi/UsageTrackerSpi.java       |  83 ---------
 ....apache.tamaya.model.spi.ConfigUsageStatsSpi |  19 ++
 .../org.apache.tamaya.model.spi.UsageTrackerSpi |  19 --
 .../tamaya/model/ConfigModelProviderTest.java   |  67 +++++++
 .../tamaya/model/ConfigUsageStatsTest.java      | 113 ++++++++++++
 .../tamaya/model/TestConfigModelProvider.java   | 115 ------------
 ...org.apache.tamaya.model.spi.ModelProviderSpi |   2 +-
 14 files changed, 657 insertions(+), 463 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java 
b/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
index b066366..8723527 100644
--- a/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
+++ b/model/src/main/java/org/apache/tamaya/model/ConfigModelManager.java
@@ -22,7 +22,6 @@ import org.apache.tamaya.Configuration;
 import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.model.spi.ConfigDocumentationMBean;
 import org.apache.tamaya.model.spi.ModelProviderSpi;
-import org.apache.tamaya.model.spi.UsageTrackerSpi;
 import org.apache.tamaya.spi.ServiceContextManager;
 
 import javax.management.InstanceNotFoundException;
@@ -39,10 +38,7 @@ import java.util.logging.Logger;
 public final class ConfigModelManager {
 
     /** The logger used. */
-    private final static Logger LOG = 
Logger.getLogger(ConfigModelManager.class.getName());
-
-    private static UsageTrackerSpi usageTracker = ServiceContextManager
-            .getServiceContext().getService(UsageTrackerSpi.class);
+    private static final Logger LOG = 
Logger.getLogger(ConfigModelManager.class.getName());
 
     /**
      * Singleton constructor.
@@ -51,31 +47,6 @@ public final class ConfigModelManager {
     }
 
     /**
-     * Enables/disables usage tracking.
-     * @param enabled set to true to enable usage tracking.
-     */
-    public static void enableUsageTracking(boolean enabled){
-        Objects.requireNonNull(usageTracker, "No UsageTrackerSpi component 
available.")
-                .enableUsageTracking(enabled);
-    }
-
-    /**
-     * Allows to check if usage tracking is enabled /should be disbled by 
default).
-     * @return true, if usage tracking is enabled.
-     */
-    public static boolean isUsageTrackingEnabled(){
-        return Objects.requireNonNull(usageTracker, "No UsageTrackerSpi 
component available.")
-                .isUsageTrackingEnabled();
-    }
-
-    /**
-     * Access the usage statistics for the recorded uses of configuration.
-     */
-    public static String getUsageInfo(){
-        return Objects.requireNonNull(usageTracker, "No UsageTrackerSpi 
component available.").getUsageInfo();
-    }
-
-    /**
      * Access the usage statistics for the recorded uses of configuration.
      */
     public static String getConfigInfoText(){
@@ -230,14 +201,6 @@ public final class ConfigModelManager {
         return result;
     }
 
-    /**
-     * Get the list of package, which are not evaluated for tracking 
configuration access and usage statistics.
-     * @return the set of ignored package names.
-     */
-    public static Set<String> getIgnoredPackages(){
-        return usageTracker.getIgnoredPackages();
-    }
-
     private static java.util.Set<java.lang.String> 
extractTransitiveAreas(Set<String> keys) {
         Set<String> transitiveClosure = new HashSet<>();
         for(String key:keys){
@@ -286,19 +249,4 @@ public final class ConfigModelManager {
         }
     }
 
-    /**
-     * Get the recorded usage references of configuration.
-     * @return the recorded usge references, never null.
-     */
-    public static Collection<Usage> getUsages() {
-        return Objects.requireNonNull(usageTracker, "No UsageTrackerSpi 
component available.").getUsages();
-    }
-
-    /**
-     * Clears all collected usage statistics.
-     */
-    public static void clearUsageStats() {
-        Objects.requireNonNull(usageTracker, "No UsageTrackerSpi component 
available.")
-                .clearUsageStats();
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
----------------------------------------------------------------------
diff --git a/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java 
b/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
new file mode 100644
index 0000000..372150d
--- /dev/null
+++ b/model/src/main/java/org/apache/tamaya/model/ConfigUsageStats.java
@@ -0,0 +1,128 @@
+/*
+ * 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.model;
+
+import org.apache.tamaya.model.spi.ConfigUsageStatsSpi;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.util.Collection;
+import java.util.Objects;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * Validator accessor to validate the current configuration.
+ */
+public final class ConfigUsageStats {
+
+    /** The logger used. */
+    private static final Logger LOG = 
Logger.getLogger(ConfigUsageStats.class.getName());
+    private static final String NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE = "No 
UsageTrackerSpi component available.";
+
+    /** The loaded usage tracking SPI. */
+    private static ConfigUsageStatsSpi usageTracker = ServiceContextManager
+            .getServiceContext().getService(ConfigUsageStatsSpi.class);
+
+    /**
+     * Singleton constructor.
+     */
+    private ConfigUsageStats() {
+    }
+
+    /**
+     * Returnes a set fo package names tha are to be ignored when collecting 
usage data.
+     * @return the ignored package names, not null.
+     */
+    public static Set<String> getIgnoredUsagePackages(){
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .getIgnoredPackages();
+    }
+
+    /**
+     * Adds the given packageNames to the list of packages to be ignored when 
collecting usage data.
+     * @param packageName the package names to be added, not null.
+     */
+    public static void addIgnoredUsagePackages(String... packageName){
+        Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .addIgnoredUsagePackages(packageName);
+    }
+
+    /**
+     * Enables/disables usage tracking.
+     * @param enabled set to true to enable usage tracking.
+     */
+    public static void enableUsageTracking(boolean enabled){
+        Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .enableUsageTracking(enabled);
+    }
+
+    /**
+     * Access the usage statistics for a given key. If usage stats collection 
is not
+     * activated (default), this method returns null.
+     * @param key the fully qualified configuration key, not null.
+     * @return the stats collected, or null.
+     */
+    public static Usage getUsage(String key){
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .getUsage(key);
+    }
+
+    /**
+     * Get the recorded usage references of configuration.
+     * @return the recorded usge references, never null.
+     */
+    public static Collection<Usage> getUsages() {
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE).getUsages();
+    }
+
+    /**
+     * Clears all collected usage statistics.
+     */
+    public static void clearUsageStats() {
+        Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .clearUsageStats();
+    }
+
+    /**
+     * Access the usage statistics for accessing {@link 
org.apache.tamaya.Configuration#getProperties()}.
+     * If usage stats collection is not activated (default), this method 
returns null.
+     * @return the stats collected, or null.
+     */
+    public static Usage getUsageAllProperties(){
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .getUsageAllProperties();
+    }
+
+    /**
+     * Allows to check if usage tracking is enabled /should be disbled by 
default).
+     * @return true, if usage tracking is enabled.
+     */
+    public static boolean isUsageTrackingEnabled(){
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE)
+                .isUsageTrackingEnabled();
+    }
+
+    /**
+     * Access the usage statistics for the recorded uses of configuration.
+     */
+    public static String getUsageInfo(){
+        return Objects.requireNonNull(usageTracker, 
NO_USAGE_TRACKER_SPI_COMPONENT_MESSAGE).getUsageInfo();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/Usage.java
----------------------------------------------------------------------
diff --git a/model/src/main/java/org/apache/tamaya/model/Usage.java 
b/model/src/main/java/org/apache/tamaya/model/Usage.java
index d5625f3..08358af 100644
--- a/model/src/main/java/org/apache/tamaya/model/Usage.java
+++ b/model/src/main/java/org/apache/tamaya/model/Usage.java
@@ -35,6 +35,7 @@ import java.util.logging.Logger;
  */
 public final class Usage {
     private static final Logger LOG = Logger.getLogger(Usage.class.getName());
+    private static final String[] EMPTY_TRACE = new String[0];
     /**
      * the config section.
      */
@@ -44,6 +45,10 @@ public final class Usage {
      * Maps with usage references, key is the fully qualified package name.
      */
     private final Map<String,AccessDetail> accessDetails = new 
ConcurrentHashMap<>();
+    /**
+     * The maximal length of the stacktrace stored.
+     */
+    private static int maxTrace = 10;
 
     /**
      * Creates a usage metric container for a given key.
@@ -54,6 +59,23 @@ public final class Usage {
     }
 
     /**
+     * Get the maximal length of the stack traces recorded, default is 10.
+     * @return the maximal length of the stack traces recorded
+     */
+    public static int getMaxTraceLength(){
+        return Usage.maxTrace;
+    }
+
+    /**
+     * Sets the maximal length of the stacktraces stored when tracking 
configuration
+     * usage. Setting it to a negative value, disabled stacktrace logging.
+     * @param maxTrace the maximal recorded stack length.
+     */
+    public static void setMaxTraceLength(int maxTrace){
+        Usage.maxTrace =maxTrace;
+    }
+
+    /**
      * Get the configModel section.
      *
      * @return the section, never null.
@@ -144,7 +166,7 @@ public final class Usage {
      * @param value the value returned, not null.
      */
     public void trackUsage(String value){
-        trackUsage(value, 10);
+        trackUsage(value, maxTrace);
     }
 
     /**
@@ -154,31 +176,37 @@ public final class Usage {
      * @param maxTraceLength the maximal length of the stored stacktrace.
      */
     public void trackUsage(String value, int maxTraceLength){
-
-        Exception e = new Exception();
-        List<String> trace = new ArrayList<>();
         String accessPoint = null;
-        stack:for(StackTraceElement ste:e.getStackTrace()){
-            for(String ignored: ConfigModelManager.getIgnoredPackages()) {
-                if (ste.getClassName().startsWith(ignored)) {
-                    continue stack;
+        if(maxTraceLength>0) {
+            Exception e = new Exception();
+            List<String> trace = new ArrayList<>();
+            stack:
+            for (StackTraceElement ste : e.getStackTrace()) {
+                for (String ignored : 
ConfigUsageStats.getIgnoredUsagePackages()) {
+                    if (ste.getClassName().startsWith(ignored)) {
+                        continue stack;
+                    }
+                }
+                String ref = ste.getClassName() + '#' + ste.getMethodName() + 
"(line:" + ste.getLineNumber() + ')';
+                trace.add(ref);
+                if (accessPoint == null) {
+                    accessPoint = ref;
+                }
+                if (trace.size() >= maxTraceLength) {
+                    break;
                 }
             }
-            String ref = ste.getClassName() + '#' + ste.getMethodName() + 
"(line:" + ste.getLineNumber() + ')';
-            trace.add(ref);
             if (accessPoint == null) {
-                accessPoint = ref;
-            }
-            if(trace.size()>=maxTraceLength){
-                break;
+                // all ignored, take first one, with different package
+                accessPoint = "<unknown/filtered/internal>";
             }
+            AccessDetail details = getAccessDetails(accessPoint, 
trace.toArray(new String[trace.size()]));
+            details.trackAccess(value);
+        }else{
+            accessPoint = "<disabled>";
+            AccessDetail details = getAccessDetails(accessPoint, EMPTY_TRACE);
+            details.trackAccess(value);
         }
-        if (accessPoint == null) {
-            // all ignored, take first one, with different package
-            accessPoint = "<unknown/filtered/internal>";
-        }
-        AccessDetail details = getAccessDetails(accessPoint, trace.toArray(new 
String[trace.size()]));
-        details.trackAccess(value);
     }
 
     private AccessDetail getAccessDetails(String accessPoint, String[] trace) {
@@ -250,10 +278,10 @@ public final class Usage {
         }
 
         public Map<Long, String> getTrackedValues(){
-            if(trackedValues==null){
-                return Collections.emptyMap();
-            }else{
-                synchronized (this) {
+            synchronized (this) {
+                if (trackedValues == null) {
+                    return Collections.emptyMap();
+                } else {
                     return new HashMap<>(trackedValues);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/internal/DefaultConfigUsageStats.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/internal/DefaultConfigUsageStats.java
 
b/model/src/main/java/org/apache/tamaya/model/internal/DefaultConfigUsageStats.java
new file mode 100644
index 0000000..3ba1d4c
--- /dev/null
+++ 
b/model/src/main/java/org/apache/tamaya/model/internal/DefaultConfigUsageStats.java
@@ -0,0 +1,176 @@
+/*
+ * 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.model.internal;
+
+import org.apache.tamaya.model.Usage;
+import org.apache.tamaya.model.spi.ConfigUsageStatsSpi;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Created by atsticks on 29.04.16.
+ */
+public class DefaultConfigUsageStats implements ConfigUsageStatsSpi {
+
+    private Set<String> ignoredPackages = new HashSet<>();
+
+    private Map<String, Usage> usages = new ConcurrentHashMap<>();
+
+    /** By default usage tracking is not enabled. */
+    private boolean usageTrackingEnabled = initEnabled();
+
+    /**
+     * Method that checks the 'tamaya.usage-report' system property for
+     * enabling tamaya usage reporting initially.
+     * @return
+     */
+    private boolean initEnabled() {
+        String val = System.getProperty("tamaya.usage-report");
+        if(Boolean.parseBoolean(val)){
+            return true;
+        }
+        return false;
+    }
+
+    public DefaultConfigUsageStats(){
+        ignoredPackages.add("com.intellij");
+        ignoredPackages.add("java");
+        ignoredPackages.add("org.junit");
+        ignoredPackages.add("junit");
+        ignoredPackages.add("javax");
+        ignoredPackages.add("sun");
+        ignoredPackages.add("oracle");
+        ignoredPackages.add("com.sun");
+        ignoredPackages.add("com.oracle");
+        ignoredPackages.add("org.apache.tamaya");
+    }
+
+    @Override
+    public void enableUsageTracking(boolean enabled){
+        this.usageTrackingEnabled = enabled;
+    }
+
+    @Override
+    public boolean isUsageTrackingEnabled(){
+        return usageTrackingEnabled;
+    }
+
+    @Override
+    public Set<String> getIgnoredPackages() {
+        return Collections.unmodifiableSet(ignoredPackages);
+    }
+
+    @Override
+    public void addIgnoredUsagePackages(String... packageName) {
+
+    }
+
+    @Override
+    public Usage getUsage(String key) {
+        return this.usages.get(key);
+    }
+
+    @Override
+    public Usage getUsageAllProperties() {
+        return this.usages.get("<<all>>");
+    }
+
+    /**
+     * Get the recorded usage references of configuration.
+     * @return the recorded usge references, never null.
+     */
+    @Override
+    public Collection<Usage> getUsages() {
+        return usages.values();
+    }
+
+    @Override
+    public void trackAllPropertiesAccess(){
+        trackSingleKeyAccess("<<all>>", "<not stored>");
+    }
+
+    @Override
+    public void trackSingleKeyAccess(String key, String value){
+        // Ignore meta-entries
+        if(!isUsageTrackingEnabled() || key.startsWith("_")){
+            return;
+        }
+        Usage usage = this.usages.get(key);
+        if(usage==null){
+            usage = new Usage(key);
+            this.usages.put(key, usage);
+        }
+        usage.trackUsage(value);
+    }
+
+
+    /**
+     * Access the usage statistics for the recorded uses of configuration.
+     */
+    @Override
+    public String getUsageInfo(){
+        StringBuilder b = new StringBuilder();
+        b.append("Apache Tamaya Configuration Usage Metrics\n");
+        b.append("=========================================\n");
+        b.append("DATE: " + new Date()).append("\n\n");
+        List<Usage> usages = new ArrayList<>(getUsages());
+        Collections.sort(usages, new Comparator<Usage>() {
+            @Override
+            public int compare(Usage k1, Usage k2) {
+                return k2.getUsageCount() - k1.getUsageCount();
+            }
+        });
+        for(Usage usage:usages){
+            String usageCount = String.valueOf(usage.getUsageCount());
+            b.append(usageCount);
+            b.append("       ".substring(0, 7-usageCount.length()));
+            b.append(usage.getKey()).append(":\n");
+            for(Usage.AccessDetail details: usage.getAccessDetails()) {
+                String accessCount = String.valueOf(details.getAccessCount());
+                    b.append("  - ").append(accessCount);
+                    b.append("      ".substring(0, 6-usageCount.length()));
+                    b.append(details.getAccessPoint());
+                    int endIndex = 50-details.getAccessPoint().length();
+                    if(endIndex<0){
+                        endIndex = 0;
+                    }
+                    b.append("                                                 
 ".substring(0, endIndex));
+                    b.append(",");b.append(" first=").append(new 
Date(details.getFirstAccessTS()))
+                            .append(",");b.append(" last=").append(new 
Date(details.getLastAccessTS()))
+                            .append('\n');
+            }
+        }
+        return b.toString();
+    }
+
+    @Override
+    public void clearUsageStats() {
+        this.usages.clear();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/internal/DefaultUsageTracker.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/internal/DefaultUsageTracker.java 
b/model/src/main/java/org/apache/tamaya/model/internal/DefaultUsageTracker.java
deleted file mode 100644
index 9a502a4..0000000
--- 
a/model/src/main/java/org/apache/tamaya/model/internal/DefaultUsageTracker.java
+++ /dev/null
@@ -1,166 +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.model.internal;
-
-import org.apache.tamaya.model.Usage;
-import org.apache.tamaya.model.spi.UsageTrackerSpi;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Created by atsticks on 29.04.16.
- */
-public class DefaultUsageTracker implements UsageTrackerSpi{
-
-    private Set<String> ignoredPackages = new HashSet<>();
-
-    private Map<String, Usage> usages = new ConcurrentHashMap<>();
-
-    /** By default usage tracking is not enabled. */
-    private boolean usageTrackingEnabled = initEnabled();
-
-    /**
-     * Method that checks the 'tamaya.usage-report' system property for
-     * enabling tamaya usage reporting initially.
-     * @return
-     */
-    private boolean initEnabled() {
-        String val = System.getProperty("tamaya.usage-report");
-        if(Boolean.parseBoolean(val)){
-            return true;
-        }
-        return false;
-    }
-
-    public DefaultUsageTracker(){
-        ignoredPackages.add("com.intellij");
-        ignoredPackages.add("java");
-        ignoredPackages.add("org.junit");
-        ignoredPackages.add("junit");
-        ignoredPackages.add("javax");
-        ignoredPackages.add("sun");
-        ignoredPackages.add("oracle");
-        ignoredPackages.add("com.sun");
-        ignoredPackages.add("com.oracle");
-        ignoredPackages.add("org.apache.tamaya");
-    }
-
-    @Override
-    public void enableUsageTracking(boolean enabled){
-        this.usageTrackingEnabled = enabled;
-    }
-
-    @Override
-    public boolean isUsageTrackingEnabled(){
-        return usageTrackingEnabled;
-    }
-
-    @Override
-    public Set<String> getIgnoredPackages() {
-        return Collections.unmodifiableSet(ignoredPackages);
-    }
-
-    /**
-     * Get the recorded usage references of configuration.
-     * @return the recorded usge references, never null.
-     */
-    @Override
-    public Collection<Usage> getUsages() {
-        return usages.values();
-    }
-
-    @Override
-    public void trackConfigurationAccess(){
-        trackSingleKeyAccess("[[Configuration]]", "<not stored>");
-    }
-
-    @Override
-    public void trackAllPropertiesAccess(){
-        trackSingleKeyAccess("<<all>>", "<not stored>");
-    }
-
-    @Override
-    public void trackSingleKeyAccess(String key, String value){
-        // Ignore meta-entries
-        if(!isUsageTrackingEnabled() || key.startsWith("_")){
-            return;
-        }
-        Usage usage = this.usages.get(key);
-        if(usage==null){
-            usage = new Usage(key);
-            this.usages.put(key, usage);
-        }
-        usage.trackUsage(value);
-    }
-
-
-    /**
-     * Access the usage statistics for the recorded uses of configuration.
-     */
-    @Override
-    public String getUsageInfo(){
-        StringBuilder b = new StringBuilder();
-        b.append("Apache Tamaya Configuration Usage Metrics\n");
-        b.append("=========================================\n");
-        b.append("DATE: " + new Date()).append("\n\n");
-        List<Usage> usages = new ArrayList<>(getUsages());
-        Collections.sort(usages, new Comparator<Usage>() {
-            @Override
-            public int compare(Usage k1, Usage k2) {
-                return k2.getUsageCount() - k1.getUsageCount();
-            }
-        });
-        for(Usage usage:usages){
-            String usageCount = String.valueOf(usage.getUsageCount());
-            b.append(usageCount);
-            b.append("       ".substring(0, 7-usageCount.length()));
-            b.append(usage.getKey()).append(":\n");
-            for(Usage.AccessDetail details: usage.getAccessDetails()) {
-                String accessCount = String.valueOf(details.getAccessCount());
-                    b.append("  - ").append(accessCount);
-                    b.append("      ".substring(0, 6-usageCount.length()));
-                    b.append(details.getAccessPoint());
-                    int endIndex = 50-details.getAccessPoint().length();
-                    if(endIndex<0){
-                        endIndex = 0;
-                    }
-                    b.append("                                                 
 ".substring(0, endIndex));
-                    b.append(",");b.append(" first=").append(new 
Date(details.getFirstAccessTS()))
-                            .append(",");b.append(" last=").append(new 
Date(details.getLastAccessTS()))
-                            .append('\n');
-            }
-        }
-        return b.toString();
-    }
-
-    @Override
-    public void clearUsageStats() {
-        this.usages.clear();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/internal/UsageTrackerFilter.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/internal/UsageTrackerFilter.java 
b/model/src/main/java/org/apache/tamaya/model/internal/UsageTrackerFilter.java
index 6dac53f..d27491e 100644
--- 
a/model/src/main/java/org/apache/tamaya/model/internal/UsageTrackerFilter.java
+++ 
b/model/src/main/java/org/apache/tamaya/model/internal/UsageTrackerFilter.java
@@ -18,7 +18,7 @@
  */
 package org.apache.tamaya.model.internal;
 
-import org.apache.tamaya.model.spi.UsageTrackerSpi;
+import org.apache.tamaya.model.spi.ConfigUsageStatsSpi;
 import org.apache.tamaya.spi.FilterContext;
 import org.apache.tamaya.spi.PropertyFilter;
 import org.apache.tamaya.spi.ServiceContextManager;
@@ -35,7 +35,7 @@ public class UsageTrackerFilter implements PropertyFilter{
 
     @Override
     public String filterProperty(String value, FilterContext context) {
-            UsageTrackerSpi tracker = 
ServiceContextManager.getServiceContext().getService(UsageTrackerSpi.class);
+            ConfigUsageStatsSpi tracker = 
ServiceContextManager.getServiceContext().getService(ConfigUsageStatsSpi.class);
         if (context.isSinglePropertyScoped()) {
             tracker.trackSingleKeyAccess(context.getKey(), value);
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/spi/ConfigUsageStatsSpi.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/spi/ConfigUsageStatsSpi.java 
b/model/src/main/java/org/apache/tamaya/model/spi/ConfigUsageStatsSpi.java
new file mode 100644
index 0000000..90753d2
--- /dev/null
+++ b/model/src/main/java/org/apache/tamaya/model/spi/ConfigUsageStatsSpi.java
@@ -0,0 +1,98 @@
+/*
+ * 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.model.spi;
+
+import org.apache.tamaya.model.Usage;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * SPI to implemented by the component responsible for usage tracking of
+ * configuration.
+ */
+public interface ConfigUsageStatsSpi {
+
+    /**
+     * Enables/disables usage tracking.
+     * @param enable set to true to enable usage tracking.
+     */
+    void enableUsageTracking(boolean enable);
+
+    /**
+     * Allows to check if usage tracking is enabled /should be disbled by 
default).
+     * @return true, if usage tracking is enabled.
+     */
+    boolean isUsageTrackingEnabled();
+
+    /**
+     * Get the list of package, which are not evaluated for tracking 
configuration access and usage statistics.
+     * @return the set of ignored package names.
+     */
+    Set<String> getIgnoredPackages();
+
+    /**
+     * Adds the given packageNames to the list of packages to be ignored when 
collecting usage data.
+     * @param packageName the package names to be added, not null.
+     */
+    void addIgnoredUsagePackages(String... packageName);
+
+    /**
+     * Access the usage statistics for a given key. If usage stats collection 
is not
+     * activated (default), this method returns null.
+     * @param key the fully qualified configuration key, not null.
+     * @return the stats collected, or null.
+     */
+    Usage getUsage(String key);
+
+    /**
+     * Access the usage statistics for accessing {@link 
org.apache.tamaya.Configuration#getProperties()}.
+     * If usage stats collection is not activated (default), this method 
returns null.
+     * @return the stats collected, or null.
+     */
+    Usage getUsageAllProperties();
+
+    /**
+     * Get the recorded usage references of configuration.
+     * @return the recorded usge references, never null.
+     */
+    Collection<Usage> getUsages();
+
+    /**
+     * Track the access of {@code Configuration#getProperties()} for
+     * usage statistics.
+     */
+    void trackAllPropertiesAccess();
+
+    /**
+     * Track the access of {@code Configuration#get(String)} for
+     * usage statistics.
+     */
+    void trackSingleKeyAccess(String key, String value);
+
+    /**
+     * Access the usage statistics for the recorded uses of configuration.
+     */
+    String getUsageInfo();
+
+    /**
+     * Clears all collected usage statistics.
+     */
+    void clearUsageStats();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/java/org/apache/tamaya/model/spi/UsageTrackerSpi.java
----------------------------------------------------------------------
diff --git 
a/model/src/main/java/org/apache/tamaya/model/spi/UsageTrackerSpi.java 
b/model/src/main/java/org/apache/tamaya/model/spi/UsageTrackerSpi.java
deleted file mode 100644
index d84b636..0000000
--- a/model/src/main/java/org/apache/tamaya/model/spi/UsageTrackerSpi.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.model.spi;
-
-import org.apache.tamaya.model.Usage;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * SPI to implemented by the component responsible for usage tracking of
- * configuration.
- */
-public interface UsageTrackerSpi {
-
-    /**
-     * Enables/disables usage tracking.
-     * @param enable set to true to enable usage tracking.
-     */
-    void enableUsageTracking(boolean enable);
-
-    /**
-     * Allows to check if usage tracking is enabled /should be disbled by 
default).
-     * @return true, if usage tracking is enabled.
-     */
-    boolean isUsageTrackingEnabled();
-
-    /**
-     * Get the list of package, which are not evaluated for tracking 
configuration access and usage statistics.
-     * @return the set of ignored package names.
-     */
-    Set<String> getIgnoredPackages();
-
-    /**
-     * Get the recorded usage references of configuration.
-     * @return the recorded usge references, never null.
-     */
-    Collection<Usage> getUsages();
-
-    /**
-     * Track the access of {@code ConfigurationProvider#getConfiguration()} for
-     * usage statistics.
-     */
-    void trackConfigurationAccess();
-
-    /**
-     * Track the access of {@code Configuration#getProperties()} for
-     * usage statistics.
-     */
-    void trackAllPropertiesAccess();
-
-    /**
-     * Track the access of {@code Configuration#get(String)} for
-     * usage statistics.
-     */
-    void trackSingleKeyAccess(String key, String value);
-
-    /**
-     * Access the usage statistics for the recorded uses of configuration.
-     */
-    String getUsageInfo();
-
-    /**
-     * Clears all collected usage statistics.
-     */
-    void clearUsageStats();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.ConfigUsageStatsSpi
----------------------------------------------------------------------
diff --git 
a/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.ConfigUsageStatsSpi
 
b/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.ConfigUsageStatsSpi
new file mode 100644
index 0000000..92299da
--- /dev/null
+++ 
b/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.ConfigUsageStatsSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy current the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.model.internal.DefaultConfigUsageStats
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.UsageTrackerSpi
----------------------------------------------------------------------
diff --git 
a/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.UsageTrackerSpi
 
b/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.UsageTrackerSpi
deleted file mode 100644
index 1a87f60..0000000
--- 
a/model/src/main/resources/META-INF/services/org.apache.tamaya.model.spi.UsageTrackerSpi
+++ /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.model.internal.DefaultUsageTracker
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/test/java/org/apache/tamaya/model/ConfigModelProviderTest.java
----------------------------------------------------------------------
diff --git 
a/model/src/test/java/org/apache/tamaya/model/ConfigModelProviderTest.java 
b/model/src/test/java/org/apache/tamaya/model/ConfigModelProviderTest.java
new file mode 100644
index 0000000..32c8774
--- /dev/null
+++ b/model/src/test/java/org/apache/tamaya/model/ConfigModelProviderTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.model;
+
+import org.apache.tamaya.model.spi.SectionModel;
+import org.apache.tamaya.model.spi.ParameterModel;
+import org.apache.tamaya.model.spi.GroupModel;
+import org.apache.tamaya.model.spi.ModelProviderSpi;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * Created by Anatole on 09.08.2015.
+ */
+public class ConfigModelProviderTest implements ModelProviderSpi {
+
+    private List<ConfigModel> configModels = new ArrayList<>(1);
+
+    public ConfigModelProviderTest(){
+        configModels.add(new TestConfigModel());
+        configModels = Collections.unmodifiableList(configModels);
+    }
+
+    public Collection<ConfigModel> getConfigModels() {
+        return configModels;
+    }
+
+    private static final class TestConfigModel extends GroupModel {
+
+        public TestConfigModel(){
+            super("TestConfig", new 
SectionModel.Builder("a.test.existing").setRequired(true).build(),
+                    ParameterModel.of("a.test.existing.aParam", true),
+                    ParameterModel.of("a.test.existing.optionalParam"),
+                    ParameterModel.of("a.test.existing.aABCParam", false, 
"[ABC].*"),
+                    new 
SectionModel.Builder("a.test.notexisting").setRequired(true).build(),
+                    ParameterModel.of("a.test.notexisting.aParam", true),
+                    ParameterModel.of("a.test.notexisting.optionalParam"),
+                    ParameterModel.of("a.test.existing.aABCParam2", false, 
"[ABC].*"));
+        }
+        @Override
+        public String getName() {
+            return "TestConfigConfigModel";
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/test/java/org/apache/tamaya/model/ConfigUsageStatsTest.java
----------------------------------------------------------------------
diff --git 
a/model/src/test/java/org/apache/tamaya/model/ConfigUsageStatsTest.java 
b/model/src/test/java/org/apache/tamaya/model/ConfigUsageStatsTest.java
new file mode 100644
index 0000000..ef56e73
--- /dev/null
+++ b/model/src/test/java/org/apache/tamaya/model/ConfigUsageStatsTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.model;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.model.spi.GroupModel;
+import org.apache.tamaya.model.spi.ModelProviderSpi;
+import org.apache.tamaya.model.spi.ParameterModel;
+import org.apache.tamaya.model.spi.SectionModel;
+import org.junit.Test;
+import test.model.TestConfigAccessor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by Anatole on 09.08.2015.
+ */
+public class ConfigUsageStatsTest implements ModelProviderSpi {
+
+    private List<ConfigModel> configModels = new ArrayList<>(1);
+
+    public ConfigUsageStatsTest(){
+        configModels.add(new TestConfigModel());
+        configModels = Collections.unmodifiableList(configModels);
+    }
+
+    public Collection<ConfigModel> getConfigModels() {
+        return configModels;
+    }
+
+    private static final class TestConfigModel extends GroupModel {
+
+        public TestConfigModel(){
+            super("TestConfig", new 
SectionModel.Builder("a.test.existing").setRequired(true).build(),
+                    ParameterModel.of("a.test.existing.aParam", true),
+                    ParameterModel.of("a.test.existing.optionalParam"),
+                    ParameterModel.of("a.test.existing.aABCParam", false, 
"[ABC].*"),
+                    new 
SectionModel.Builder("a.test.notexisting").setRequired(true).build(),
+                    ParameterModel.of("a.test.notexisting.aParam", true),
+                    ParameterModel.of("a.test.notexisting.optionalParam"),
+                    ParameterModel.of("a.test.existing.aABCParam2", false, 
"[ABC].*"));
+        }
+        @Override
+        public String getName() {
+            return "TestConfigConfigModel";
+        }
+
+    }
+
+    @Test
+    public void testUsageWhenEnabled(){
+        ConfigUsageStats.enableUsageTracking(true);
+        TestConfigAccessor.readConfiguration();
+        Configuration config = ConfigurationProvider.getConfiguration();
+        String info = ConfigUsageStats.getUsageInfo();
+        assertFalse(info.contains("java.version"));
+        assertNotNull(info);
+        config = TestConfigAccessor.readConfiguration();
+        config.getProperties();
+        TestConfigAccessor.readProperty(config, "java.locale");
+        TestConfigAccessor.readProperty(config, "java.version");
+        TestConfigAccessor.readProperty(config, "java.version");
+        config.get("java.version");
+        info = ConfigUsageStats.getUsageInfo();
+        System.out.println(info);
+        assertTrue(info.contains("java.version"));
+        assertNotNull(info);
+        ConfigUsageStats.enableUsageTracking(false);
+    }
+
+    @Test
+    public void testUsageWhenDisabled(){
+        ConfigUsageStats.enableUsageTracking(false);
+        ConfigUsageStats.clearUsageStats();
+        TestConfigAccessor.readConfiguration();
+        Configuration config = ConfigurationProvider.getConfiguration();
+        String info = ConfigUsageStats.getUsageInfo();
+        assertNotNull(info);
+        assertFalse(info.contains("java.version"));
+        config = TestConfigAccessor.readConfiguration();
+        config.getProperties();
+        TestConfigAccessor.readProperty(config, "java.locale");
+        TestConfigAccessor.readProperty(config, "java.version");
+        TestConfigAccessor.readProperty(config, "java.version");
+        config.get("java.version");
+        info = ConfigUsageStats.getUsageInfo();
+        assertFalse(info.contains("java.version"));
+        assertNotNull(info);
+        ConfigUsageStats.enableUsageTracking(false);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/test/java/org/apache/tamaya/model/TestConfigModelProvider.java
----------------------------------------------------------------------
diff --git 
a/model/src/test/java/org/apache/tamaya/model/TestConfigModelProvider.java 
b/model/src/test/java/org/apache/tamaya/model/TestConfigModelProvider.java
deleted file mode 100644
index 70ca611..0000000
--- a/model/src/test/java/org/apache/tamaya/model/TestConfigModelProvider.java
+++ /dev/null
@@ -1,115 +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.model;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.model.spi.SectionModel;
-import org.apache.tamaya.model.spi.ParameterModel;
-import org.apache.tamaya.model.spi.GroupModel;
-import org.apache.tamaya.model.spi.ModelProviderSpi;
-import org.junit.Test;
-import test.model.TestConfigAccessor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Created by Anatole on 09.08.2015.
- */
-public class TestConfigModelProvider implements ModelProviderSpi {
-
-    private List<ConfigModel> configModels = new ArrayList<>(1);
-
-    public TestConfigModelProvider(){
-        configModels.add(new TestConfigModel());
-        configModels = Collections.unmodifiableList(configModels);
-    }
-
-    public Collection<ConfigModel> getConfigModels() {
-        return configModels;
-    }
-
-    private static final class TestConfigModel extends GroupModel {
-
-        public TestConfigModel(){
-            super("TestConfig", new 
SectionModel.Builder("a.test.existing").setRequired(true).build(),
-                    ParameterModel.of("a.test.existing.aParam", true),
-                    ParameterModel.of("a.test.existing.optionalParam"),
-                    ParameterModel.of("a.test.existing.aABCParam", false, 
"[ABC].*"),
-                    new 
SectionModel.Builder("a.test.notexisting").setRequired(true).build(),
-                    ParameterModel.of("a.test.notexisting.aParam", true),
-                    ParameterModel.of("a.test.notexisting.optionalParam"),
-                    ParameterModel.of("a.test.existing.aABCParam2", false, 
"[ABC].*"));
-        }
-        @Override
-        public String getName() {
-            return "TestConfigConfigModel";
-        }
-
-    }
-
-    @Test
-    public void testUsageWhenEnabled(){
-        ConfigModelManager.enableUsageTracking(true);
-        TestConfigAccessor.readConfiguration();
-        Configuration config = ConfigurationProvider.getConfiguration();
-        String info = ConfigModelManager.getUsageInfo();
-        assertFalse(info.contains("java.version"));
-        assertNotNull(info);
-        config = TestConfigAccessor.readConfiguration();
-        config.getProperties();
-        TestConfigAccessor.readProperty(config, "java.locale");
-        TestConfigAccessor.readProperty(config, "java.version");
-        TestConfigAccessor.readProperty(config, "java.version");
-        config.get("java.version");
-        info = ConfigModelManager.getUsageInfo();
-        System.out.println(info);
-        assertTrue(info.contains("java.version"));
-        assertNotNull(info);
-        ConfigModelManager.enableUsageTracking(false);
-    }
-
-    @Test
-    public void testUsageWhenDisabled(){
-        ConfigModelManager.enableUsageTracking(false);
-        ConfigModelManager.clearUsageStats();
-        TestConfigAccessor.readConfiguration();
-        Configuration config = ConfigurationProvider.getConfiguration();
-        String info = ConfigModelManager.getUsageInfo();
-        assertNotNull(info);
-        assertFalse(info.contains("java.version"));
-        config = TestConfigAccessor.readConfiguration();
-        config.getProperties();
-        TestConfigAccessor.readProperty(config, "java.locale");
-        TestConfigAccessor.readProperty(config, "java.version");
-        TestConfigAccessor.readProperty(config, "java.version");
-        config.get("java.version");
-        info = ConfigModelManager.getUsageInfo();
-        assertFalse(info.contains("java.version"));
-        assertNotNull(info);
-        ConfigModelManager.enableUsageTracking(false);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/12261be2/model/src/test/resources/META-INF/services/org.apache.tamaya.model.spi.ModelProviderSpi
----------------------------------------------------------------------
diff --git 
a/model/src/test/resources/META-INF/services/org.apache.tamaya.model.spi.ModelProviderSpi
 
b/model/src/test/resources/META-INF/services/org.apache.tamaya.model.spi.ModelProviderSpi
index e2d3350..9b29fda 100644
--- 
a/model/src/test/resources/META-INF/services/org.apache.tamaya.model.spi.ModelProviderSpi
+++ 
b/model/src/test/resources/META-INF/services/org.apache.tamaya.model.spi.ModelProviderSpi
@@ -16,4 +16,4 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-org.apache.tamaya.model.TestConfigModelProvider
\ No newline at end of file
+org.apache.tamaya.model.ConfigModelProviderTest
\ No newline at end of file

Reply via email to