tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [incubator-tamaya-sandbox] 04/05: Initial experiments with config documentation.
Date Thu, 21 Feb 2019 22:17:42 GMT
This is an automated email from the ASF dual-hosted git repository.

anatole pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya-sandbox.git

commit 0bf2d02060c43e0f1302b71e529faf99f9810246
Merge: 1732596 d6a0673
Author: Anatole Tresch <atsticks@gmail.com>
AuthorDate: Thu Feb 21 23:12:10 2019 +0100

    Initial experiments with config documentation.

 buildtools/src/main/resources/checkstyle/style.xml | 153 ++++++++++++++++++
 .../src/main/resources/checkstyle/suppressions.xml |  25 +++
 camel/pom.xml                                      |   5 +-
 .../tamaya/camel/TamayaPropertyResolverTest.java   |  16 +-
 configjsr/pom.xml                                  |   6 -
 .../apache/tamaya/jsr382/JavaConfigAdapter.java    |   1 -
 .../tamaya/jsr382/JavaConfigAdapterFactory.java    |  14 +-
 .../tamaya/jsr382/JavaConfigBuilderAdapter.java    |   3 +-
 .../tamaya/jsr382/JavaConfigConverterAdapter.java  |   1 +
 ...rter.java => PrioritizedPropertyConverter.java} |  16 +-
 .../jsr382/TamayaConfigProviderResolver.java       |   1 -
 .../tamaya/jsr382/TamayaConfigurationAdapter.java  |   4 +-
 .../jsr382/TamayaPropertyConverterAdapter.java     |   1 +
 .../cdi/JavaConfigConfigurationProducer.java       |   1 -
 .../converter/BooleanAsIntegerConverterFix.java    |   1 -
 .../tamaya/jsr382/converter/ProviderConverter.java |   4 +
 .../tamaya/jsr382/BuildableConfigSource.java       |   8 +-
 .../tamaya/jsr382/JavaConfigAdapterTest.java       |  63 ++++----
 .../tamaya/jsr382/JavaConfigConfigBuilderTest.java |  39 +++--
 .../JavaConfigConfigProviderResolverTest.java      |  22 +--
 .../jsr382/JavaConfigConfigProviderTest.java       |  16 +-
 .../jsr382/JavaConfigConfigSourceProviderTest.java |  12 +-
 .../apache/tamaya/jsr382/JavaConfigConfigTest.java |  15 +-
 .../org/apache/tamaya/jsr382/SmokeExamples.java    |   6 +-
 .../sysprops/ConfiguredSystemProperties.java       |   6 +-
 documentation/pom.xml                              |   4 +-
 .../org/apache/tamaya/doc/ConfigDocumenter.java    |   6 +-
 .../main/java/org/apache/tamaya/doc/DocFormat.java |   4 +
 .../java/org/apache/tamaya/doc/DocumentedArea.java |  15 +-
 ...mentation.java => DocumentedConfiguration.java} |  24 +--
 .../org/apache/tamaya/doc/DocumentedProperty.java  |  11 +-
 .../apache/tamaya/doc/annot/ConfigAreaSpec.java    |   6 +-
 .../tamaya/doc/annot/ConfigPropertySpec.java       |   3 +
 .../apache/tamaya/doc/formats/HtmlDocFormat.java   |  25 ++-
 .../apache/tamaya/doc/formats/TextDocFormat.java   |  12 +-
 .../apache/tamaya/doc/ConfigDocumenterTest.java    |  10 +-
 hjson/pom.xml                                      |   4 -
 .../java/org/apache/tamaya/hjson/HJSONFormat.java  |   2 -
 .../hjson/CommonHJSONTestCaseCollection.java       |  91 +++++------
 .../org/apache/tamaya/hjson/HJSONFormatIT.java     |   5 +-
 .../org/apache/tamaya/hjson/HJSONFormatTest.java   |  13 +-
 .../tamaya/hjson/HJSONPropertySourceTest.java      |  10 +-
 .../org/apache/tamaya/hjson/HJSONVisitorTest.java  |  98 ++++++------
 .../PathBasedHJSONPropertySourceProviderTest.java  |  17 +-
 jodatime/pom.xml                                   |   6 +-
 .../apache/tamaya/jodatime/DateTimeConverter.java  |   6 +-
 .../apache/tamaya/jodatime/InstantConverter.java   |  10 +-
 .../apache/tamaya/jodatime/LocalDateConverter.java |   6 +-
 .../apache/tamaya/jodatime/LocalTimeConverter.java |   2 +-
 .../tamaya/jodatime/DateTimeConverterIT.java       |   9 +-
 .../tamaya/jodatime/DateTimeConverterTest.java     |  22 +--
 .../tamaya/jodatime/DateTimeZoneConverterIT.java   |   9 +-
 .../tamaya/jodatime/DateTimeZoneConverterTest.java |  20 +--
 .../tamaya/jodatime/DurationConverterIT.java       |   8 +-
 .../tamaya/jodatime/DurationConverterTest.java     |  21 +--
 .../org/apache/tamaya/jodatime/FullStackIT.java    |  24 ++-
 .../apache/tamaya/jodatime/PeriodConverterIT.java  |   8 +-
 .../tamaya/jodatime/PeriodConverterTest.java       |  20 +--
 management/pom.xml                                 |   8 +-
 .../management/internal/ManagedConfigTest.java     |  71 ++++-----
 metamodel/pom.xml                                  |  12 +-
 .../org/apache/tamaya/metamodel/CachedFilter.java  |   3 +
 .../tamaya/metamodel/EnabledPropertySource.java    |   4 +-
 .../org/apache/tamaya/metamodel/MaskFilter.java    |   3 +
 .../org/apache/tamaya/metamodel/MetaContext.java   |  25 ++-
 .../org/apache/tamaya/metamodel/SecuredFilter.java |   6 +-
 .../metamodel/internal/ComponentConfigurator.java  |   6 +-
 .../metamodel/internal/ComponentFactory.java       |   1 +
 .../metamodel/internal/MetaContextReader.java      |  16 +-
 .../metamodel/internal/PropertySourceReader.java   |   5 +-
 .../factories/URLPropertySourceFactory.java        |   6 +
 .../metamodel/internal/resolver/JavaResolver.java  |   8 +-
 .../internal/resolver/PropertiesResolver.java      |   2 -
 .../apache/tamaya/metamodel/spi/ItemFactory.java   |   1 +
 .../tamaya/metamodel/spi/ItemFactoryManager.java   |  18 ++-
 .../tamaya/metamodel/ext/IntegrationTest.java      | 174 ++++++++++-----------
 .../factories/CLIArgumentsFactoryTest.java         |  13 +-
 .../factories/EnvPropertiesFactoryTest.java        |  12 +-
 .../factories/FilePropertySourceFactoryTest.java   |  12 +-
 .../ResourcePropertySourceFactoryTest.java         |  12 +-
 .../ResourcePropertySourceProviderFactoryTest.java |  13 +-
 .../factories/SysPropertiesFactoryTest.java        |  12 +-
 .../factories/URLPropertySourceFactoryTest.java    |  12 +-
 .../internal/resolver/JavaResolverTest.java        |  36 ++---
 .../metamodel/internal/resolver/LoggingReader.java |   4 +-
 .../internal/resolver/PropertiesResolverTest.java  |  14 +-
 pom.xml                                            |  59 +++----
 propertysources/pom.xml                            |   8 +-
 .../ConfigDirPropertySourceProvider.java           |   2 -
 .../MetainfConfigPropertySourceProvider.java       |   2 -
 .../MetainfConfigPropertySourceProviderTest.java   |   6 +-
 .../tamaya/remote/BaseRemotePropertySource.java    |   5 +-
 server/pom.xml                                     |   5 +-
 .../tamaya/server/VersionPropertiesTest.java       |  15 +-
 uom/pom.xml                                        |   5 +-
 .../java/org/apache/tamaya/uom/UnitConverter.java  |  32 ++--
 .../org/apache/tamaya/uom/UnitConverterTest.java   |  24 ++-
 usagetracker/pom.xml                               |   8 +-
 .../org/apache/tamaya/usagetracker/UsageStat.java  |   1 -
 .../org/apache/tamaya/model/ConfigUsageTest.java   |  14 +-
 validation/pom.xml                                 |   4 -
 .../apache/tamaya/validation/ValidationCheck.java  |   5 +-
 .../tamaya/validation/spi/ConfigValidator.java     |   6 +-
 vertx/pom.xml                                      |   4 -
 .../tamaya/vertx/AbstractConfiguredVerticle.java   |   1 -
 .../tamaya/vertx/TamayaConfigurationProducer.java  |   3 -
 .../apache/tamaya/vertx/ConfigVerticleTest.java    |   3 -
 .../apache/tamaya/vertx/TestInjectedVerticle.java  |   8 -
 .../tamaya/vertx/TestInjectedVerticleTest.java     |   6 -
 109 files changed, 930 insertions(+), 775 deletions(-)

