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

devonfw / IDEasy / 7280603633

20 Dec 2023 08:45PM UTC coverage: 47.217% (-0.7%) from 47.873%
7280603633

Pull #160

github

web-flow
Merge af9910eb4 into 1d60d9c17
Pull Request #160: #126: Monitoring for ide-urls

1019 of 2393 branches covered (0.0%)

Branch coverage included in aggregate %.

2714 of 5513 relevant lines covered (49.23%)

2.03 hits per line

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

0.0
cli/src/main/java/com/devonfw/tools/ide/url/UpdateInitiator.java
1
package com.devonfw.tools.ide.url;
2

3
import java.nio.file.Path;
4
import java.time.Duration;
5
import java.time.Instant;
6
import java.time.format.DateTimeParseException;
7

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

11
import com.devonfw.tools.ide.url.model.UrlErrorReport;
12
import com.devonfw.tools.ide.url.updater.UpdateManager;
13

14
/**
15
 * This is the main program to run the updater of {@code ide-urls} repository. It is run nightly via an automated
16
 * process.
17
 */
18
public class UpdateInitiator {
×
19
  private static final Logger logger = LoggerFactory.getLogger(UpdateInitiator.class.getName());
×
20

21
  /**
22
   * @param args the command-line arguments. arg[0] points to the {@code ide-urls} repository. arg[1] defines a timeout
23
   * for GitHub actions in Duration string format.
24
   */
25
  public static void main(String[] args) {
26

27
    if (args.length == 0) {
×
28
      logger.error("Error: Missing path to repository as well as missing timeout as command line arguments.");
×
29
      logger.error("Usage: java UpdateInitiator <path_to_repository> <duration_string_format>");
×
30
      System.exit(1);
×
31
    }
32

33
    String pathToRepo = args[0];
×
34
    Instant expirationTime = null;
×
35

36
    if (args.length < 2) {
×
37
      logger.warn("Timeout was not set, setting timeout to infinite instead.");
×
38
    } else {
39
      try {
40
        Duration duration = Duration.parse(args[1]);
×
41
        expirationTime = Instant.now().plus(duration);
×
42
        logger.info("Timeout was set to: {}.", expirationTime);
×
43
      } catch (DateTimeParseException e) {
×
44
        logger.error("Error: Provided timeout format is not valid.", e);
×
45
        System.exit(1);
×
46
      }
×
47
    }
48

49
    Path repoPath = Path.of(pathToRepo);
×
50

51
    if (!repoPath.toFile().isDirectory()) {
×
52
      logger.error("Error: Provided path is not a valid directory.");
×
53
      System.exit(1);
×
54
    }
55

56
    UpdateManager updateManager = new UpdateManager(repoPath, expirationTime);
×
57
    updateManager.updateAll();
×
58

59
    logger.warn(UrlErrorReport.getReport());
×
60
  }
×
61
}
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