• 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

93.33
/src/main/java/org/apache/ibatis/migration/commands/Commands.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 org.apache.ibatis.migration.MigrationException;
19
import org.apache.ibatis.migration.options.SelectedOptions;
20

21
public enum Commands {
1✔
22
  INFO,
1✔
23

24
  INIT,
1✔
25

26
  BOOTSTRAP,
1✔
27

28
  NEW,
1✔
29

30
  UP,
1✔
31

32
  DOWN,
1✔
33

34
  PENDING,
1✔
35

36
  SCRIPT,
1✔
37

38
  VERSION,
1✔
39

40
  STATUS,
1✔
41

42
  REDO;
1✔
43

44
  public static Command resolveCommand(String commandString, SelectedOptions selectedOptions) {
45
    final String upperCasedStr = commandString.toUpperCase();
1✔
46
    for (Commands command : values()) {
1✔
47
      if (command.name().startsWith(upperCasedStr)) {
1✔
48
        return createCommand(command, selectedOptions);
1✔
49
      }
50
    }
51

52
    throw new MigrationException("Attempt to execute unknown command: " + commandString);
×
53
  }
54

55
  private static Command createCommand(Commands aResolvedCommand, SelectedOptions selectedOptions) {
56
    switch (aResolvedCommand) {
1✔
57
      case INFO:
58
        return new InfoCommand(System.out);
1✔
59
      case INIT:
60
        return new InitializeCommand(selectedOptions);
1✔
61
      case BOOTSTRAP:
62
        return new BootstrapCommand(selectedOptions);
1✔
63
      case NEW:
64
        return new NewCommand(selectedOptions);
1✔
65
      case UP:
66
        return new UpCommand(selectedOptions);
1✔
67
      case DOWN:
68
        return new DownCommand(selectedOptions);
1✔
69
      case PENDING:
70
        return new PendingCommand(selectedOptions);
1✔
71
      case SCRIPT:
72
        return new ScriptCommand(selectedOptions);
1✔
73
      case VERSION:
74
        return new VersionCommand(selectedOptions);
1✔
75
      case STATUS:
76
        return new StatusCommand(selectedOptions);
1✔
77
      case REDO:
78
        return new RedoCommand(selectedOptions);
1✔
79
      default:
80
        return params -> System.out.println("unknown command");
×
81
    }
82
  }
83
}
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