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

devonfw / IDEasy / 9907372175

12 Jul 2024 11:49AM UTC coverage: 61.142% (-0.02%) from 61.162%
9907372175

push

github

hohwille
fixed tests

1997 of 3595 branches covered (55.55%)

Branch coverage included in aggregate %.

5296 of 8333 relevant lines covered (63.55%)

2.8 hits per line

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

68.0
cli/src/main/java/com/devonfw/tools/ide/commandlet/RepositoryConfig.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.io.FileInputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.nio.file.Path;
7
import java.util.Collections;
8
import java.util.Properties;
9
import java.util.Set;
10

11
/**
12
 * Represents the configuration of a repository to be used by the {@link RepositoryCommandlet}.
13
 *
14
 * @param path Path into which the project is cloned. This path is relative to the workspace.
15
 * @param workingSets The working sets associated with the repository.
16
 * @param workspace Workspace to use for checkout and import. Default is main.
17
 * @param gitUrl Git URL to use for cloning the project.
18
 * @param gitBranch Git branch to checkout. Git default branch is default.
19
 * @param buildPath The build path for the repository.
20
 * @param buildCmd The command to invoke to build the repository after clone or pull. If omitted no build is triggered.
21
 * @param imports list of IDEs where the repository will be imported to.
22
 * @param active {@code true} to setup the repository during setup, {@code false} to skip.
23
 */
24
public record RepositoryConfig(
30✔
25
    String path,
26
    String workingSets,
27
    String workspace,
28
    String gitUrl,
29
    String gitBranch,
30
    String buildPath,
31
    String buildCmd,
32
    Set<String> imports,
33
    boolean active) {
34

35
  public static RepositoryConfig loadProperties(Path filePath) {
36

37
    Properties properties = new Properties();
4✔
38
    try (InputStream input = new FileInputStream(filePath.toString())) {
6✔
39
      properties.load(input);
3✔
40
    } catch (IOException e) {
×
41
      throw new IllegalStateException("Failed to read file: " + filePath, e);
×
42
    }
1✔
43

44
    Set<String> importsSet = getImports(properties);
3✔
45

46
    return new RepositoryConfig(properties.getProperty("path"), properties.getProperty("workingsets"),
11✔
47
        properties.getProperty("workspace"), properties.getProperty("git_url"), properties.getProperty("git_branch"),
9✔
48
        properties.getProperty(("build_path")), properties.getProperty("build_cmd"), importsSet,
7✔
49
        Boolean.parseBoolean(properties.getProperty("active").trim()));
4✔
50
  }
51

52
  private static Set<String> getImports(Properties properties) {
53

54
    String importProperty = properties.getProperty("import");
4✔
55
    if (importProperty != null && !importProperty.isEmpty()) {
2!
56
      return Set.of(importProperty.split("\\s*,\\s*"));
×
57
    }
58

59
    String legacyImportProperty = properties.getProperty("eclipse");
4✔
60
    if ("import".equals(legacyImportProperty)) {
4!
61
      return Set.of("eclipse");
×
62
    } else {
63
      return Collections.emptySet();
2✔
64
    }
65
  }
66
}
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