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

mybatis / migrations / #436

pending completion
#436

push

github

web-flow
Merge pull request #295 from hazendaz/develop

Run overall code cleanup using Eclipse

91 of 91 new or added lines in 19 files covered. (100.0%)

1777 of 2212 relevant lines covered (80.33%)

0.8 hits per line

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

70.73
/src/main/java/org/apache/ibatis/migration/commands/InfoCommand.java
1
/*
2
 *    Copyright 2010-2023 the original author or authors.
3
 *
4
 *    Licensed under the Apache License, Version 2.0 (the "License");
5
 *    you may not use this file except in compliance with the License.
6
 *    You may obtain a copy of the License at
7
 *
8
 *       https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *    Unless required by applicable law or agreed to in writing, software
11
 *    distributed under the License is distributed on an "AS IS" BASIS,
12
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *    See the License for the specific language governing permissions and
14
 *    limitations under the License.
15
 */
16
package org.apache.ibatis.migration.commands;
17

18
import java.io.File;
19
import java.io.IOException;
20
import java.io.InputStream;
21
import java.io.PrintStream;
22
import java.nio.charset.Charset;
23
import java.util.Locale;
24
import java.util.Properties;
25

26
public final class InfoCommand implements Command {
27
  private final PrintStream out;
28

29
  public InfoCommand(PrintStream out) {
1✔
30
    this.out = out;
1✔
31
  }
1✔
32

33
  @Override
34
  public void execute(String... params) {
35
    Properties properties = new Properties();
1✔
36
    try (InputStream is = getClass().getResourceAsStream("/mybatis-migrations.properties")) {
1✔
37
      if (is != null) {
1✔
38
        properties.load(is);
1✔
39
      }
40
    } catch (IOException e) {
×
41
      // ignore
42
    }
1✔
43

44
    out.printf("%s %s (%s)%n", properties.getProperty("name"), properties.getProperty("version"),
1✔
45
        properties.getProperty("build"));
1✔
46
    out.printf("Java version: %s, vendor: %s%n", System.getProperty("java.version"), System.getProperty("java.vendor"));
1✔
47
    out.printf("Java home: %s%n", System.getProperty("java.home"));
1✔
48
    out.printf("Default locale: %s, platform encoding: %s%n", Locale.getDefault().toLanguageTag(),
1✔
49
        Charset.defaultCharset().name());
1✔
50
    out.printf("OS name: \"%s\", version: \"%s\", arch: \"%s\", family: \"%s\"%n", System.getProperty("os.name"),
1✔
51
        System.getProperty("os.version"), System.getProperty("os.arch"), getOsFamily());
1✔
52
  }
1✔
53

54
  private static String getOsFamily() {
55
    String osName = System.getProperty("os.name").toLowerCase();
1✔
56
    String pathSep = File.pathSeparator;
1✔
57

58
    if (osName.indexOf("windows") != -1) {
1✔
59
      return "windows";
×
60
    }
61

62
    if (osName.indexOf("os/2") != -1) {
1✔
63
      return "os/2";
×
64
    }
65

66
    if (osName.indexOf("z/os") != -1 || osName.indexOf("os/390") != -1) {
1✔
67
      return "z/os";
×
68
    }
69

70
    if (osName.indexOf("os/400") != -1) {
1✔
71
      return "os/400";
×
72
    }
73

74
    if (pathSep.equals(";")) {
1✔
75
      return "dos";
×
76
    }
77

78
    if (osName.indexOf("mac") != -1) {
1✔
79
      if (osName.endsWith("x")) {
×
80
        return "mac"; // MACOSX
×
81
      }
82
      return "unix";
×
83
    }
84

85
    if (osName.indexOf("nonstop_kernel") != -1) {
1✔
86
      return "tandem";
×
87
    }
88

89
    if (osName.indexOf("openvms") != -1) {
1✔
90
      return "openvms";
×
91
    }
92

93
    if (pathSep.equals(":")) {
1✔
94
      return "unix";
1✔
95
    }
96

97
    return "undefined";
×
98
  }
99

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