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

devonfw / IDEasy / 8144002629

04 Mar 2024 04:56PM UTC coverage: 58.928% (+0.7%) from 58.254%
8144002629

push

github

web-flow
#208: improve test infrastructure # 219: fix wrong executable (#238)

* Add first implementation

* Add javadoc

* Add javadoc

* Using target path instead of ressource path to make sure one-to-one copy of set up folders is used

* Add JavaDoc and mac mock program

* Add support for multiple dependencies while testing

* Minor changes

* Modify mock programs for testing

* Refactored example JmcTest

* Add possibility to set execution path by using the context

* Reenable test after related issue 228 has been merged

* Replace ternary with regular if

* Add missing javadoc

* Add missing javadoc

* remove unnecessary semicolon

* Fix spelling typo

* Minor test changes

* Refactoring FileExtractor class for more modularity

* using const

* Add missing extensions

* Remove unnecessary execption declaration and minor rename

* Fix spelling

* Add javadoc

* Forget dot

* minor change

* Revert "minor change"

This reverts commit ec81c3ce6.

* Revert "Merge branch 'main' into feature/208-MockOutToolRepoRefactorTestInfra"

This reverts commit d58847230, reversing
changes made to f38b3105f.

* Revert "Revert "Merge branch 'main' into feature/208-MockOutToolRepoRefactorTestInfra""

This reverts commit 3e49a0b3d.

* Revert "Revert "minor change""

This reverts commit 2f7b94624.

* fix typo

* #208: review and complete rework

* #208: improved system path

* #208: found and fixed bug on windows

* #208: improve OS mocking

* #208: improve test logging

reveal logs/errors so the developer actually sees what is happening instead of leaving them in the dark

* #208: improve OS detection

* #208: fixed

found and fixed bug in MacOS app detection for JMC, fixed copy file to folder bug, moved !extract logic back to FileAccess, f... (continued)

1580 of 2930 branches covered (53.92%)

Branch coverage included in aggregate %.

4047 of 6619 relevant lines covered (61.14%)

2.65 hits per line

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

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

3
import com.devonfw.tools.ide.common.Tag;
4
import com.devonfw.tools.ide.context.IdeContext;
5
import com.devonfw.tools.ide.io.FileAccess;
6
import com.devonfw.tools.ide.process.ProcessMode;
7
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
8
import com.devonfw.tools.ide.tool.ToolCommandlet;
9
import com.devonfw.tools.ide.tool.java.Java;
10

11
import java.io.IOException;
12
import java.nio.file.Files;
13
import java.nio.file.Path;
14
import java.util.Iterator;
15
import java.util.Set;
16
import java.util.stream.Stream;
17

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

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

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

34
  @Override
35
  public boolean doInstall(boolean silent) {
36

37
    getCommandlet(Java.class).install();
6✔
38
    return super.doInstall(silent);
4✔
39
  }
40

41
  @Override
42
  public void run() {
43

44
    runTool(ProcessMode.BACKGROUND, null, this.arguments.asArray());
7✔
45
  }
1✔
46

47
  @Override
48
  public void postInstall() {
49

50
    super.postInstall();
2✔
51

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

66
  }
1✔
67

68
  private void moveFilesAndDirs(Path sourceFolder, Path targetFolder) {
69

70
    FileAccess fileAccess = this.context.getFileAccess();
4✔
71
    try (Stream<Path> childStream = Files.list(sourceFolder)) {
3✔
72
      Iterator<Path> iterator = childStream.iterator();
3✔
73
      while (iterator.hasNext()) {
3✔
74
        Path child = iterator.next();
4✔
75
        fileAccess.move(child, targetFolder.resolve(child.getFileName()));
7✔
76
      }
1✔
77
    } catch (IOException e) {
×
78
      throw new IllegalStateException("Failed to list files to move in " + sourceFolder, e);
×
79
    }
1✔
80
  }
1✔
81

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