Package com.codahale.shore

Examples of com.codahale.shore.HelpCommand


    private ByteArrayOutputStream output;
   
    @Before
    public void setup() throws Exception {
      this.output = new ByteArrayOutputStream();
      this.cmd = new HelpCommand("Usage: woo", output);
    }
View Full Code Here


    @Test
    public void itReturnsAHelpCommandWithASubcommandList() throws Exception {
      final Runnable runnable = parse();
      assertThat(runnable, is(HelpCommand.class));
     
      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest <subcommand> [options]\n" +
        "\n" +
        "Available subcommands:\n" +
        "   server    Run shoretest as an HTTP server.\n" +
        "   schema    Generate a database schema for shoretest.\n" +
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithASubcommandList() throws Exception {
      final Runnable runnable = parse("-h");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest <subcommand> [options]\n" +
        "\n" +
        "Available subcommands:\n" +
        "   server    Run shoretest as an HTTP server.\n" +
        "   schema    Generate a database schema for shoretest.\n" +
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithASubcommandList() throws Exception {
      final Runnable runnable = parse("--help");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest <subcommand> [options]\n" +
        "\n" +
        "Available subcommands:\n" +
        "   server    Run shoretest as an HTTP server.\n" +
        "   schema    Generate a database schema for shoretest.\n" +
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
        "   -p, --port=PORT      Which port to bind to"
      ));
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server", "-h");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
        "   -p, --port=PORT      Which port to bind to"
      ));
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server", "--help");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
        "   -p, --port=PORT      Which port to bind to"
      ));
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server", "--port=8080");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "Error: Missing required option: c\n" +
        "\n" +
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server", "--config=src/test/resources/hsql-memory.properties");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "Error: Missing required option: p\n" +
        "\n" +
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
View Full Code Here

    @Test
    public void itReturnsAHelpCommandWithServerOptions() throws Exception {
      final Runnable runnable = parse("server", "--config=src/test/resources/not-here.properties", "--port=8080");
      assertThat(runnable, is(HelpCommand.class));

      final HelpCommand cmd = (HelpCommand) runnable;
      assertThat(cmd.getOutputStream(), is(sameInstance((OutputStream) System.out)));
      assertThat(cmd.getText(), is(
        "Error: Config file does not exist\n" +
        "\n" +
        "usage: shoretest server -c <file> -p <port>\n" +
        "   -c, --config=FILE    Which Hibernate config file to use\n" +
        "   -h, --host=HOST      Which hostname to listen on\n" +
View Full Code Here

TOP

Related Classes of com.codahale.shore.HelpCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.