diff --cc documentation/src/main/java/org/apache/tamaya/doc/DocFormat.java
index 0d93272,c1dc646..f69d60f
--- a/documentation/src/main/java/org/apache/tamaya/doc/DocFormat.java
+++ b/documentation/src/main/java/org/apache/tamaya/doc/DocFormat.java
@@@ -20,6 -20,10 +20,10 @@@ package org.apache.tamaya.doc
  
  import java.util.function.Function;
  
+ /**
+  * An interface for configuration documentation.
+  * @param <T> the documentation format type
+  */
 -public interface DocFormat<T> extends Function<DocumentedConfiguration, T> {
 +public interface DocFormat<T> extends Function<ConfigurationDocumentation, T>
{
  
  }
diff --cc documentation/src/main/java/org/apache/tamaya/doc/DocumentedConfiguration.java
index 7b68d62,0644084..eb9bcaf
--- a/documentation/src/main/java/org/apache/tamaya/doc/DocumentedConfiguration.java
+++ b/documentation/src/main/java/org/apache/tamaya/doc/DocumentedConfiguration.java
@@@ -173,22 -142,16 +173,22 @@@ public final class DocumentedConfigurat
      }
  
      public DocumentedProperty getProperty(String path) {
 -        return null;
 +        return allProperties.get(path);
      }
  
