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

devonfw / IDEasy / 14172572291

31 Mar 2025 01:20PM UTC coverage: 67.764% (+0.3%) from 67.422%
14172572291

push

github

web-flow
#103: create java resemblance for security.json (#1183)

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

3053 of 4934 branches covered (61.88%)

Branch coverage included in aggregate %.

7880 of 11200 relevant lines covered (70.36%)

3.07 hits per line

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

87.88
cli/src/main/java/com/devonfw/tools/ide/tool/repository/DefaultToolRepository.java
1
package com.devonfw.tools.ide.tool.repository;
2

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

6
import com.devonfw.tools.ide.context.IdeContext;
7
import com.devonfw.tools.ide.os.SystemInfo;
8
import com.devonfw.tools.ide.tool.ToolCommandlet;
9
import com.devonfw.tools.ide.url.model.UrlMetadata;
10
import com.devonfw.tools.ide.url.model.file.UrlDownloadFileMetadata;
11
import com.devonfw.tools.ide.url.model.file.json.ToolDependencies;
12
import com.devonfw.tools.ide.url.model.file.json.ToolDependency;
13
import com.devonfw.tools.ide.url.model.file.json.ToolSecurity;
14
import com.devonfw.tools.ide.url.model.folder.UrlEdition;
15
import com.devonfw.tools.ide.url.model.folder.UrlTool;
16
import com.devonfw.tools.ide.url.model.folder.UrlVersion;
17
import com.devonfw.tools.ide.version.VersionIdentifier;
18

19
/**
20
 * Default implementation of {@link ToolRepository} based on "ide-urls" using {@link UrlMetadata}.
21
 */
22
public class DefaultToolRepository extends AbstractToolRepository {
23

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

31
    super(context);
3✔
32
  }
1✔
33

34
  @Override
35
  public String getId() {
36

37
    return ID_DEFAULT;
2✔
38
  }
39

40
  @Override
41
  protected UrlDownloadFileMetadata getMetadata(String tool, String edition, VersionIdentifier version, ToolCommandlet toolCommandlet) {
42

43
    UrlMetadata metadata = this.context.getUrls();
4✔
44
    UrlVersion urlVersion = metadata.getVersionFolder(tool, edition, version, toolCommandlet);
7✔
45
    SystemInfo sys = this.context.getSystemInfo();
4✔
46
    return urlVersion.getMatchingUrls(sys.getOs(), sys.getArchitecture());
7✔
47
  }
48

49
  @Override
50
  public Collection<ToolDependency> findDependencies(String tool, String edition, VersionIdentifier version) {
51

52
    UrlEdition urlEdition = this.context.getUrls().getEdition(tool, edition);
7✔
53
    ToolDependencies dependencies = urlEdition.getDependencyFile().getDependencies();
4✔
54
    if (dependencies == ToolDependencies.getEmpty()) {
3✔
55
      UrlTool urlTool = urlEdition.getParent();
4✔
56
      dependencies = urlTool.getDependencyFile().getDependencies();
4✔
57
    }
58
    if (dependencies != ToolDependencies.getEmpty()) {
3✔
59
      this.context.trace("Found dependencies in {}", dependencies);
10✔
60
    }
61
    return dependencies.findDependencies(version, this.context);
6✔
62
  }
63

64
  @Override
65
  public ToolSecurity findSecurity(String tool, String edition) {
66
    UrlEdition urlEdition = this.context.getUrls().getEdition(tool, edition);
7✔
67
    ToolSecurity security = urlEdition.getSecurityFile().getSecurity();
4✔
68
    if (security == ToolSecurity.getEmpty()) {
3!
69
      UrlTool urlTool = urlEdition.getParent();
×
70
      security = urlTool.getSecurityFile().getSecurity();
×
71
    }
72
    if (security != ToolSecurity.getEmpty()) {
3!
73
      this.context.trace("Found dependencies in {}", security);
10✔
74
    }
75
    return security;
2✔
76
  }
77

78
  @Override
79
  public List<String> getSortedEditions(String tool) {
80

81
    return this.context.getUrls().getSortedEditions(tool);
6✔
82
  }
83

84
  @Override
85
  public List<VersionIdentifier> getSortedVersions(String tool, String edition, ToolCommandlet toolCommandlet) {
86

87
    return this.context.getUrls().getSortedVersions(tool, edition, toolCommandlet);
8✔
88
  }
89
}
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

© 2025 Coveralls, Inc