jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: [jmeter] 01/02: Partly revert "Silence warning of tika about missing sqlite-jdbc dependency"
Date Fri, 15 Jan 2021 17:52:07 GMT
Hi Felix,
For simplicity and impact on Maven plugin , why not embed tika-config.xml
in core (src/main/resources) ?

Regards

On Fri, Jan 15, 2021 at 6:39 PM <fschumacher@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> fschumacher pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/jmeter.git
>
> commit 803f69f8484aa34c78ab160d1474db56bf0aff47
> Author: Felix Schumacher <felix.schumacher@internetallee.de>
> AuthorDate: Fri Jan 15 15:34:11 2021 +0100
>
>     Partly revert "Silence warning of tika about missing sqlite-jdbc
> dependency"
>
>     This reverts commit aa6c7633d6ff8125d588071cb4739930a847e1fa.
>
>     Instead of using a system property and extending the shell scripts to
> start
>     JMeter, we now configure Tika inside the client code directly. The used
>     config file stays at the same location and has still the same content.
> ---
>  .gitignore                                                |  2 +-
>  bin/jmeter                                                |  2 +-
>  bin/jmeter.bat                                            |  2 +-
>  .../protocol/http/gui/action/ParseCurlCommandAction.java  | 15
> ++++++++++++++-
>  4 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 61df09b..21abad6 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -51,7 +51,7 @@
>  /bin/*.jmx
>  /bin/*.jtl
>  /bin/*.xml
> -# We need log4j2.xml even though we want to exclude xml created by batch
> tests
> +# We need log4j2.xml and tika-config.xml even though we want to exclude
> xml created by batch tests
>  !/bin/log4j2.xml
>  !/bin/tika-config.xml
>
> diff --git a/bin/jmeter b/bin/jmeter
> index fae82ff..5d5b949 100755
> --- a/bin/jmeter
> +++ b/bin/jmeter
> @@ -187,7 +187,7 @@ esac
>
>  # Always dump on OOM (does not cost anything unless triggered)
>  DUMP="-XX:+HeapDumpOnOutOfMemoryError"
> -SYSTEM_PROPS="-Djava.security.egd=file:/dev/urandom
> -Dtika.config=${JMETER_HOME}/bin/tika-config.xml"
> +SYSTEM_PROPS="-Djava.security.egd=file:/dev/urandom"
>  SERVER="-server"
>
>  if [ -z "${JMETER_COMPLETE_ARGS}" ]; then
> diff --git a/bin/jmeter.bat b/bin/jmeter.bat
> index 2c96b54..80fc534 100644
> --- a/bin/jmeter.bat
> +++ b/bin/jmeter.bat
> @@ -162,7 +162,7 @@ if not defined GC_ALGO (
>      set GC_ALGO=-XX:+UseG1GC -XX:MaxGCPauseMillis=100
> -XX:G1ReservePercent=20
>  )
>
> -set SYSTEM_PROPS=-Djava.security.egd=file:/dev/urandom
> -Dtika.config=%JMETER_BIN%tika-config.xml
> +set SYSTEM_PROPS=-Djava.security.egd=file:/dev/urandom
>
>  rem Always dump on OOM (does not cost anything unless triggered)
>  set DUMP=-XX:+HeapDumpOnOutOfMemoryError
> diff --git
> a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
> b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
> index d610b52..d601618 100644
> ---
> a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
> +++
> b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/gui/action/ParseCurlCommandAction.java
> @@ -29,6 +29,7 @@ import java.io.IOException;
>  import java.net.MalformedURLException;
>  import java.net.URL;
>  import java.nio.charset.StandardCharsets;
> +import java.nio.file.Paths;
>  import java.text.MessageFormat;
>  import java.time.LocalDateTime;
>  import java.time.format.DateTimeFormatter;
> @@ -104,8 +105,11 @@ import org.apache.jorphan.collections.HashTree;
>  import org.apache.jorphan.gui.ComponentUtil;
>  import org.apache.jorphan.gui.JMeterUIDefaults;
>  import org.apache.tika.Tika;
> +import org.apache.tika.config.TikaConfig;
> +import org.apache.tika.exception.TikaException;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
> +import org.xml.sax.SAXException;
>
>  /**
>   * Opens a popup where user can enter a cURL command line and create a
> test plan
> @@ -130,7 +134,16 @@ public class ParseCurlCommandAction extends
> AbstractAction implements MenuCreato
>      private JSyntaxTextArea cURLCommandTA;
>      private JLabel statusText;
>      private JCheckBox uploadCookiesCheckBox;
> -    private final Tika tika = new Tika();
> +    private final Tika tika = createTika();
> +
> +    private Tika createTika() {
> +        try {
> +            return new Tika(new
> TikaConfig(Paths.get(JMeterUtils.getJMeterBinDir(), "tika-config.xml")));
> +        } catch (TikaException | IOException | SAXException e) {
> +            return new Tika();
> +        }
> +    }
> +
>      public ParseCurlCommandAction() {
>          super();
>      }
>
>

-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message