-     public ConfigurationDocumentation addProperty(DocumentedProperty property){
+     public DocumentedConfiguration addProperty(DocumentedProperty property){
 -        this.properties.put(property.getName(), property);
 +        for(String key:property.getKeys()) {
 +            this.allProperties.put(key, property);
 +        }
 +        this.properties.put(property.getMainKey(), property);
          return this;
      }
  
-     public ConfigurationDocumentation addGroup(DocumentedArea group){
+     public DocumentedConfiguration addGroup(DocumentedArea group){
 -        this.groups.put(group.getPath(), group);
 +        for(String basePath:group.getBasePaths()) {
 +            this.allGroups.put(basePath, group);
 +        }
 +        this.groups.put(group.getMainBasePath(), group);
          return this;
      }
  
diff --cc documentation/src/main/java/org/apache/tamaya/doc/formats/HtmlDocFormat.java
index f28224d,84bf07b..8a32656
--- a/documentation/src/main/java/org/apache/tamaya/doc/formats/HtmlDocFormat.java
+++ b/documentation/src/main/java/org/apache/tamaya/doc/formats/HtmlDocFormat.java
@@@ -30,11 -30,34 +30,34 @@@ import java.io.IOException
  import java.util.ArrayList;
  import java.util.List;
  
- import static j2html.TagCreator.*;
+ import static j2html.TagCreator.b;
+ import static j2html.TagCreator.body;
+ import static j2html.TagCreator.h1;
+ import static j2html.TagCreator.h2;
+ import static j2html.TagCreator.h4;
+ import static j2html.TagCreator.head;
+ import static j2html.TagCreator.html;
+ import static j2html.TagCreator.i;
+ import static j2html.TagCreator.li;
+ import static j2html.TagCreator.link;
+ import static j2html.TagCreator.meta;
+ import static j2html.TagCreator.p;
+ import static j2html.TagCreator.pre;
+ import static j2html.TagCreator.table;
+ import static j2html.TagCreator.td;
+ import static j2html.TagCreator.text;
+ import static j2html.TagCreator.th;
+ import static j2html.TagCreator.title;
+ import static j2html.TagCreator.thead;
+ import static j2html.TagCreator.tr;
+ import static j2html.TagCreator.ul;
  
+ /**
+  * An HTML-based documentation format.
+  */
  public class HtmlDocFormat implements DocFormat<String> {
      @Override
 -    public String apply(DocumentedConfiguration documentedConfiguration) {
 +    public String apply(ConfigurationDocumentation documentedConfiguration) {
          List<ContainerTag> areaTags = new ArrayList<>();
          for(DocumentedArea area:documentedConfiguration.getAllAreasSorted()) {
              areaTags.addAll(createAreaEntries(area, null));
diff --cc documentation/src/main/java/org/apache/tamaya/doc/formats/TextDocFormat.java
index aa07cc0,403603c..f818655
--- a/documentation/src/main/java/org/apache/tamaya/doc/formats/TextDocFormat.java
+++ b/documentation/src/main/java/org/apache/tamaya/doc/formats/TextDocFormat.java
@@@ -30,9 -30,12 +30,12 @@@ import java.lang.reflect.Type
  import java.util.stream.Collectors;
  import java.util.stream.Stream;
  
+ /**
+  * A text-based documentation format.
+  */
  public class TextDocFormat implements DocFormat<String> {
      @Override
 -    public String apply(DocumentedConfiguration documentedConfiguration) {
 +    public String apply(ConfigurationDocumentation documentedConfiguration) {
          StringBuilder b = new StringBuilder();
          b.append("Configuration:\n");
          b.append("  Spec    : ").append(documentedConfiguration.getName()).append('\n');
diff --cc documentation/src/test/java/org/apache/tamaya/doc/ConfigDocumenterTest.java
index 6d90861,1012699..0f02db6
--- a/documentation/src/test/java/org/apache/tamaya/doc/ConfigDocumenterTest.java
+++ b/documentation/src/test/java/org/apache/tamaya/doc/ConfigDocumenterTest.java
@@@ -30,8 -30,8 +30,8 @@@ public class ConfigDocumenterTest 
      public void getDocumentationAndPrint_ConfigBean() {
          ConfigDocumenter reader = new ConfigDocumenter();
          reader.readClasses(AnnotatedDocConfigBean.class);
 -        DocumentedConfiguration documentation = reader.getDocumentation();
 +        ConfigurationDocumentation documentation = reader.getDocumentation();
-         assertNotNull(documentation);
+         assertThat(documentation).isNotNull();
          System.out.println(new TextDocFormat().apply(documentation));
      }
  
@@@ -39,8 -39,8 +39,8 @@@
      public void getDocumentationAndPrint_AnnotationType() {
          ConfigDocumenter reader = new ConfigDocumenter();
          reader.readClasses(AnnotBasedStandaloneConfigDocumentation.class);
 -        DocumentedConfiguration documentation = reader.getDocumentation();
 +        ConfigurationDocumentation documentation = reader.getDocumentation();
-         assertNotNull(documentation);
+         assertThat(documentation).isNotNull();
          System.out.println(new TextDocFormat().apply(documentation));
      }
  
@@@ -48,8 -48,8 +48,8 @@@
      public void getDocumentationAndPrint_Package() {
          ConfigDocumenter reader = new ConfigDocumenter();
          reader.readPackages("org.apache.tamaya.doc");
 -        DocumentedConfiguration documentation = reader.getDocumentation();
 +        ConfigurationDocumentation documentation = reader.getDocumentation();
-         assertNotNull(documentation);
+         assertThat(documentation).isNotNull();
          System.out.println(new TextDocFormat().apply(documentation));
      }
  
@@@ -57,8 -57,8 +57,8 @@@
      public void getDocumentationAndPrint_Package_html() {
          ConfigDocumenter reader = new ConfigDocumenter();
          reader.readPackages("org.apache.tamaya.doc");
 -        DocumentedConfiguration documentation = reader.getDocumentation();
 +        ConfigurationDocumentation documentation = reader.getDocumentation();
-         assertNotNull(documentation);
+         assertThat(documentation).isNotNull();
          System.out.println(new HtmlDocFormat().apply(documentation));
      }
- }
+ }
diff --cc validation/src/main/java/org/apache/tamaya/validation/ValidationCheck.java
index fbb31ae,f6f0cf6..72a324d
--- a/validation/src/main/java/org/apache/tamaya/validation/ValidationCheck.java
+++ b/validation/src/main/java/org/apache/tamaya/validation/ValidationCheck.java
@@@ -190,13 -190,12 +190,12 @@@ public final class ValidationCheck 
          if (message != null) {
              finalMessage = " -> " + message;
          }
-         if(source instanceof ConfigPropertySpec){
+         if (source instanceof ConfigPropertySpec) {
              ConfigPropertySpec pspec = (ConfigPropertySpec) source;
 -            return result + ": " + pspec.name() + " (property)"+finalMessage + '\n';
 +            return result + ": " + pspec.key() + " (property)"+finalMessage + '\n';
-         }
-         else if(source instanceof ConfigAreaSpec){
+         } else if (source instanceof ConfigAreaSpec) {
              ConfigAreaSpec gspec = (ConfigAreaSpec) source;
 -            return result + ": " + gspec.path() + " (group)"+finalMessage + '\n';
 +            return result + ": " + gspec.basePaths() + " (group)"+finalMessage + '\n';
          }
          return result + ": " + source + ")"+finalMessage + '\n';
      }


Mime
View raw message