feat: add EIP4 agent CLI and skills plan
This commit is contained in:
56
platform-cli/pom.xml
Normal file
56
platform-cli/pom.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.eip4</groupId>
|
||||
<artifactId>eip4-platform</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>platform-cli</artifactId>
|
||||
<name>platform-cli</name>
|
||||
<description>EIP4 Agent 受控命令入口:环境探测、AI 自动开发、发布前门禁编排</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.eip4.platform.cli.Eip4Cli</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
328
platform-cli/src/main/java/com/eip4/platform/cli/Eip4Cli.java
Normal file
328
platform-cli/src/main/java/com/eip4/platform/cli/Eip4Cli.java
Normal file
@@ -0,0 +1,328 @@
|
||||
package com.eip4.platform.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public final class Eip4Cli {
|
||||
|
||||
private static final String DEFAULT_BASE_URL = "http://localhost:8084";
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
private final Eip4HttpClient httpClient;
|
||||
|
||||
public Eip4Cli(Eip4HttpClient httpClient) {
|
||||
this.objectMapper = new ObjectMapper();
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
int code = new Eip4Cli(new JdkEip4HttpClient(objectMapper)).run(args, System.out, System.err);
|
||||
if (code != 0) {
|
||||
System.exit(code);
|
||||
}
|
||||
}
|
||||
|
||||
int run(String[] args, PrintStream out, PrintStream err) {
|
||||
try {
|
||||
if (args.length == 0 || isHelp(args[0])) {
|
||||
printHelp(out);
|
||||
return 0;
|
||||
}
|
||||
return switch (args[0]) {
|
||||
case "env" -> runEnv(args, out, err);
|
||||
case "ai" -> runAi(args, out, err);
|
||||
default -> fail(err, "Unknown command: " + args[0]);
|
||||
};
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return fail(err, ex.getMessage());
|
||||
} catch (IOException ex) {
|
||||
return fail(err, "I/O failed: " + ex.getMessage());
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
return fail(err, "Interrupted");
|
||||
}
|
||||
}
|
||||
|
||||
private int runEnv(String[] args, PrintStream out, PrintStream err) throws IOException, InterruptedException {
|
||||
if (args.length < 2 || isHelp(args[1])) {
|
||||
printEnvHelp(out);
|
||||
return 0;
|
||||
}
|
||||
if (!"status".equals(args[1])) {
|
||||
return fail(err, "Unknown env command: " + args[1]);
|
||||
}
|
||||
Options options = Options.parse(args, 2);
|
||||
String baseUrl = baseUrl(options);
|
||||
URI uri = endpoint(baseUrl, "/v3/api-docs");
|
||||
Eip4HttpResponse response = httpClient.send("GET", uri, null);
|
||||
if (!response.successful()) {
|
||||
err.println("EIP4 env NOT_READY");
|
||||
err.println("baseUrl: " + baseUrl);
|
||||
err.println("status: " + response.statusCode());
|
||||
return 2;
|
||||
}
|
||||
out.println("EIP4 env READY");
|
||||
out.println("baseUrl: " + baseUrl);
|
||||
out.println("apiDocs: " + uri);
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int runAi(String[] args, PrintStream out, PrintStream err) throws IOException, InterruptedException {
|
||||
if (args.length < 2 || isHelp(args[1])) {
|
||||
printAiHelp(out);
|
||||
return 0;
|
||||
}
|
||||
if (!"auto-develop".equals(args[1])) {
|
||||
return fail(err, "Unknown ai command: " + args[1]);
|
||||
}
|
||||
Options options = Options.parse(args, 2);
|
||||
ObjectNode request = buildAutoDevelopRequest(options);
|
||||
String baseUrl = baseUrl(options);
|
||||
Eip4HttpResponse response = httpClient.send(
|
||||
"POST",
|
||||
endpoint(baseUrl, "/api/ai/features/auto-develop"),
|
||||
request);
|
||||
if (!response.successful()) {
|
||||
err.println("AI auto-develop failed");
|
||||
err.println("status: " + response.statusCode());
|
||||
err.println(response.body());
|
||||
return 2;
|
||||
}
|
||||
JsonNode body = response.body().isBlank()
|
||||
? objectMapper.createObjectNode()
|
||||
: objectMapper.readTree(response.body());
|
||||
String formatted = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(body);
|
||||
String output = options.single("output");
|
||||
if (output == null) {
|
||||
out.println(formatted);
|
||||
} else {
|
||||
Path outputPath = Path.of(output);
|
||||
if (outputPath.getParent() != null) {
|
||||
Files.createDirectories(outputPath.getParent());
|
||||
}
|
||||
Files.writeString(outputPath, formatted + System.lineSeparator(), StandardCharsets.UTF_8);
|
||||
out.println("Wrote run result: " + outputPath.toAbsolutePath());
|
||||
printAutoDevelopSummary(body, out);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private ObjectNode buildAutoDevelopRequest(Options options) {
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
String baseUrl = baseUrl(options);
|
||||
root.put("baseUrl", baseUrl);
|
||||
root.put("generateDeploymentPackage", !options.has("no-deployment-package"));
|
||||
String maxRepairAttempts = options.single("max-repair-attempts");
|
||||
if (maxRepairAttempts != null) {
|
||||
root.put("maxRepairAttempts", parseInt(maxRepairAttempts, "max-repair-attempts"));
|
||||
}
|
||||
|
||||
ObjectNode feature = root.putObject("feature");
|
||||
putRequired(feature, "objective", options, "objective");
|
||||
putRequired(feature, "featureName", options, "feature-name");
|
||||
putRequired(feature, "tableName", options, "table-name");
|
||||
putRequired(feature, "entityName", options, "entity-name");
|
||||
putRequired(feature, "templateId", options, "template-id");
|
||||
putRequired(feature, "menuName", options, "menu-name");
|
||||
|
||||
List<String> fields = options.values("field");
|
||||
if (fields.isEmpty()) {
|
||||
throw new IllegalArgumentException("Missing required option: --field");
|
||||
}
|
||||
ArrayNode fieldNodes = feature.putArray("fields");
|
||||
for (String field : fields) {
|
||||
fieldNodes.add(parseField(field));
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private ObjectNode parseField(String spec) {
|
||||
String[] parts = spec.split(":", -1);
|
||||
if (parts.length < 3 || parts.length > 5) {
|
||||
throw new IllegalArgumentException("Invalid --field, expected column:label:type[:length][:required]");
|
||||
}
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("column", requiredPart(parts[0], "field column"));
|
||||
node.put("label", requiredPart(parts[1], "field label"));
|
||||
node.put("type", requiredPart(parts[2], "field type").toLowerCase(Locale.ROOT));
|
||||
if (parts.length >= 4 && !parts[3].isBlank()) {
|
||||
node.put("length", parseInt(parts[3], "field length"));
|
||||
}
|
||||
if (parts.length >= 5 && !parts[4].isBlank()) {
|
||||
node.put("required", Boolean.parseBoolean(parts[4]));
|
||||
} else {
|
||||
node.put("required", false);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
private void putRequired(ObjectNode node, String jsonName, Options options, String optionName) {
|
||||
node.put(jsonName, requiredPart(options.single(optionName), optionName));
|
||||
}
|
||||
|
||||
private String baseUrl(Options options) {
|
||||
String value = options.single("base-url");
|
||||
if (value == null || value.isBlank()) {
|
||||
value = System.getenv("EIP4_BASE_URL");
|
||||
}
|
||||
if (value == null || value.isBlank()) {
|
||||
value = DEFAULT_BASE_URL;
|
||||
}
|
||||
while (value.endsWith("/")) {
|
||||
value = value.substring(0, value.length() - 1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private URI endpoint(String baseUrl, String path) {
|
||||
return URI.create(baseUrl + path);
|
||||
}
|
||||
|
||||
private void printAutoDevelopSummary(JsonNode body, PrintStream out) {
|
||||
out.println("status: " + text(body, "status"));
|
||||
out.println("taskId: " + text(body, "taskId"));
|
||||
out.println("changeSetId: " + text(body, "changeSetId"));
|
||||
JsonNode apply = body.path("applyRun");
|
||||
if (!apply.isMissingNode()) {
|
||||
out.println("applyStatus: " + text(apply, "status"));
|
||||
}
|
||||
JsonNode smoke = body.path("smokeRun");
|
||||
if (!smoke.isMissingNode()) {
|
||||
out.println("smokeStatus: " + text(smoke, "status"));
|
||||
}
|
||||
}
|
||||
|
||||
private String text(JsonNode node, String field) {
|
||||
JsonNode value = node.path(field);
|
||||
return value.isMissingNode() || value.isNull() ? "" : value.asText();
|
||||
}
|
||||
|
||||
private int parseInt(String value, String name) {
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new IllegalArgumentException("Invalid integer for " + name + ": " + value);
|
||||
}
|
||||
}
|
||||
|
||||
private String requiredPart(String value, String name) {
|
||||
if (value == null || value.isBlank()) {
|
||||
throw new IllegalArgumentException("Missing required value: " + name);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private boolean isHelp(String arg) {
|
||||
return "--help".equals(arg) || "-h".equals(arg) || "help".equals(arg);
|
||||
}
|
||||
|
||||
private int fail(PrintStream err, String message) {
|
||||
err.println(message);
|
||||
err.println("Run `eip4 --help` for usage.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void printHelp(PrintStream out) {
|
||||
out.println("""
|
||||
EIP4 CLI
|
||||
|
||||
Usage:
|
||||
eip4 env status [--base-url URL]
|
||||
eip4 ai auto-develop --objective TEXT --feature-name NAME --table-name TABLE --entity-name NAME --template-id ID --menu-name NAME --field column:label:type[:length][:required]
|
||||
|
||||
Environment:
|
||||
EIP4_BASE_URL defaults the target service URL when --base-url is omitted.
|
||||
""");
|
||||
}
|
||||
|
||||
private void printEnvHelp(PrintStream out) {
|
||||
out.println("""
|
||||
Usage:
|
||||
eip4 env status [--base-url URL]
|
||||
""");
|
||||
}
|
||||
|
||||
private void printAiHelp(PrintStream out) {
|
||||
out.println("""
|
||||
Usage:
|
||||
eip4 ai auto-develop [options]
|
||||
|
||||
Required:
|
||||
--objective TEXT
|
||||
--feature-name NAME
|
||||
--table-name TABLE
|
||||
--entity-name NAME
|
||||
--template-id ID
|
||||
--menu-name NAME
|
||||
--field column:label:type[:length][:required]
|
||||
|
||||
Optional:
|
||||
--base-url URL
|
||||
--max-repair-attempts N
|
||||
--no-deployment-package
|
||||
--output FILE
|
||||
""");
|
||||
}
|
||||
|
||||
private static final class Options {
|
||||
private final Map<String, List<String>> values = new LinkedHashMap<>();
|
||||
|
||||
static Options parse(String[] args, int from) {
|
||||
Options options = new Options();
|
||||
for (int i = from; i < args.length; i++) {
|
||||
String arg = args[i];
|
||||
if (!arg.startsWith("--")) {
|
||||
throw new IllegalArgumentException("Unexpected argument: " + arg);
|
||||
}
|
||||
String name = arg.substring(2);
|
||||
if (name.isBlank()) {
|
||||
throw new IllegalArgumentException("Invalid option: " + arg);
|
||||
}
|
||||
if ("no-deployment-package".equals(name)) {
|
||||
options.add(name, "true");
|
||||
continue;
|
||||
}
|
||||
if (i + 1 >= args.length || args[i + 1].startsWith("--")) {
|
||||
throw new IllegalArgumentException("Missing value for option: " + arg);
|
||||
}
|
||||
options.add(name, args[++i]);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
boolean has(String name) {
|
||||
return values.containsKey(name);
|
||||
}
|
||||
|
||||
String single(String name) {
|
||||
List<String> list = values.get(name);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
List<String> values(String name) {
|
||||
return values.getOrDefault(name, List.of());
|
||||
}
|
||||
|
||||
private void add(String name, String value) {
|
||||
values.computeIfAbsent(name, ignored -> new ArrayList<>()).add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.eip4.platform.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
interface Eip4HttpClient {
|
||||
Eip4HttpResponse send(String method, URI uri, JsonNode body) throws IOException, InterruptedException;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.eip4.platform.cli;
|
||||
|
||||
record Eip4HttpResponse(int statusCode, String body) {
|
||||
boolean successful() {
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.eip4.platform.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
final class JdkEip4HttpClient implements Eip4HttpClient {
|
||||
|
||||
private static final Duration TIMEOUT = Duration.ofSeconds(30);
|
||||
|
||||
private final HttpClient client;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
JdkEip4HttpClient(ObjectMapper objectMapper) {
|
||||
this.client = HttpClient.newBuilder().connectTimeout(TIMEOUT).build();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Eip4HttpResponse send(String method, URI uri, JsonNode body) throws IOException, InterruptedException {
|
||||
HttpRequest.BodyPublisher publisher = body == null
|
||||
? HttpRequest.BodyPublishers.noBody()
|
||||
: HttpRequest.BodyPublishers.ofString(objectMapper.writeValueAsString(body));
|
||||
HttpRequest request = HttpRequest.newBuilder(uri)
|
||||
.timeout(TIMEOUT)
|
||||
.header("Accept", "application/json")
|
||||
.header("Content-Type", "application/json")
|
||||
.method(method, publisher)
|
||||
.build();
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
return new Eip4HttpResponse(response.statusCode(), response.body());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.eip4.platform.cli;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
class Eip4CliTest {
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@TempDir
|
||||
Path tempDir;
|
||||
|
||||
@Test
|
||||
void envStatusChecksOpenApiEndpoint() {
|
||||
CapturingClient client = new CapturingClient(new Eip4HttpResponse(200, "{}"));
|
||||
CliResult result = run(client, "env", "status", "--base-url", "http://localhost:8084/");
|
||||
|
||||
assertEquals(0, result.code());
|
||||
assertEquals("GET", client.method);
|
||||
assertEquals(URI.create("http://localhost:8084/v3/api-docs"), client.uri);
|
||||
assertTrue(result.out().contains("EIP4 env READY"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void autoDevelopBuildsRequestAndWritesResponse() throws Exception {
|
||||
String response = """
|
||||
{
|
||||
"status": "READY_FOR_HUMAN_REVIEW",
|
||||
"taskId": "task-1",
|
||||
"changeSetId": "cs-1",
|
||||
"applyRun": {"status": "PASSED"},
|
||||
"smokeRun": {"status": "PASSED"}
|
||||
}
|
||||
""";
|
||||
CapturingClient client = new CapturingClient(new Eip4HttpResponse(200, response));
|
||||
Path output = tempDir.resolve("run.json");
|
||||
|
||||
CliResult result = run(client,
|
||||
"ai", "auto-develop",
|
||||
"--base-url", "http://localhost:8084",
|
||||
"--objective", "新增客户等级维护",
|
||||
"--feature-name", "客户等级维护",
|
||||
"--table-name", "EIP4AI_CUSTOMER_LEVEL",
|
||||
"--entity-name", "客户等级",
|
||||
"--template-id", "eip4ai-customer-level",
|
||||
"--menu-name", "客户等级维护",
|
||||
"--field", "NAME:名称:string:100:true",
|
||||
"--field", "ENABLED:启用:boolean::false",
|
||||
"--max-repair-attempts", "3",
|
||||
"--no-deployment-package",
|
||||
"--output", output.toString());
|
||||
|
||||
assertEquals(0, result.code());
|
||||
assertEquals("POST", client.method);
|
||||
assertEquals(URI.create("http://localhost:8084/api/ai/features/auto-develop"), client.uri);
|
||||
assertFalse(client.body.path("generateDeploymentPackage").asBoolean());
|
||||
assertEquals(3, client.body.path("maxRepairAttempts").asInt());
|
||||
JsonNode feature = client.body.path("feature");
|
||||
assertEquals("EIP4AI_CUSTOMER_LEVEL", feature.path("tableName").asText());
|
||||
assertEquals(2, feature.path("fields").size());
|
||||
assertEquals("NAME", feature.path("fields").get(0).path("column").asText());
|
||||
assertEquals(100, feature.path("fields").get(0).path("length").asInt());
|
||||
assertTrue(feature.path("fields").get(0).path("required").asBoolean());
|
||||
assertTrue(Files.readString(output, StandardCharsets.UTF_8).contains("READY_FOR_HUMAN_REVIEW"));
|
||||
assertTrue(result.out().contains("applyStatus: PASSED"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void autoDevelopRequiresAtLeastOneField() {
|
||||
CapturingClient client = new CapturingClient(new Eip4HttpResponse(200, "{}"));
|
||||
|
||||
CliResult result = run(client,
|
||||
"ai", "auto-develop",
|
||||
"--objective", "新增客户等级维护",
|
||||
"--feature-name", "客户等级维护",
|
||||
"--table-name", "EIP4AI_CUSTOMER_LEVEL",
|
||||
"--entity-name", "客户等级",
|
||||
"--template-id", "eip4ai-customer-level",
|
||||
"--menu-name", "客户等级维护");
|
||||
|
||||
assertEquals(1, result.code());
|
||||
assertTrue(result.err().contains("Missing required option: --field"));
|
||||
assertEquals(0, client.calls);
|
||||
}
|
||||
|
||||
private CliResult run(CapturingClient client, String... args) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayOutputStream err = new ByteArrayOutputStream();
|
||||
int code = new Eip4Cli(client).run(
|
||||
args,
|
||||
new PrintStream(out, true, StandardCharsets.UTF_8),
|
||||
new PrintStream(err, true, StandardCharsets.UTF_8));
|
||||
return new CliResult(
|
||||
code,
|
||||
out.toString(StandardCharsets.UTF_8),
|
||||
err.toString(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private final class CapturingClient implements Eip4HttpClient {
|
||||
private final Eip4HttpResponse response;
|
||||
private int calls;
|
||||
private String method;
|
||||
private URI uri;
|
||||
private JsonNode body = objectMapper.createObjectNode();
|
||||
|
||||
private CapturingClient(Eip4HttpResponse response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Eip4HttpResponse send(String method, URI uri, JsonNode body) {
|
||||
this.calls++;
|
||||
this.method = method;
|
||||
this.uri = uri;
|
||||
this.body = body == null ? objectMapper.createObjectNode() : body;
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
private record CliResult(int code, String out, String err) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user