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

devonfw / IDEasy / 22315552991

23 Feb 2026 04:40PM UTC coverage: 70.563% (+0.09%) from 70.474%
22315552991

Pull #1714

github

web-flow
Merge 7d88da975 into 379acdc9d
Pull Request #1714: #404: #1713: advanced logging

4081 of 6382 branches covered (63.95%)

Branch coverage included in aggregate %.

10644 of 14486 relevant lines covered (73.48%)

3.09 hits per line

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

78.57
cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java
1
package com.devonfw.tools.ide.tool.plugin;
2

3
import java.nio.file.Path;
4
import java.util.Locale;
5
import java.util.Properties;
6
import java.util.Set;
7

8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10

11
import com.devonfw.tools.ide.common.Tag;
12
import com.devonfw.tools.ide.common.Tags;
13
import com.devonfw.tools.ide.context.IdeContext;
14

15
/**
16
 * Implementation of {@link ToolPluginDescriptor}.
17
 *
18
 * @param id the unique identifier of the plugin.
19
 * @param name the name of the plugin properties file excluding the extension.
20
 * @param url the optional plugin URL (download/update site).
21
 * @param active {@code true} if the plugin is active and shall be installed automatically, {@code false} otherwise.
22
 * @param tags the {@link #tags () tags}.
23
 */
24
public record ToolPluginDescriptor(String id, String name, String url, boolean active, Set<Tag> tags) implements Tags {
18✔
25

26
  private static final Logger LOG = LoggerFactory.getLogger(ToolPluginDescriptor.class);
4✔
27

28
  @Override
29
  public Set<Tag> getTags() {
30

31
    return this.tags;
×
32
  }
33

34
  /**
35
   * @param propertiesFile the {@link Path} to the plugin {@link Properties} file.
36
   * @param context the {@link IdeContext}.
37
   * @param needUrl - {@code true} if {@link ToolPluginDescriptor#url () URL} needs to be present and a warning shall be logged if missing, {@code false}
38
   *     otherwise.
39
   * @return the loaded {@link ToolPluginDescriptor}.
40
   */
41
  public static ToolPluginDescriptor of(Path propertiesFile, IdeContext context, boolean needUrl) {
42

43
    String name = propertiesFile.getFileName().toString();
4✔
44
    name = name.substring(0, name.length() - IdeContext.EXT_PROPERTIES.length());
9✔
45
    Properties properties = context.getFileAccess().readProperties(propertiesFile);
5✔
46
    String id = getString(properties, "id", "plugin_id");
5✔
47
    String url = getString(properties, "url", "plugin_url");
5✔
48
    if (needUrl && ((url == null) || url.isBlank())) {
7!
49
      LOG.warn("Missing plugin URL in {}", propertiesFile);
×
50
    }
51
    boolean active = getBoolean(properties, "active", "plugin_active", propertiesFile);
6✔
52
    String tagsCsv = getString(properties, "tags", "plugin_tags");
5✔
53
    Set<Tag> tags = Tag.parseCsv(tagsCsv);
3✔
54
    return new ToolPluginDescriptor(id, name, url, active, tags);
9✔
55
  }
56

57
  private static boolean getBoolean(Properties properties, String key, String legacyKey, Path propertiesFile) {
58

59
    String value = getString(properties, key, legacyKey);
5✔
60
    if (value == null) {
2!
61
      return false;
×
62
    }
63
    String lower = value.toLowerCase(Locale.ROOT);
4✔
64
    if ("true".equals(lower)) {
4✔
65
      return true;
2✔
66
    } else if ("false".equals(lower)) {
4!
67
      return false;
2✔
68
    }
69
    LOG.warn("Invalid boolean value '{}' for property '{}' in {}", value, key, propertiesFile);
×
70
    return false;
×
71
  }
72

73
  private static String getString(Properties properties, String key, String legacyKey) {
74

75
    String value = properties.getProperty(key);
4✔
76
    if (value == null) {
2✔
77
      value = properties.getProperty(legacyKey);
4✔
78
    }
79
    return value;
2✔
80
  }
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