1 | package com.github.dakusui.actionunit.actions.cmd.unix; | |
2 | ||
3 | import com.github.dakusui.actionunit.actions.cmd.Commander; | |
4 | import com.github.dakusui.actionunit.actions.cmd.CommanderConfig; | |
5 | import com.github.dakusui.actionunit.core.Context; | |
6 | ||
7 | import java.util.function.Function; | |
8 | ||
9 | import static com.github.dakusui.actionunit.core.context.ContextFunctions.immediateOf; | |
10 | import static java.util.Objects.requireNonNull; | |
11 | ||
12 | public class Curl extends Commander<Curl> { | |
13 | public enum DataFormat { | |
14 | ASCII("--data"), | |
15 | BINARY("--data-binary"), | |
16 | RAW("--data-raw"), | |
17 | URL_ENCODE("--data-urlencode"), | |
18 | ; | |
19 | ||
20 | private final String format; | |
21 | ||
22 | DataFormat(String format) { | |
23 | this.format = format; | |
24 | } | |
25 | ||
26 | String getFormat() { | |
27 |
1
1. getFormat : replaced return value with "" for com/github/dakusui/actionunit/actions/cmd/unix/Curl$DataFormat::getFormat → KILLED |
return this.format; |
28 | } | |
29 | } | |
30 | ||
31 | public Curl(CommanderConfig config) { | |
32 | super(config, "curl"); | |
33 | } | |
34 | ||
35 | public Curl post() { | |
36 |
1
1. post : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::post → KILLED |
return this.addOption("-X").addOption("POST"); |
37 | } | |
38 | ||
39 | public Curl put() { | |
40 |
1
1. put : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::put → KILLED |
return this.addOption("-X").addOption("PUT"); |
41 | } | |
42 | ||
43 | public Curl get() { | |
44 |
1
1. get : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::get → KILLED |
return this.addOption("-X").addOption("GET"); |
45 | } | |
46 | ||
47 | public Curl delete() { | |
48 |
1
1. delete : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::delete → KILLED |
return this.addOption("-X").addOption("DELETE"); |
49 | } | |
50 | ||
51 | public Curl url(String url) { | |
52 |
1
1. url : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::url → KILLED |
return this.add(url); |
53 | } | |
54 | ||
55 | public Curl url(Function<Context, String> url) { | |
56 |
1
1. url : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::url → KILLED |
return this.add(url); |
57 | } | |
58 | ||
59 | public Curl insecure() { | |
60 |
1
1. insecure : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::insecure → KILLED |
return this.addOption("--insecure"); |
61 | } | |
62 | ||
63 | public Curl silent() { | |
64 |
1
1. silent : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::silent → KILLED |
return this.addOption("-s"); |
65 | } | |
66 | ||
67 | public Curl asciiData(String content) { | |
68 |
1
1. asciiData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::asciiData → KILLED |
return this.asciiData(immediateOf(content)); |
69 | } | |
70 | ||
71 | public Curl asciiData(Function<Context, String> content) { | |
72 |
1
1. asciiData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::asciiData → KILLED |
return this.data(DataFormat.ASCII, content); |
73 | } | |
74 | ||
75 | public Curl binaryData(String content) { | |
76 |
1
1. binaryData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::binaryData → KILLED |
return this.binaryData(immediateOf(content)); |
77 | } | |
78 | ||
79 | public Curl binaryData(Function<Context, String> content) { | |
80 |
1
1. binaryData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::binaryData → KILLED |
return this.data(DataFormat.BINARY, content); |
81 | } | |
82 | ||
83 | public Curl rawData(String content) { | |
84 |
1
1. rawData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::rawData → KILLED |
return this.rawData(immediateOf(content)); |
85 | } | |
86 | ||
87 | public Curl rawData(Function<Context, String> content) { | |
88 |
1
1. rawData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::rawData → KILLED |
return this.data(DataFormat.RAW, content); |
89 | } | |
90 | ||
91 | public Curl urlEncodedData(String content) { | |
92 |
1
1. urlEncodedData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::urlEncodedData → KILLED |
return this.urlEncodedData(immediateOf(content)); |
93 | } | |
94 | ||
95 | public Curl urlEncodedData(Function<Context, String> content) { | |
96 |
1
1. urlEncodedData : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::urlEncodedData → KILLED |
return this.data(DataFormat.URL_ENCODE, content); |
97 | } | |
98 | ||
99 | public Curl data(DataFormat format, Function<Context, String> content) { | |
100 |
1
1. data : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::data → KILLED |
return this.addOption(format.getFormat()).add(requireNonNull(content)); |
101 | } | |
102 | ||
103 | public Curl includeHeader() { | |
104 |
1
1. includeHeader : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::includeHeader → KILLED |
return this.addOption("-i"); |
105 | } | |
106 | ||
107 | public Curl headerOnly() { | |
108 |
1
1. headerOnly : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Curl::headerOnly → KILLED |
return this.addOption("-I"); |
109 | } | |
110 | } | |
Mutations | ||
27 |
1.1 |
|
36 |
1.1 |
|
40 |
1.1 |
|
44 |
1.1 |
|
48 |
1.1 |
|
52 |
1.1 |
|
56 |
1.1 |
|
60 |
1.1 |
|
64 |
1.1 |
|
68 |
1.1 |
|
72 |
1.1 |
|
76 |
1.1 |
|
80 |
1.1 |
|
84 |
1.1 |
|
88 |
1.1 |
|
92 |
1.1 |
|
96 |
1.1 |
|
100 |
1.1 |
|
104 |
1.1 |
|
108 |
1.1 |