You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/12/01 15:16:53 UTC

[maven-javadoc-plugin] branch MJAVADOC-445 created (now 85729d5)

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

rfscholte pushed a change to branch MJAVADOC-445
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git.


      at 85729d5  [MJAVADOC-445] JavadocOptionsXpp3Reader doesn't deserialize the placement element in Tag

This branch includes the following new commits:

     new 85729d5  [MJAVADOC-445] JavadocOptionsXpp3Reader doesn't deserialize the placement element in Tag

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-javadoc-plugin] 01/01: [MJAVADOC-445] JavadocOptionsXpp3Reader doesn't deserialize the placement element in Tag

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJAVADOC-445
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 85729d5640875380b1f7dfb58dc64d04219354c0
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat Dec 1 16:16:48 2018 +0100

    [MJAVADOC-445] JavadocOptionsXpp3Reader doesn't deserialize the placement element in Tag
---
 src/main/mdo/javadocOptions.mdo                    | 22 +++-----
 .../io/xpp3/JavadocOptionsXpp3ReaderTest.java      | 59 ++++++++++++++++++++++
 2 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/src/main/mdo/javadocOptions.mdo b/src/main/mdo/javadocOptions.mdo
index 108766d..3c50092 100644
--- a/src/main/mdo/javadocOptions.mdo
+++ b/src/main/mdo/javadocOptions.mdo
@@ -207,25 +207,19 @@ under the License.
           <type>String</type>
           <identifier>true</identifier>
         </field>
+        <field java.setter='false'>
+          <name>placement</name>
+          <description>Placement of the tag.</description>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
       </fields>
       <codeSegments>
         <codeSegment>
           <version>1.0.0+</version>
             <code><![CDATA[
     /**
-     * Field placement
-     */
-    private String placement;
-
-    /**
-     * Get the placement.
-     */
-    public String getPlacement()
-    {
-        return this.placement;
-    }
-
-    /**
      * Set a Placement. Should be a combinaison of the letters:
      * <ul>
      * <li> X (disable tag)</li>
@@ -259,7 +253,7 @@ under the License.
                 case 'f':
                     break;
                 default:
-                    throw new IllegalArgumentException( "Placement should be a combinaison of the letters 'Xaoptcmf'." );
+                    throw new IllegalArgumentException( "Placement should be a combination of the letters 'Xaoptcmf'." );
             }
         }
         this.placement = placement;
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java b/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java
new file mode 100644
index 0000000..1966492
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java
@@ -0,0 +1,59 @@
+package org.apache.maven.plugins.javadoc.options.io.xpp3;
+
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.StringReader;
+
+import org.apache.maven.plugins.javadoc.options.JavadocOptions;
+import org.apache.maven.plugins.javadoc.options.Tag;
+import org.junit.Test;
+
+public class JavadocOptionsXpp3ReaderTest
+{
+
+    @Test
+    public void testNameAndHead() throws Exception {
+        JavadocOptionsXpp3Reader parser = new JavadocOptionsXpp3Reader();
+        String testString = "<javadocOptions><tags><tag><name>foo</name><head>bar</head></tag></tags></javadocOptions>";
+        StringReader reader = new StringReader(testString);
+
+        JavadocOptions options = parser.read(reader);
+        assertEquals(1, options.getTags().size());
+        Tag tag = options.getTags().get(0);
+        assertEquals("foo", tag.getName());
+        assertEquals("bar", tag.getHead());
+    }
+    
+    @Test
+    public void testPlacement() throws Exception {
+        JavadocOptionsXpp3Reader parser = new JavadocOptionsXpp3Reader();
+        String testString = "<javadocOptions><tags><tag><name>foo</name><placement>Xaoptcmf</placement><head>bar</head></tag></tags></javadocOptions>";
+        StringReader reader = new StringReader(testString);
+
+        JavadocOptions options = parser.read(reader);
+        assertEquals(1, options.getTags().size());
+        Tag tag = options.getTags().get(0);
+        assertEquals("foo", tag.getName());
+        assertEquals("Xaoptcmf", tag.getPlacement());
+    }
+
+}