• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 30882542201

04 Aug 2026 06:01AM UTC coverage: 72.616% (+0.03%) from 72.587%
30882542201

Pull #2246

github

web-flow
Merge 33bd8f4a3 into cd9770b9c
Pull Request #2246: #1965: improve dependent installation

5017 of 7657 branches covered (65.52%)

Branch coverage included in aggregate %.

13087 of 17274 relevant lines covered (75.76%)

3.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.78
cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerRequest.java
1
package com.devonfw.tools.ide.tool;
2

3
import java.util.ArrayList;
4
import java.util.List;
5

6
import com.devonfw.tools.ide.process.ProcessContext;
7
import com.devonfw.tools.ide.process.ProcessMode;
8
import com.devonfw.tools.ide.version.VersionIdentifier;
9

10
/**
11
 * Container for the data related to a package manager request.
12
 */
13
public final class PackageManagerRequest {
14

15
  /** {@link #getType() Type} of request to install a tool. */
16
  public static final String TYPE_INSTALL = "install";
17

18
  /** {@link #getType() Type} of request to uninstall a tool. */
19
  public static final String TYPE_UNINSTALL = "uninstall";
20

21
  private final String type;
22

23
  private final String tool;
24

25
  private final List<String> args;
26

27
  private VersionIdentifier version;
28

29
  private ToolCommandlet packageManager;
30

31
  private ProcessContext processContext;
32

33
  private ProcessMode processMode;
34

35
  private ToolInstallRequest toolInstallRequest;
36

37
  /**
38
   * The constructor.
39
   *
40
   * @param type the {@link #getType() type}.
41
   * @param tool the {@link #getTool() tool}.
42
   */
43
  public PackageManagerRequest(String type, String tool) {
44
    super();
2✔
45
    this.type = type;
3✔
46
    this.tool = tool;
3✔
47
    this.args = new ArrayList<>();
5✔
48
  }
1✔
49

50
  /**
51
   * @return the type of this request (the sub-command of the package manager).
52
   * @see #TYPE_INSTALL
53
   * @see #TYPE_UNINSTALL
54
   */
55
  public String getType() {
56

57
    return this.type;
3✔
58
  }
59

60
  /**
61
   * @return the CLI args used to {@link ToolCommandlet#runTool(List) run} the {@link #getPackageManager() package manager}. E.g.
62
   *     <code>List.of("install", "-gf", "@angular/cli")</code>.
63
   */
64
  public List<String> getArgs() {
65

66
    return this.args;
3✔
67
  }
68

69
  /**
70
   * @param arg the argument to append to the {@link #getArgs() args}.
71
   * @return this {@link PackageManagerRequest} for fluent API calls.
72
   */
73
  public PackageManagerRequest addArg(String arg) {
74
    this.args.add(arg);
5✔
75
    return this;
2✔
76
  }
77

78
  /**
79
   * @return the tool to manage (e.g. install) via this request. Will be in the syntax and terminology of the package-manager that can differ from
80
   *     {@link ToolCommandlet#getName() tool names} in IDEasy.
81
   * @see PackageManagerBasedLocalToolCommandlet#getPackageName()
82
   */
83
  public String getTool() {
84

85
    return this.tool;
3✔
86
  }
87

88
  /**
89
   * @return the optional {@link VersionIdentifier} of the {@link #getTool() tool} (e.g. to install exactly this version).
90
   */
91
  public VersionIdentifier getVersion() {
92

93
    return this.version;
3✔
94
  }
95

96
  /**
97
   * @param version new value of {@link #getVersion()}.
98
   * @return this {@link PackageManagerRequest} for fluent API calls.
99
   */
100
  public PackageManagerRequest setVersion(VersionIdentifier version) {
101
    if (this.version != null) {
3!
102
      throw new IllegalStateException();
×
103
    }
104
    this.version = version;
3✔
105
    return this;
2✔
106
  }
107

108
  /**
109
   * @return the {@link ToolCommandlet} acting as package manager.
110
   */
111
  public ToolCommandlet getPackageManager() {
112

113
    return packageManager;
3✔
114
  }
115

116
  /**
117
   * @param packageManager new value of {@link #getPackageManager()}.
118
   * @return this {@link PackageManagerRequest} for fluent API calls.
119
   */
120
  public PackageManagerRequest setPackageManager(ToolCommandlet packageManager) {
121

122
    if (this.packageManager != null) {
3!
123
      throw new IllegalStateException();
×
124
    }
125
    this.packageManager = packageManager;
3✔
126
    return this;
2✔
127
  }
128

129
  /**
130
   * @return the {@link ProcessContext}.
131
   */
132
  public ProcessContext getProcessContext() {
133

134
    return this.processContext;
3✔
135
  }
136

137
  /**
138
   * @param processContext new value of {@link #getProcessContext()}.
139
   * @return this {@link PackageManagerRequest} for fluent API calls.
140
   */
141
  public PackageManagerRequest setProcessContext(ProcessContext processContext) {
142

143
    if (this.processContext != null) {
3!
144
      throw new IllegalStateException();
×
145
    }
146
    this.processContext = processContext;
3✔
147
    return this;
2✔
148
  }
149

150
  /**
151
   * @return the {@link ProcessMode} used to invoke the package manager.
152
   */
153
  public ProcessMode getProcessMode() {
154

155
    return this.processMode;
3✔
156
  }
157

158
  /**
159
   * @param processMode new value of {@link #getProcessMode()}.
160
   * @return this {@link PackageManagerRequest} for fluent API calls.
161
   */
162
  public PackageManagerRequest setProcessMode(ProcessMode processMode) {
163

164
    if (this.processMode != null) {
3!
165
      throw new IllegalStateException();
×
166
    }
167
    this.processMode = processMode;
3✔
168
    return this;
2✔
169
  }
170

171
  /**
172
   * @return the {@link ToolInstallRequest}.
173
   */
174
  public ToolInstallRequest getToolInstallRequest() {
175
    return this.toolInstallRequest;
3✔
176
  }
177

178
  /**
179
   * @param toolInstallRequest new value of {@link #getToolInstallRequest()} ToolInstallRequest()}.
180
   * @return this {@link PackageManagerRequest} for fluent API calls.
181
   */
182
  public PackageManagerRequest setToolInstallRequest(
183
      ToolInstallRequest toolInstallRequest) {
184

185
    if (this.toolInstallRequest != null) {
3!
186
      throw new IllegalStateException();
×
187
    }
188

189
    this.toolInstallRequest = toolInstallRequest;
3✔
190
    return this;
2✔
191
  }
192

193
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc