Skip to content

Commit

Permalink
Drop *Main suffix from class names
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeams committed Jul 16, 2021
1 parent a54e247 commit e0f870c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import static bisq.app.BisqConsole.*;

public class BisqCliMain implements BisqApp {
public class BisqCLI implements BisqApp {

static final int EXIT_OK = CommandLine.ExitCode.OK;
static final int EXIT_APP_ERROR = CommandLine.ExitCode.SOFTWARE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static com.google.common.truth.Truth.*;

class BisqCliMainTest {
class BisqCLITest {

private static BisqNode node;
private static int restApiPort;
Expand Down Expand Up @@ -64,7 +64,7 @@ private String stderr() {

@Test
void whenVersionOptionIsProvided_thenPrintVersionAndExit() {
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq("-V"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq("-V"), stderr());
var name = BisqApp.APP_INFO.getName();
var version = BisqApp.APP_INFO.getVersion();
assertFalse(name.contains("${") || version.contains("${"), "resources were not processed");
Expand All @@ -76,7 +76,7 @@ void whenVersionOptionIsProvided_thenPrintVersionAndExit() {

@Test
void exerciseOfferCrudSubcommands() {
Assertions.assertEquals(BisqCliMain.EXIT_USER_ERROR, bisq("offer"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_USER_ERROR, bisq("offer"), stderr());
assertEquals("""
Missing required subcommand
Usage: bisq offer [COMMAND]
Expand All @@ -88,36 +88,36 @@ void exerciseOfferCrudSubcommands() {
""",
stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list));
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list));
assertEquals("""
[]
""", stdout());
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerA"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerA"), stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.view, "1"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.view, "1"), stderr());
assertEquals("""
offerA
""", stdout());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerB"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerB"), stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerC"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.create, "offerC"), stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
assertEquals("""
[offerA, offerB, offerC]
""", stdout());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.delete, "1"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.delete, "1"), stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
assertEquals("""
[offerB, offerC]
""", stdout());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.delete, "all"), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.delete, "all"), stderr());
reset();
Assertions.assertEquals(BisqCliMain.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
Assertions.assertEquals(BisqCLI.EXIT_OK, bisq(OfferCommand.offer, OfferCommand.list), stderr());
assertEquals("""
[]
""", stdout());
Expand All @@ -130,7 +130,7 @@ void whenHelpOptionIsProvided_thenPrintUsage() {

@Test
void whenUnknownSubcommandIsProvided_thenReportErrorAndPrintUsage() {
Assertions.assertEquals(BisqCliMain.EXIT_USER_ERROR, bisq("bogus"));
Assertions.assertEquals(BisqCLI.EXIT_USER_ERROR, bisq("bogus"));
assertThat(stderr()).containsMatch("Unmatched argument .* 'bogus'");
assertThat(stderr()).endsWith(usageText());
}
Expand All @@ -145,6 +145,6 @@ private static int bisq(String... args) {
newArgs.add(BisqCommand.stacktraceOpt);
newArgs.add(String.format("%s=localhost:%d", BisqCommand.nodeOpt, restApiPort));
newArgs.addAll(Arrays.asList(args));
return BisqCliMain.bisq(newArgs.toArray(new String[]{}));
return BisqCLI.bisq(newArgs.toArray(new String[]{}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BisqDaemonMain implements BisqApp {
public class BisqDaemon implements BisqApp {

private static final Logger log = LoggerFactory.getLogger(BisqDaemonMain.class);
private static final Logger log = LoggerFactory.getLogger(BisqDaemon.class);

public static void main(String[] args) {
bisqd(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import static bisq.app.BisqConsole.*;

public class BisqFXMain implements BisqApp {
public class BisqFX implements BisqApp {

private static final Logger log = LoggerFactory.getLogger(BisqFXMain.class);
private static final Logger log = LoggerFactory.getLogger(BisqFX.class);

public static void main(String[] args) {
System.exit(bisqfx(args));
Expand Down
2 changes: 1 addition & 1 deletion app/fx/src/main/java/bisq/app/fx/BisqFXApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ public static void launchAppplication(BisqFXCommand command) {
}

public static void main(String[] args) {
throw new UnsupportedOperationException(format("Run %s instead", BisqFXMain.class.getName()));
throw new UnsupportedOperationException(format("Run %s instead", BisqFX.class.getName()));
}
}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ configure(project(':app:daemon')) {
}

application {
mainClass = 'bisq.app.daemon.BisqDaemonMain'
mainClass = 'bisq.app.daemon.BisqDaemon'
applicationName = 'bisqd'
}

Expand All @@ -103,7 +103,7 @@ configure(project(':app:cli')) {
}

application {
mainClass = 'bisq.app.cli.BisqCliMain'
mainClass = 'bisq.app.cli.BisqCli'
applicationName = 'bisq'
}

Expand Down Expand Up @@ -143,7 +143,7 @@ configure(project(':app:fx')) {
}

application {
mainClass = 'bisq.app.fx.BisqFXMain'
mainClass = 'bisq.app.fx.BisqFX'
applicationName = 'bisqfx'
}

Expand Down

0 comments on commit e0f870c

Please sign in to comment.