You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2020/12/26 17:54:22 UTC

[axis-axis2-java-core] branch master updated: Remove the testkit doclet

This is an automated email from the ASF dual-hosted git repository.

veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 2315f88  Remove the testkit doclet
2315f88 is described below

commit 2315f88fb7bc159dc5e6c2560cbe13570906fbff
Author: Andreas Veithen <an...@gmail.com>
AuthorDate: Sat Dec 26 17:53:47 2020 +0000

    Remove the testkit doclet
    
    That doclet was designed to enrich the output of the standard doclet,
    but there is no easy way to implement that in Java 11. Since it's not an
    essential feature, remove it.
---
 .travis.yml                                        |   2 +-
 apidocs/pom.xml                                    |  32 -----
 modules/transport/testkit/pom.xml                  |  20 ---
 .../axis2/transport/testkit/doclet/Dependency.java |  48 -------
 .../axis2/transport/testkit/doclet/Resource.java   |  50 -------
 .../transport/testkit/doclet/ResourceInfo.java     |  59 ---------
 .../testkit/doclet/ResourceInfoDoclet.java         | 144 ---------------------
 .../testkit/doclet/TestkitJavadocDoclet.java       | 114 ----------------
 8 files changed, 1 insertion(+), 468 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index fd7097c..27eb6c7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ dist: trusty
 language: java
 jdk:
   - openjdk8
-  - openjdk9
+  - openjdk11
 before_install:
   - if [ -e $JAVA_HOME/lib/security/cacerts ]; then ln -sf /etc/ssl/certs/java/cacerts $JAVA_HOME/lib/security/cacerts; fi
 install: true
diff --git a/apidocs/pom.xml b/apidocs/pom.xml
index d6ebf5c..7b0456a 100644
--- a/apidocs/pom.xml
+++ b/apidocs/pom.xml
@@ -299,44 +299,12 @@
                 <artifactId>maven-javadoc-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>extract-resource-info</id>
-                        <phase>pre-site</phase>
-                        <goals>
-                            <goal>javadoc</goal>
-                        </goals>
-                        <configuration>
-                            <docletArtifacts>
-                                <docletArtifact>
-                                    <groupId>${project.groupId}</groupId>
-                                    <artifactId>axis2-transport-testkit</artifactId>
-                                    <version>${project.version}</version>
-                                </docletArtifact>
-                            </docletArtifacts>
-                            <doclet>org.apache.axis2.transport.testkit.doclet.ResourceInfoDoclet</doclet>
-                            <useStandardDocletOptions>false</useStandardDocletOptions>
-                            <show>private</show>
-                            <additionalOptions>-out "${javadoc-compat-out-dir}/resource-info.dat"</additionalOptions>
-                        </configuration>
-                    </execution>
-                    <execution>
                         <id>site-javadoc</id>
                         <phase>site</phase>
                         <goals>
                             <goal>javadoc-no-fork</goal>
                         </goals>
                         <configuration>
-                            <docletArtifacts>
-                                <docletArtifact>
-                                    <groupId>${project.groupId}</groupId>
-                                    <artifactId>axis2-transport-testkit</artifactId>
-                                    <version>${project.version}</version>
-                                </docletArtifact>
-                            </docletArtifacts>
-                            <doclet>org.apache.axis2.transport.testkit.doclet.TestkitJavadocDoclet</doclet>
-                            <useStandardDocletOptions>true</useStandardDocletOptions>
-                            <additionalOptions>
-                                -resource-info "${javadoc-compat-out-dir}/resource-info.dat"
-                            </additionalOptions>
                             <reportOutputDirectory>${project.reporting.outputDirectory}</reportOutputDirectory>
                             <destDir>.</destDir>
                         </configuration>
diff --git a/modules/transport/testkit/pom.xml b/modules/transport/testkit/pom.xml
index 3e88cf0..ba7ddbe 100644
--- a/modules/transport/testkit/pom.xml
+++ b/modules/transport/testkit/pom.xml
@@ -92,26 +92,6 @@
         </dependency>
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>default-tools.jar</id>
-            <activation>
-                <file>
-                    <exists>${java.home}/../lib/tools.jar</exists>
-                </file>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>com.sun</groupId>
-                    <artifactId>tools</artifactId>
-                    <version>1.5.0</version>
-                    <scope>system</scope>
-                    <systemPath>${java.home}/../lib/tools.jar</systemPath>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
-
     <build>
         <resources>
             <resource>
