You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2024/04/28 08:34:30 UTC

(maven-doxia-converter) branch DOXIATOOLS-81 updated (b08196c -> 9f98ee8)

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

slachiewicz pushed a change to branch DOXIATOOLS-81
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git


 discard b08196c  [DOXIATOOLS-81] Update pom
 discard e4dffe9  [DOXIATOOLS-81] Convert
 discard 4927a2f  [DOXIATOOLS-81] Inject beans
 discard 09fbe4b  [DOXIATOOLS-81] Switch to JUnit 5
     add 03c5b82  Pom cleanup
     add c950335  [DOXIATOOLS-82] Update to Doxia 2.0.0-M9 (#62)
     add f148833  [DOXIATOOLS-82] Restore original xhtml5 test file
     add 4cc4df1  Clarify description of input file encoding
     add 17a6c2e  Ignore .checkstyle being created by m-checkstyle-p
     add 799b33f  [DOXIATOOLS-83] Build uber-jar with m-shade-p (#63)
     add 16a3137  Update site to reflect supported parameters and name of JAR
     add 22f0cb2  Fix description of CLI parameters
     add 3b1cb07  Bump commons-io:commons-io from 2.15.1 to 2.16.0
     add 211f5ee  Bump commons-io:commons-io from 2.16.0 to 2.16.1
     add a54cdbf  Bump org.jacoco:jacoco-maven-plugin from 0.8.11 to 0.8.12
     new a155ac8  [DOXIATOOLS-81] Switch to JUnit 5
     new 9f98ee8  [DOXIATOOLS-81] Inject beans

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b08196c)
            \
             N -- N -- N   refs/heads/DOXIATOOLS-81 (9f98ee8)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 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.


Summary of changes:
 .gitignore                                         |   2 +
 pom.xml                                            |  33 +++--
 .../org/apache/maven/doxia/DefaultConverter.java   |   7 +-
 .../org/apache/maven/doxia/cli/CLIManager.java     |   2 +-
 src/site/apt/index.apt                             |   4 +-
 src/site/apt/usage.apt.vm                          |  64 +++------
 .../java/org/apache/maven/doxia/ConverterTest.java |  51 ++++---
 src/test/resources/unit/xhtml/test.xhtml           | 155 ++++++++++++++++++++-
 src/test/resources/unit/xhtml/test.xhtml5          |  29 ----
 9 files changed, 234 insertions(+), 113 deletions(-)
 delete mode 100644 src/test/resources/unit/xhtml/test.xhtml5


(maven-doxia-converter) 02/02: [DOXIATOOLS-81] Inject beans

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

slachiewicz pushed a commit to branch DOXIATOOLS-81
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git

commit 9f98ee8bc5b8b76fbc795a4f574a5f22c588e0ec
Author: Sylwester Lachiewicz <sl...@gmail.com>
AuthorDate: Sat Dec 30 21:47:09 2023 +0100

    [DOXIATOOLS-81] Inject beans
---
 pom.xml                                            |  7 +++--
 .../org/apache/maven/doxia/DefaultConverter.java   |  9 ++++--
 .../org/apache/maven/doxia/cli/ConverterCli.java   | 35 +++++++++++++++++++---
 .../java/org/apache/maven/doxia/ConverterTest.java |  7 ++---
 4 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9b572f7..be497d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -141,8 +141,7 @@ under the License.
     <dependency>
       <groupId>com.google.inject</groupId>
       <artifactId>guice</artifactId>
-      <version>4.2.3</version>
-      <classifier>no_aop</classifier>
+      <version>6.0.0</version>
     </dependency>
     <dependency>
       <groupId>org.eclipse.sisu</groupId>
@@ -173,6 +172,10 @@ under the License.
       </plugins>
     </pluginManagement>
     <plugins>
+      <plugin>
+        <groupId>org.eclipse.sisu</groupId>
+        <artifactId>sisu-maven-plugin</artifactId>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
diff --git a/src/main/java/org/apache/maven/doxia/DefaultConverter.java b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
index 5458cd3..11a8783 100644
--- a/src/main/java/org/apache/maven/doxia/DefaultConverter.java
+++ b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.doxia;
 
+import javax.inject.Named;
+
 import java.io.BufferedInputStream;
 import java.io.CharArrayWriter;
 import java.io.File;
@@ -73,6 +75,7 @@ import static java.lang.String.format;
  *
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  */
+@Named
 public class DefaultConverter implements Converter {
     /**
      * All supported Doxia formats (either only parser, only sink or both)
@@ -142,7 +145,7 @@ public class DefaultConverter implements Converter {
             }
             Objects.requireNonNull(plexus, "plexus is required");
 
-            return (Parser) plexus.lookup(Parser.class, roleHint);
+            return plexus.lookup(Parser.class, roleHint);
         }
 
         /**
@@ -157,7 +160,7 @@ public class DefaultConverter implements Converter {
             }
             Objects.requireNonNull(plexus, "plexus is required");
 
-            return (SinkFactory) plexus.lookup(SinkFactory.class, roleHint);
+            return plexus.lookup(SinkFactory.class, roleHint);
         }
 
         /**
@@ -459,7 +462,7 @@ public class DefaultConverter implements Converter {
         containerConfiguration.setName("Doxia");
         containerConfiguration.setContext(context);
         containerConfiguration.setAutoWiring(true);
-        containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
+        containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_ON);
 
         plexus = new DefaultPlexusContainer(containerConfiguration);
     }
diff --git a/src/main/java/org/apache/maven/doxia/cli/ConverterCli.java b/src/main/java/org/apache/maven/doxia/cli/ConverterCli.java
index a4a2d5d..2998a3e 100644
--- a/src/main/java/org/apache/maven/doxia/cli/ConverterCli.java
+++ b/src/main/java/org/apache/maven/doxia/cli/ConverterCli.java
@@ -23,6 +23,8 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.commons.cli.CommandLine;
@@ -35,6 +37,13 @@ import org.apache.maven.doxia.UnsupportedFormatException;
 import org.apache.maven.doxia.parser.AbstractParser;
 import org.apache.maven.doxia.wrapper.InputFileWrapper;
 import org.apache.maven.doxia.wrapper.OutputFileWrapper;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.util.Os;
 
 /**
@@ -50,7 +59,7 @@ public class ConverterCli {
      * @see #doMain(String[])
      * @see System#exit(int)
      */
-    public static void main(String[] args) {
+    public static void main(String[] args) throws PlexusContainerException, ComponentLookupException {
         if (args == null || args.length == 0) {
             args = new String[] {"-h"};
         }
@@ -60,7 +69,7 @@ public class ConverterCli {
     /**
      * @param args The args
      */
-    private static int doMain(String[] args) {
+    private static int doMain(String[] args) throws PlexusContainerException, ComponentLookupException {
         // ----------------------------------------------------------------------
         // Setup the command line parser
         // ----------------------------------------------------------------------
@@ -96,12 +105,13 @@ public class ConverterCli {
         if (showErrors) {
             System.out.println("+ Error stacktraces are turned on.");
         }
-
-        Converter converter = new DefaultConverter();
         if (debug) {
             System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
         }
 
+        PlexusContainer container = getPlexusContainer();
+        Converter converter = container.lookup(Converter.class);
+
         InputFileWrapper input;
         OutputFileWrapper output;
         try {
@@ -202,4 +212,21 @@ public class ConverterCli {
             System.err.println("For more information, run with the -e flag");
         }
     }
+    /**
+     * Start the Plexus container.
+     *
+     * @throws PlexusContainerException if any
+     */
+    private static PlexusContainer getPlexusContainer() throws PlexusContainerException {
+        Map<Object, Object> context = new HashMap<>();
+        context.put("basedir", new File("").getAbsolutePath());
+
+        ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration();
+        containerConfiguration.setName("Doxia");
+        containerConfiguration.setContext(context);
+        containerConfiguration.setAutoWiring(true);
+        containerConfiguration.setClassPathScanning(PlexusConstants.SCANNING_ON);
+
+        return new DefaultPlexusContainer(containerConfiguration);
+    }
 }
diff --git a/src/test/java/org/apache/maven/doxia/ConverterTest.java b/src/test/java/org/apache/maven/doxia/ConverterTest.java
index 8698515..07ff85f 100644
--- a/src/test/java/org/apache/maven/doxia/ConverterTest.java
+++ b/src/test/java/org/apache/maven/doxia/ConverterTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.doxia;
 
+import javax.inject.Inject;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -50,6 +52,7 @@ import static org.junit.jupiter.api.Assertions.fail;
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  */
 class ConverterTest extends InjectedTest {
+    @Inject
     private Converter converter;
 
     private boolean formatOutput;
@@ -58,9 +61,6 @@ class ConverterTest extends InjectedTest {
     @BeforeEach
     public void setUp() throws Exception {
         super.setUp();
-
-        converter = new DefaultConverter();
-
         formatOutput = Boolean.parseBoolean(System.getProperty("format", "false"));
     }
 
@@ -68,7 +68,6 @@ class ConverterTest extends InjectedTest {
     @AfterEach
     public void tearDown() throws Exception {
         super.tearDown();
-
         converter = null;
     }
 


(maven-doxia-converter) 01/02: [DOXIATOOLS-81] Switch to JUnit 5

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

slachiewicz pushed a commit to branch DOXIATOOLS-81
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git

commit a155ac8d413432b840b84e7bb2822b55727775cf
Author: Sylwester Lachiewicz <sl...@gmail.com>
AuthorDate: Sat Dec 30 21:41:09 2023 +0100

    [DOXIATOOLS-81] Switch to JUnit 5
---
 pom.xml                                            |  6 +--
 .../java/org/apache/maven/doxia/ConverterTest.java | 58 ++++++++++++++--------
 2 files changed, 41 insertions(+), 23 deletions(-)

diff --git a/pom.xml b/pom.xml
index 591cfba..9b572f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,9 +150,9 @@ under the License.
     </dependency>
     <!-- Test -->
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>5.10.1</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/test/java/org/apache/maven/doxia/ConverterTest.java b/src/test/java/org/apache/maven/doxia/ConverterTest.java
index ba4fc23..8698515 100644
--- a/src/test/java/org/apache/maven/doxia/ConverterTest.java
+++ b/src/test/java/org/apache/maven/doxia/ConverterTest.java
@@ -31,25 +31,32 @@ import org.apache.maven.doxia.wrapper.InputFileWrapper;
 import org.apache.maven.doxia.wrapper.InputReaderWrapper;
 import org.apache.maven.doxia.wrapper.OutputFileWrapper;
 import org.apache.maven.doxia.wrapper.OutputStreamWrapper;
-import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.WriterFactory;
+import org.eclipse.sisu.launch.InjectedTest;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Tests Doxia converter.
  *
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  */
-public class ConverterTest extends PlexusTestCase {
+class ConverterTest extends InjectedTest {
     private Converter converter;
 
     private boolean formatOutput;
 
     /** {@inheritDoc} */
-    @Override
-    protected void setUp() throws Exception {
+    @BeforeEach
+    public void setUp() throws Exception {
         super.setUp();
 
         converter = new DefaultConverter();
@@ -58,8 +65,8 @@ public class ConverterTest extends PlexusTestCase {
     }
 
     /** {@inheritDoc} */
-    @Override
-    protected void tearDown() throws Exception {
+    @AfterEach
+    public void tearDown() throws Exception {
         super.tearDown();
 
         converter = null;
@@ -71,7 +78,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testFileConverterWithInputFileOutputDir() throws Exception {
+    @Test
+    void fileConverterWithInputFileOutputDir() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/Doxia.htm";
         String out = getBasedir() + "/target/unit/";
 
@@ -92,7 +100,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testFileConverterWithInputDirOutputDir() throws Exception {
+    @Test
+    void fileConverterWithInputDirOutputDir() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/apt";
         String out = getBasedir() + "/target/unit/";
 
@@ -115,7 +124,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testFileConverterWithInputFileOutputFile() throws Exception {
+    @Test
+    void fileConverterWithInputFileOutputFile() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/Doxia.htm";
         String out = getBasedir() + "/target/unit/Doxia.apt";
 
@@ -136,7 +146,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testAptFileConverter() throws Exception {
+    @Test
+    void aptFileConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/apt/test.apt";
         String out = getBasedir() + "/target/unit/file/apt/test.apt.xhtml";
 
@@ -166,7 +177,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testFmlFileConverter() throws Exception {
+    @Test
+    void fmlFileConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/fml/test.fml";
         String out = getBasedir() + "/target/unit/file/fml/test.fml.xhtml";
 
@@ -187,7 +199,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testXdocFileConverter() throws Exception {
+    @Test
+    void xdocFileConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/xdoc/test.xml";
         String out = getBasedir() + "/target/unit/file/xdoc/test.xdoc.xhtml";
 
@@ -217,7 +230,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
      * @throws Exception if any
      */
-    public void testXhtmlFileConverter() throws Exception {
+    @Test
+    void xhtmlFileConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/xhtml/test.xhtml";
         String out = getBasedir() + "/target/unit/file/xhtml/test.xhtml.xhtml";
 
@@ -247,7 +261,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
      * @throws Exception if any
      */
-    public void testAptWriterConverter() throws Exception {
+    @Test
+    void aptWriterConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/apt/test.apt";
         String from = "apt";
         String out = getBasedir() + "/target/unit/writer/apt/test.apt.xhtml";
@@ -279,7 +294,8 @@ public class ConverterTest extends PlexusTestCase {
      * @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
      * @throws Exception if any
      */
-    public void testAutoDetectConverter() throws Exception {
+    @Test
+    void autoDetectConverter() throws Exception {
         String in = getBasedir() + "/src/test/resources/unit/xdoc/test.xml";
         String out = getBasedir() + "/target/unit/writer/apt/test.xdoc.apt";
 
@@ -381,7 +397,8 @@ public class ConverterTest extends PlexusTestCase {
     /**
      * Test {@link DefaultConverter#autoDetectEncoding(File)}
      */
-    public void testAutodetectEncoding() {
+    @Test
+    void autodetectEncoding() {
         assertEquals("ISO-8859-1", autoDetectEncoding("apt/test.apt"));
         assertEquals("UTF-8", autoDetectEncoding("fml/test.fml")); // plexus-utils should detect ISO-8859-1
         assertEquals("UTF-8", autoDetectEncoding("xhtml/test.xhtml"));
@@ -399,8 +416,9 @@ public class ConverterTest extends PlexusTestCase {
      * Test {@link DefaultConverter.DoxiaFormat#autoDetectFormat(File)}
      *
      */
-    public void testAutodetectFormat() {
-        assertEquals(autoDetectFormat("apt/test.apt"), DoxiaFormat.APT);
+    @Test
+    void autodetectFormat() {
+        assertEquals(DoxiaFormat.APT, autoDetectFormat("apt/test.apt"));
 
         try {
             autoDetectFormat("apt/test.unknown");
@@ -409,7 +427,7 @@ public class ConverterTest extends PlexusTestCase {
             assertTrue(true);
         }
 
-        assertEquals(autoDetectFormat("fml/test.fml"), DoxiaFormat.FML);
-        assertEquals(autoDetectFormat("xhtml/test.xhtml"), DoxiaFormat.XHTML);
+        assertEquals(DoxiaFormat.FML, autoDetectFormat("fml/test.fml"));
+        assertEquals(DoxiaFormat.XHTML, autoDetectFormat("xhtml/test.xhtml"));
     }
 }