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

devonfw / IDEasy / 13546685839

26 Feb 2025 02:52PM UTC coverage: 68.042% (-0.004%) from 68.046%
13546685839

push

github

web-flow
#1033: Introduce dependencies.json for jmc (#1057)

Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

2997 of 4849 branches covered (61.81%)

Branch coverage included in aggregate %.

7774 of 10981 relevant lines covered (70.8%)

3.08 hits per line

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

88.24
cli/src/main/java/com/devonfw/tools/ide/tool/jmc/Jmc.java
1
package com.devonfw.tools.ide.tool.jmc;
2

3
import java.io.IOException;
4
import java.nio.file.Files;
5
import java.nio.file.Path;
6
import java.util.Iterator;
7
import java.util.Set;
8
import java.util.stream.Stream;
9

10
import com.devonfw.tools.ide.common.Tag;
11
import com.devonfw.tools.ide.context.IdeContext;
12
import com.devonfw.tools.ide.io.FileAccess;
13
import com.devonfw.tools.ide.process.ProcessMode;
14
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
15
import com.devonfw.tools.ide.tool.ToolCommandlet;
16

17
/**
18
 * {@link ToolCommandlet} for <a href="https://www.oracle.com/java/technologies/jdk-mission-control.html">JDK Mission Control</a>, An advanced set of tools for
19
 * managing, monitoring, profiling, and troubleshooting Java applications.
20
 */
21
public class Jmc extends LocalToolCommandlet {
22

23
  /**
24
   * The constructor.
25
   *
26
   * @param context the {@link IdeContext}. method.
27
   */
28
  public Jmc(IdeContext context) {
29

30
    super(context, "jmc", Set.of(Tag.JAVA, Tag.ANALYSE));
7✔
31
  }
1✔
32

33
  @Override
34
  public void run() {
35

36
    runTool(ProcessMode.BACKGROUND, null, this.arguments.asArray());
7✔
37
  }
1✔
38

39
  @Override
40
  public void postInstall() {
41

42
    super.postInstall();
2✔
43

44
    if (this.context.getSystemInfo().isWindows() || this.context.getSystemInfo().isLinux()) {
10✔
45
      Path toolPath = getToolPath();
3✔
46
      Path oldBinaryPath = toolPath.resolve("JDK Mission Control");
4✔
47
      if (Files.isDirectory(oldBinaryPath)) {
5!
48
        FileAccess fileAccess = this.context.getFileAccess();
4✔
49
        moveFilesAndDirs(oldBinaryPath, toolPath);
4✔
50
        fileAccess.delete(oldBinaryPath);
3✔
51
      } else {
1✔
52
        this.context.info(
×
53
            "JMC binary folder not found at {} - ignoring as this legacy problem may be resolved in newer versions.",
54
            oldBinaryPath);
55
      }
56
    }
57

58
  }
1✔
59

60
  private void moveFilesAndDirs(Path sourceFolder, Path targetFolder) {
61

62
    FileAccess fileAccess = this.context.getFileAccess();
4✔
63
    try (Stream<Path> childStream = Files.list(sourceFolder)) {
3✔
64
      Iterator<Path> iterator = childStream.iterator();
3✔
65
      while (iterator.hasNext()) {
3✔
66
        Path child = iterator.next();
4✔
67
        fileAccess.move(child, targetFolder.resolve(child.getFileName()));
7✔
68
      }
1✔
69
    } catch (IOException e) {
×
70
      throw new IllegalStateException("Failed to list files to move in " + sourceFolder, e);
×
71
    }
1✔
72
  }
1✔
73

74
}
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