diff --git a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Dependency.java b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Dependency.java
deleted file mode 100644
index a346e59..0000000
--- a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Dependency.java
+++ /dev/null
@@ -1,48 +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.axis2.transport.testkit.doclet;
-
-import java.io.Serializable;
-
-public class Dependency implements Serializable {
-    private static final long serialVersionUID = -3576630956376161332L;
-    
-    private final String type;
-    private final String multiplicity;
-    private final String comment;
-
-    public Dependency(String type, String multiplicity, String comment) {
-        this.type = type;
-        this.multiplicity = multiplicity;
-        this.comment = comment;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public String getMultiplicity() {
-        return multiplicity;
-    }
-
-    public String getComment() {
-        return comment;
-    }
-}
diff --git a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Resource.java b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Resource.java
deleted file mode 100644
index 50cd5b6..0000000
--- a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/Resource.java
+++ /dev/null
@@ -1,50 +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.axis2.transport.testkit.doclet;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-public class Resource implements Serializable {
-    private static final long serialVersionUID = 8381629721839692917L;
-    
-    private final String type;
-    private List<Dependency> dependencies;
-    
-    public Resource(String type) {
-        this.type = type;
-    }
-
-    public String getType() {
-        return type;
-    }
-    
-    public void addDependency(String type, String multiplicity, String comment) {
-        if (dependencies == null) {
-            dependencies = new LinkedList<Dependency>();
-        }
-        dependencies.add(new Dependency(type, multiplicity, comment));
-    }
-
-    public List<Dependency> getDependencies() {
-        return dependencies;
-    }
-}
diff --git a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfo.java b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfo.java
deleted file mode 100644
index b38b54c..0000000
--- a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfo.java
+++ /dev/null
@@ -1,59 +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.axis2.transport.testkit.doclet;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class ResourceInfo implements Serializable {
-    private static final long serialVersionUID = -3590562573639276912L;
-    
-    private final Map<String,Resource> resources = new HashMap<String,Resource>();
-    
-    public void addResource(Resource resource) {
-        resources.put(resource.getType(), resource);
-    }
-    
-    public Resource getResource(String type) {
-        return resources.get(type);
-    }
-    
-    public List<Resource> getUsedBy(String type) {
-        List<Resource> result = null;
-        for (Resource resource : resources.values()) {
-            List<Dependency> dependencies = resource.getDependencies();
-            if (dependencies != null) {
-                for (Dependency dependency : dependencies) {
-                    if (dependency.getType().equals(type)) {
-                        if (result == null) {
-                            result = new LinkedList<Resource>();
-                        }
-                        result.add(resource);
-                        break;
-                    }
-                }
-            }
-        }
-        return result;
-    }
-}
diff --git a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfoDoclet.java b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfoDoclet.java
deleted file mode 100644
index dc5fef8..0000000
--- a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/ResourceInfoDoclet.java
+++ /dev/null
@@ -1,144 +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.axis2.transport.testkit.doclet;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import com.sun.javadoc.AnnotationDesc;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.Doc;
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.ParamTag;
-import com.sun.javadoc.Parameter;
-import com.sun.javadoc.ProgramElementDoc;
-import com.sun.javadoc.RootDoc;
-import com.sun.javadoc.SeeTag;
-import com.sun.javadoc.Tag;
-import com.sun.javadoc.Type;
-
-public class ResourceInfoDoclet {
-    private static File outFile;
-    
-    public static boolean start(RootDoc root) throws IOException {
-        parseOptions(root.options());
-        ResourceInfo resourceInfo = new ResourceInfo();
-        for (ClassDoc clazz : root.classes()) {
-            Resource resource = null;
-            for (MethodDoc method : clazz.methods()) {
-                if (getAnnotation(method, "org.apache.axis2.transport.testkit.tests.Setup") != null) {
-                    if (resource == null) {
-                        resource = new Resource(clazz.qualifiedName());
-                    }
-                    ParamTag[] paramTags = method.paramTags();
-                    for (Parameter parameter : method.parameters()) {
-                        Type type = parameter.type();
-                        String name = parameter.name();
-                        String comment = null;
-                        for (ParamTag paramTag : paramTags) {
-                            if (paramTag.parameterName().equals(name)) {
-                                comment = paramTag.parameterComment();
-                                break;
-                            }
-                        }
-                        if (comment == null) {
-                            comment = getFirstSentence(root.classNamed(type.qualifiedTypeName()));
-                        }
-                        resource.addDependency(type.qualifiedTypeName(),
-                                               type.dimension().equals("[]") ? "0..*" : "1", 
-                                               comment);
-                    }
-                }
-            }
-            if (resource != null) {
-                resourceInfo.addResource(resource);
-            }
-        }
-        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(outFile));
-        out.writeObject(resourceInfo);
-        out.close();
-        return true;
-    }
-    
-    private static AnnotationDesc getAnnotation(ProgramElementDoc doc, String qualifiedName) {
-        for (AnnotationDesc annotation : doc.annotations()) {
-            if (annotation.annotationType().qualifiedName().equals(qualifiedName)) {
-                return annotation;
-            }
-        }
-        return null;
-    }
-    
-    private static String getFirstSentence(Doc doc) {
-        Tag[] tags = doc.firstSentenceTags();
-        if (tags.length == 0) {
-            return null;
-        }
-        StringBuilder buffer = new StringBuilder();
-        for (Tag tag : tags) {
-            if (tag instanceof SeeTag) {
-                buffer.append("{");
-                buffer.append(tag.name());
-                buffer.append(" ");
-                buffer.append(((SeeTag)tag).referencedClassName());
-                buffer.append("}");
-            } else {
-                buffer.append(tag.text());
-            }
-        }
-        return buffer.toString();
-    }
-
-    private static void parseOptions(String[][] options) {
-        for (String[] option : options) {
-            if (option[0].equals("-out")) {
-                outFile = new File(option[1]);
-                System.out.println("Output is going to " + outFile);
-            }
-        }
-    }
-
-    public static int optionLength(String option) {
-        if (option.equals("-out")) {
-            return 2;
-        } else {
-            return 0;
-        }
-    }
-    
-    public static boolean validOptions(String options[][], DocErrorReporter reporter) {
-        boolean hasOut = false;
-        for (String[] option : options) {
-            String opt = option[0];
-            if (opt.equals("-out")) {
-                hasOut = true;
-            }
-        }
-        if (!hasOut) {
-            reporter.printError("No output file specified: -out <output file>");
-            return false;
-        } else {
-            return true;
-        }
-    }
-}
diff --git a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java
deleted file mode 100644
index 036f6d0..0000000
--- a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java
+++ /dev/null
@@ -1,114 +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.axis2.transport.testkit.doclet;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.ObjectInputStream;
-import java.util.List;
-
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.LanguageVersion;
-import com.sun.javadoc.RootDoc;
-import com.sun.tools.doclets.standard.Standard;
-
-public class TestkitJavadocDoclet {
-    private static File resourceInfoFile;
-    
-    public static LanguageVersion languageVersion() {
-        return Standard.languageVersion();
-    }
-    
-    public static int optionLength(String option) {
-        if (option.equals("-resource-info")) {
-            return 2;
-        } else {
-            return Standard.optionLength(option);
-        }
-    }
-    
-    public static boolean validOptions(String options[][], DocErrorReporter reporter) {
-        return Standard.validOptions(options, reporter);
-    }
-    
-    public static boolean start(RootDoc root) throws Exception {
-        parseOptions(root.options());
-        ObjectInputStream in = new ObjectInputStream(new FileInputStream(resourceInfoFile));
-        ResourceInfo resourceInfo = (ResourceInfo)in.readObject();
-        in.close();
-        for (ClassDoc clazz : root.classes()) {
-            String qualifiedName = clazz.qualifiedName();
-            List<Resource> usedBy = resourceInfo.getUsedBy(qualifiedName);
-            Resource resource = resourceInfo.getResource(qualifiedName);
-            List<Dependency> dependencies = resource == null ? null : resource.getDependencies();
-            if (dependencies != null || usedBy != null) {
-                String rawCommentText = clazz.getRawCommentText();
-                StringBuilder buffer = new StringBuilder(
-                        rawCommentText.trim().isEmpty() ? "No documentation available." : rawCommentText);
-                buffer.append("<h2>Resource information</h2>");
-                if (usedBy != null) {
-                    buffer.append("This resource is used by: ");
-                    boolean first = true;
-                    for (Resource r : usedBy) {
-                        if (first) {
-                            first = false;
-                        } else {
-                            buffer.append(", ");
-                        }
-                        buffer.append("{@link ");
-                        buffer.append(r.getType());
-                        buffer.append("}");
-                    }
-                }
-                if (dependencies != null) {
-                    buffer.append("<h3>Dependencies</h3>");
-                    buffer.append("<dl>");
-                    for (Dependency dependency : dependencies) {
-                        buffer.append("<dt>{@link ");
-                        buffer.append(dependency.getType());
-                        buffer.append("} (");
-                        buffer.append(dependency.getMultiplicity());
-                        buffer.append(")</dt><dd>");
-                        String comment = dependency.getComment();
-                        if (comment == null) {
-                            buffer.append("(no documentation available)");
-                        } else {
-                            buffer.append(comment);
-                        }
-                        buffer.append("</dd>");
-                    }
-                    buffer.append("</dl>");
-                }
-                clazz.setRawCommentText(buffer.toString());
-            }
-        }
-        return Standard.start(root);
-    }
-
-    private static void parseOptions(String[][] options) {
-        for (String[] option : options) {
-            if (option[0].equals("-resource-info")) {
-                resourceInfoFile = new File(option[1]);
-                System.out.println("Resource information is read from " + resourceInfoFile);
-            }
-        }
-    }
-}