Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
* spring-boot-test: parameters documentation

* Add javadoc and readme to the command-line module

* Update reamde and javadoc

* Add readme and javadoc to Spring Boot Test autoconfiguration

* Update site
  • Loading branch information
vitalijr2 authored Dec 15, 2023
1 parent 8c2b3bb commit bddc8c6
Show file tree
Hide file tree
Showing 45 changed files with 893 additions and 140 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The proxy feature
- The report path
- Split Maven plugin and CLI builder modules
- The Spring Boot Test autoconfiguration

## 1.0.1 - 2023-11-08
### Fixed
Expand Down
25 changes: 24 additions & 1 deletion command-line/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,34 @@
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion>
<name>IntelliJ HTTP Client Tools : CLI Builder</name>
<name>HTTP Client Tools : Command Line</name>
<packaging>jar</packaging>
<parent>
<artifactId>ijhttp-parent</artifactId>
<groupId>uk.bot-by.ijhttp-tools</groupId>
<version>${revision}${changelist}${sha1}</version>
</parent>
<profiles>
<profile>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>
https://javadoc.io/doc/org.apache.commons/commons-exec/${commons-exec.version}
</link>
<link>
https://javadoc.io/doc/org.jetbrains/annotations/${jetbrains-annotations.version}
</link>
</links>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
</plugins>
</build>
<id>javadocs</id>
</profile>
</profiles>
</project>
23 changes: 23 additions & 0 deletions command-line/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# HTTP Client Command Line

[![Maven Central](https://img.shields.io/maven-central/v/uk.bot-by.ijhttp-tools/ijhttp-command-line)](https://search.maven.org/artifact/uk.bot-by.ijhttp-tools/ijhttp-command-line)
[![Javadoc](https://javadoc.io/badge2/uk.bot-by.ijhttp-tools/ijhttp-command-line/javadoc.svg)](https://javadoc.io/doc/uk.bot-by.ijhttp-tools/ijhttp-command-line)

The builder-style component [HttpClientCommandLine][component] helps to prepare command line
to run [Intellij HTTP Client CLI tool][cli-tool].

The minimal configuration contains HTTP files only:
```java
var commandLine = new HttpClientCommandLine();
var executor = new DefaultExecutor();
var orders = Path.of("orders.http").toFile();
var products = Path.of("products.http").toFile();
var checkout = Path.of("checkout.http").toFile();

commandLine.files(java.util.List.of(orders, products, checkout));
executor.execute(commandLine.getCommandLine());
```

[component]: src/main/java/uk/bot_by/ijhttp_tools/command_line/HttpClientCommandLine.java

[cli-tool]: https://www.jetbrains.com/help/idea/http-client-cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
import org.apache.commons.exec.CommandLine;
import org.jetbrains.annotations.NotNull;

/**
* HTTP Client command line parameters.
* <p>
* The minimal configuration contains HTTP files only:
* <pre><code class="language-java">
* var commandLine = new HttpClientCommandLine();
* var executor = new DefaultExecutor();
* var files = Path.of("orders.http").toFile();
* var products = Path.of("products.http").toFile();
* var checkout = Path.of("checkout.http").toFile();
*
* commandLine.files(List.of(files, products, checkout));
* executor.execute(commandLine.getCommandLine());
* </code></pre>
* <p>
* IntelliJ HTTP Client uses <code>--report</code> as boolean option and parameter with a file
* value. The component implements it by two methods: {@link #report(boolean)} and
* {@link #reportPath(java.io.File)}.
*/
public class HttpClientCommandLine {

private static final String CONNECT_TIMEOUT = "--connect-timeout";
Expand Down Expand Up @@ -195,6 +214,14 @@ public void socketTimeout(@NotNull Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}

/**
* Get command line.
*
* @return command line
* @throws IllegalArgumentException if HTTP files are missed
* @throws IOException if path to HTTP or environment files or report directory is
* wrong
*/
public CommandLine getCommandLine() throws IllegalArgumentException, IOException {
var commandLine = new CommandLine(executable);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* The builder-style component {@link uk.bot_by.ijhttp_tools.command_line.HttpClientCommandLine}
* helps to prepare command line to run Intellij HTTP Client CLI tool.
* <p>
* There are Maven Plugin
* <a href="https://gitlab.com/bot-by/ijhttp-maven-plugin/-/tree/main/maven-plugin">
* ijhttp-maven-plugin</a> and Spring Boot Test autoconfiguration
* <a href="https://gitlab.com/bot-by/ijhttp-maven-plugin/-/tree/mai/spring-boot-test">
* ijhttp-spring-boot-test</a> to run HTTP requests on the <em>integration-test</em> phase using the
* IntelliJ HTTP Client.
*
* @author Vitalij Berdinskih
* @since 1.0.0
*/
package uk.bot_by.ijhttp_tools.command_line;
41 changes: 41 additions & 0 deletions command-line/src/main/javadoc/overview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ijhttp tools, command line</title>
</head>
<body>
<p>Originally the <a
href="https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html">IntelliJ HTTP
Client</a> plugin allows to create, edit, and execute HTTP requests directly in the
IntelliJ IDEA code editor. The IntelliJ HTTP Client is also <a
href="https://www.jetbrains.com/help/idea/http-client-cli.html">available as a CLI tool</a>.
</p>
<p>The command line artifact has the builder-style component
<a href="./uk/bot_by/ijhttp_tools/command_line/HttpClientCommandLine.html">
<code class="language-java">HttpClientCommandLine</code></a> to prepare command line
to run this CLI tool.</p>
<p>There are Maven Plugin
<a href="https://gitlab.com/bot-by/ijhttp-maven-plugin/-/tree/main/maven-plugin">
ijhttp-maven-plugin</a> and Spring Boot Test autoconfiguration
<a href="https://gitlab.com/bot-by/ijhttp-maven-plugin/-/tree/mai/spring-boot-test">
ijhttp-spring-boot-test</a> to run HTTP requests on the <em>integration-test</em> phase using
the IntelliJ HTTP Client.</p>
<p>The
<a href="https://github.com/JetBrains/http-request-in-editor-spec">HTTP Request in Editor
Specification</a> describes format these files.</p>
<p>Example requests:</p>
<pre><code class="language-apex">
GET https://example.com/api/get

### Add an item
POST https://example.com/api/add
Content-Type: application/json

{
"name": "entity",
"value": "content"
}
</code></pre>
</body>
</html>
3 changes: 3 additions & 0 deletions command-line/src/main/javadoc/resources/prism.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bddc8c6

Please sign in to comment.