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

devonfw / IDEasy / 29562456972

17 Jul 2026 07:14AM UTC coverage: 72.486% (-0.02%) from 72.506%
29562456972

Pull #2169

github

web-flow
Merge 9728d0ab4 into de5a980f5
Pull Request #2169: #1965: improve dependent installation (WIP)

4915 of 7500 branches covered (65.53%)

Branch coverage included in aggregate %.

12705 of 16808 relevant lines covered (75.59%)

3.19 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 installRequest;
36

37

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

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

58
    return this.type;
3✔
59
  }
60

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

67
    return this.args;
3✔
68
  }
69

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

79
  /**
80
   * @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
81
   *     {@link ToolCommandlet#getName() tool names} in IDEasy.
82
   * @see PackageManagerBasedLocalToolCommandlet#getPackageName()
83
   */
84
  public String getTool() {
85

86
    return this.tool;
3✔
87
  }
88

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

94
    return this.version;
3✔
95
  }
96

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

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

114
    return packageManager;
3✔
115
  }
116

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

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

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

135
    return this.processContext;
3✔
136
  }
137

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

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

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

156
    return this.processMode;
3✔
157
  }
158

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

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

172
  /**
173
   * @return the installation context of the PackageManagerRequest
174
   */
175
  public ToolInstallRequest getInstallRequest() {
176
    return this.installRequest;
3✔
177
  }
178

179
  /**
180
   * @param installRequest sets installation context if it is missing
181
   * @return this {@link PackageManagerRequest} for fluent API calls.
182
   */
183
  public PackageManagerRequest setInstallRequest(ToolInstallRequest installRequest) {
184
    if (this.installRequest != null) {
3!
185
      throw new IllegalStateException();
×
186
    }
187
    this.installRequest = installRequest;
3✔
188
    return this;
2✔
189
  }
190

191

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

© 2026 Coveralls, Inc