From 317c8a127c4393a3f32820345ae77fbe21d49f73 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Thu, 2 Feb 2012 18:57:08 +0000 Subject: QPID-3802: Broker command line processing --help (-h) and --version (-v) no longer work Applied patch from Andrew MacBean git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1239759 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/java/org/apache/qpid/server/MainTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'qpid/java/broker/src/test') diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java index bdb25a484f..31d5028536 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/MainTest.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.server; +import org.apache.commons.cli.CommandLine; import org.apache.qpid.test.utils.QpidTestCase; import java.util.EnumSet; @@ -145,6 +146,22 @@ public class MainTest extends QpidTestCase assertEquals(9, options.getLogWatchFrequency()); } + public void testVersion() + { + final TestMain main = new TestMain("-v".split("\\s")); + + assertNotNull("Command line not parsed correctly", main.getCommandLine()); + assertTrue("Parsed command line didnt pick up version option", main.getCommandLine().hasOption("v")); + } + + public void testHelp() + { + final TestMain main = new TestMain("-h".split("\\s")); + + assertNotNull("Command line not parsed correctly", main.getCommandLine()); + assertTrue("Parsed command line didnt pick up help option", main.getCommandLine().hasOption("h")); + } + private BrokerOptions startDummyMain(String commandLine) { return (new TestMain(commandLine.split("\\s"))).getOptions(); @@ -174,5 +191,10 @@ public class MainTest extends QpidTestCase { return _options; } + + public CommandLine getCommandLine() + { + return _commandLine; + } } } -- cgit v1.2.1