Archived
feat(cli): set up project structure and main entry point (#1)
- Create Main.java with picocli integration and testable run() method - Create BarnCommand as root command with all subcommands registered - Add placeholder subcommands: run, status, describe, kill, clean, service, config - Update package structure from org.media.samson to com.samsonmedia.barn - Configure checkstyle to allow underscores in test method names - Add comprehensive tests for all CLI commands (26 tests, 80%+ coverage) Closes #1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e861e12058
commit
05937b1f7e
14 files changed
+609
-28
No files matched your search
@@ -57,7 +57,7 @@
|
|||||||
</module>
|
</module>
|
||||||
|
|
||||||
<module name="MethodName">
|
<module name="MethodName">
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<module name="MemberName">
|
<module name="MemberName">
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
|
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
|
||||||
<checkstyle-plugin.version>3.6.0</checkstyle-plugin.version>
|
<checkstyle-plugin.version>3.6.0</checkstyle-plugin.version>
|
||||||
<checkstyle.version>10.21.1</checkstyle.version>
|
<checkstyle.version>10.21.1</checkstyle.version>
|
||||||
<spotbugs-plugin.version>4.8.6.6</spotbugs-plugin.version>
|
<spotbugs-plugin.version>4.9.1.0</spotbugs-plugin.version>
|
||||||
<pmd-plugin.version>3.26.0</pmd-plugin.version>
|
<pmd-plugin.version>3.26.0</pmd-plugin.version>
|
||||||
<jacoco-plugin.version>0.8.12</jacoco-plugin.version>
|
<jacoco-plugin.version>0.8.12</jacoco-plugin.version>
|
||||||
<native-maven-plugin.version>0.10.4</native-maven-plugin.version>
|
<native-maven-plugin.version>0.10.4</native-maven-plugin.version>
|
||||||
@@ -124,19 +124,12 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>${maven-compiler-plugin.version}</version>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${maven.compiler.source}</source>
|
<release>21</release>
|
||||||
<target>${maven.compiler.target}</target>
|
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>-Xlint:all</arg>
|
<arg>-Xlint:all</arg>
|
||||||
|
<arg>-Xlint:-processing</arg>
|
||||||
<arg>-Werror</arg>
|
<arg>-Werror</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>info.picocli</groupId>
|
|
||||||
<artifactId>picocli-codegen</artifactId>
|
|
||||||
<version>${picocli.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@@ -233,6 +226,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<configLocation>config/checkstyle/checkstyle.xml</configLocation>
|
<configLocation>config/checkstyle/checkstyle.xml</configLocation>
|
||||||
<suppressionsLocation>config/checkstyle/suppressions.xml</suppressionsLocation>
|
<suppressionsLocation>config/checkstyle/suppressions.xml</suppressionsLocation>
|
||||||
|
<propertyExpansion>config_loc=${project.basedir}/config/checkstyle</propertyExpansion>
|
||||||
<consoleOutput>true</consoleOutput>
|
<consoleOutput>true</consoleOutput>
|
||||||
<failsOnError>true</failsOnError>
|
<failsOnError>true</failsOnError>
|
||||||
<violationSeverity>warning</violationSeverity>
|
<violationSeverity>warning</violationSeverity>
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.samsonmedia.barn;
|
||||||
|
|
||||||
|
import com.samsonmedia.barn.cli.BarnCommand;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point for the Barn application.
|
||||||
|
*
|
||||||
|
* <p>This class initializes the picocli command line parser and delegates
|
||||||
|
* command execution to the appropriate subcommand handlers.
|
||||||
|
*/
|
||||||
|
public final class Main {
|
||||||
|
|
||||||
|
private Main() {
|
||||||
|
// Utility class - prevent instantiation
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point.
|
||||||
|
*
|
||||||
|
* @param args command line arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int exitCode = run(args);
|
||||||
|
System.exit(exitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes the command line and returns the exit code.
|
||||||
|
*
|
||||||
|
* <p>This method is separated from {@link #main(String[])} to enable testing
|
||||||
|
* without calling {@link System#exit(int)}.
|
||||||
|
*
|
||||||
|
* @param args command line arguments
|
||||||
|
* @return the exit code (0 for success, non-zero for failure)
|
||||||
|
*/
|
||||||
|
public static int run(String[] args) {
|
||||||
|
return new CommandLine(new BarnCommand()).execute(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Root command for the Barn CLI.
|
||||||
|
*
|
||||||
|
* <p>This command serves as the entry point for all barn operations.
|
||||||
|
* When invoked without a subcommand, it displays usage information.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "barn",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
version = "barn 0.1.0-SNAPSHOT",
|
||||||
|
description = "Cross-platform job daemon for media processing",
|
||||||
|
subcommands = {
|
||||||
|
RunCommand.class,
|
||||||
|
StatusCommand.class,
|
||||||
|
DescribeCommand.class,
|
||||||
|
KillCommand.class,
|
||||||
|
CleanCommand.class,
|
||||||
|
ServiceCommand.class,
|
||||||
|
ConfigCommand.class
|
||||||
|
}
|
||||||
|
)
|
||||||
|
public class BarnCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// When no subcommand is specified, show usage
|
||||||
|
spec.commandLine().usage(spec.commandLine().getOut());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to remove completed jobs.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #13.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "clean",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Remove completed jobs"
|
||||||
|
)
|
||||||
|
public class CleanCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().getOut().println("Clean command not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command for configuration management.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #21.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "config",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Configuration management"
|
||||||
|
)
|
||||||
|
public class ConfigCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().usage(spec.commandLine().getOut());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to show detailed information about a specific job.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #11.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "describe",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Show detailed job information"
|
||||||
|
)
|
||||||
|
public class DescribeCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().getOut().println("Describe command not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to stop a running job.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #12.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "kill",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Stop a running job"
|
||||||
|
)
|
||||||
|
public class KillCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().getOut().println("Kill command not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to start a new job.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #9.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "run",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Start a new job"
|
||||||
|
)
|
||||||
|
public class RunCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().getOut().println("Run command not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to manage the Barn service.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #16.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "service",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Manage the Barn service"
|
||||||
|
)
|
||||||
|
public class ServiceCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().usage(spec.commandLine().getOut());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import picocli.CommandLine.Command;
|
||||||
|
import picocli.CommandLine.Model.CommandSpec;
|
||||||
|
import picocli.CommandLine.Spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to show status of all jobs.
|
||||||
|
*
|
||||||
|
* <p>Placeholder implementation - full implementation in ticket #10.
|
||||||
|
*/
|
||||||
|
@Command(
|
||||||
|
name = "status",
|
||||||
|
mixinStandardHelpOptions = true,
|
||||||
|
description = "Show status of all jobs"
|
||||||
|
)
|
||||||
|
public class StatusCommand implements Runnable {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
private CommandSpec spec;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
spec.commandLine().getOut().println("Status command not yet implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package org.media.samson;
|
|
||||||
|
|
||||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
|
||||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
|
||||||
public class Main {
|
|
||||||
static void main() {
|
|
||||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
|
||||||
// to see how IntelliJ IDEA suggests fixing it.
|
|
||||||
IO.println(String.format("Hello and welcome!"));
|
|
||||||
|
|
||||||
for (int i = 1; i <= 5; i++) {
|
|
||||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
|
||||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
|
||||||
IO.println("i = " + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.samsonmedia.barn;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for the Main entry point.
|
||||||
|
*/
|
||||||
|
class MainTest {
|
||||||
|
|
||||||
|
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||||
|
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
|
||||||
|
private final PrintStream originalOut = System.out;
|
||||||
|
private final PrintStream originalErr = System.err;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUpStreams() {
|
||||||
|
System.setOut(new PrintStream(outContent));
|
||||||
|
System.setErr(new PrintStream(errContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void restoreStreams() {
|
||||||
|
System.setOut(originalOut);
|
||||||
|
System.setErr(originalErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withHelpFlag_shouldReturnZeroExitCode() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = Main.run(new String[]{"--help"});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withVersionFlag_shouldReturnZeroExitCode() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = Main.run(new String[]{"--version"});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withNoArgs_shouldReturnZeroExitCode() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = Main.run(new String[]{});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withInvalidCommand_shouldReturnNonZeroExitCode() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = Main.run(new String[]{"nonexistent-command"});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isNotZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withHelpFlag_shouldPrintUsageToStdout() {
|
||||||
|
// Arrange & Act
|
||||||
|
Main.run(new String[]{"--help"});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outContent.toString();
|
||||||
|
assertThat(output).contains("barn");
|
||||||
|
assertThat(output).contains("Usage:");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void run_withVersionFlag_shouldPrintVersionToStdout() {
|
||||||
|
// Arrange & Act
|
||||||
|
Main.run(new String[]{"--version"});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outContent.toString();
|
||||||
|
assertThat(output).contains("barn");
|
||||||
|
assertThat(output).contains("0.1.0");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
package com.samsonmedia.barn.cli;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for the root BarnCommand.
|
||||||
|
*/
|
||||||
|
class BarnCommandTest {
|
||||||
|
|
||||||
|
private CommandLine commandLine;
|
||||||
|
private StringWriter outWriter;
|
||||||
|
private StringWriter errWriter;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
commandLine = new CommandLine(new BarnCommand());
|
||||||
|
outWriter = new StringWriter();
|
||||||
|
errWriter = new StringWriter();
|
||||||
|
commandLine.setOut(new PrintWriter(outWriter));
|
||||||
|
commandLine.setErr(new PrintWriter(errWriter));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void help_shouldDisplayCommandName() {
|
||||||
|
// Arrange & Act
|
||||||
|
commandLine.execute("--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("barn");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void help_shouldDisplayDescription() {
|
||||||
|
// Arrange & Act
|
||||||
|
commandLine.execute("--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Cross-platform job daemon");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void help_shouldListSubcommands() {
|
||||||
|
// Arrange & Act
|
||||||
|
commandLine.execute("--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("run");
|
||||||
|
assertThat(output).contains("status");
|
||||||
|
assertThat(output).contains("describe");
|
||||||
|
assertThat(output).contains("kill");
|
||||||
|
assertThat(output).contains("clean");
|
||||||
|
assertThat(output).contains("service");
|
||||||
|
assertThat(output).contains("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void version_shouldDisplayVersionNumber() {
|
||||||
|
// Arrange & Act
|
||||||
|
commandLine.execute("--version");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("0.1.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void noArgs_shouldShowUsage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Usage:");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void invalidSubcommand_shouldReturnNonZeroExitCode() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("nonexistent");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isNotZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void runSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("run", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("run");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void statusSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("status", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("status");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void describeSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("describe", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("describe");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void killSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("kill", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("kill");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void cleanSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("clean", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("clean");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void serviceSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("service", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("service");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void configSubcommand_shouldExist() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("config", "--help");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void runSubcommand_shouldShowNotImplementedMessage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("run");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Run command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void statusSubcommand_shouldShowNotImplementedMessage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("status");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Status command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void describeSubcommand_shouldShowNotImplementedMessage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("describe");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Describe command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void killSubcommand_shouldShowNotImplementedMessage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("kill");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Kill command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void cleanSubcommand_shouldShowNotImplementedMessage() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("clean");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Clean command not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void serviceSubcommand_shouldShowUsageByDefault() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("service");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Usage:");
|
||||||
|
assertThat(output).contains("service");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void configSubcommand_shouldShowUsageByDefault() {
|
||||||
|
// Arrange & Act
|
||||||
|
int exitCode = commandLine.execute("config");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertThat(exitCode).isZero();
|
||||||
|
String output = outWriter.toString();
|
||||||
|
assertThat(output).contains("Usage:");
|
||||||
|
assertThat(output).contains("config");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user