You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/02/27 23:21:24 UTC
svn commit: r1732676 - in /sis/branches/JDK8/application/sis-console/src:
main/java/org/apache/sis/console/ test/java/org/apache/sis/console/
test/java/org/apache/sis/test/suite/
Author: desruisseaux
Date: Sat Feb 27 22:21:23 2016
New Revision: 1732676
URL: http://svn.apache.org/viewvc?rev=1732676&view=rev
Log:
Rename internal classes of console application (no code change in this commit).
The previously-used SC abbreviation (for "SubCommand") was unconvenient to remember.
Added:
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
- copied, changed from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java
Removed:
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java
Modified:
sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/Command.java
sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
Copied: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java (from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java?p2=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java&p1=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/AboutCommand.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -62,11 +62,11 @@ import org.apache.sis.internal.util.X364
* @version 0.7
* @module
*/
-final class AboutSC extends SubCommand {
+final class AboutCommand extends CommandRunner {
/**
* Creates the {@code "about"} sub-command.
*/
- AboutSC(final int commandIndex, final String... args) throws InvalidOptionException {
+ AboutCommand(final int commandIndex, final String... args) throws InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.TIMEZONE, Option.ENCODING,
Option.BRIEF, Option.VERBOSE, Option.HELP, Option.DEBUG));
}
Modified: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/Command.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/Command.java?rev=1732676&r1=1732675&r2=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/Command.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/Command.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -119,7 +119,7 @@ public final class Command {
/**
* The sub-command to execute.
*/
- private final SubCommand command;
+ private final CommandRunner command;
/**
* Creates a new command for the given arguments. The first value in the given array which is
@@ -153,16 +153,16 @@ public final class Command {
}
}
if (commandName == null) {
- command = new HelpSC(-1, args);
+ command = new HelpCommand(-1, args);
} else {
commandName = commandName.toLowerCase(Locale.US);
switch (commandName) {
- case "help": command = new HelpSC (commandIndex, args); break;
- case "about": command = new AboutSC (commandIndex, args); break;
- case "mime-type": command = new MimeTypeSC(commandIndex, args); break;
- case "identifier": command = new MetadataSC(MetadataSC.Info.IDENTIFIER, commandIndex, args); break;
- case "metadata": command = new MetadataSC(MetadataSC.Info.METADATA, commandIndex, args); break;
- case "crs": command = new MetadataSC(MetadataSC.Info.CRS, commandIndex, args); break;
+ case "help": command = new HelpCommand (commandIndex, args); break;
+ case "about": command = new AboutCommand (commandIndex, args); break;
+ case "mime-type": command = new MimeTypeCommand(commandIndex, args); break;
+ case "identifier": command = new MetadataCommand(MetadataCommand.Info.IDENTIFIER, commandIndex, args); break;
+ case "metadata": command = new MetadataCommand(MetadataCommand.Info.METADATA, commandIndex, args); break;
+ case "crs": command = new MetadataCommand(MetadataCommand.Info.CRS, commandIndex, args); break;
default: throw new InvalidCommandException(Errors.format(
Errors.Keys.UnknownCommand_1, commandName), commandName);
}
@@ -215,7 +215,7 @@ public final class Command {
/**
* Prints the message of the given exception. This method is invoked only when the error occurred before
- * the {@link SubCommand} has been built, otherwise the {@link SubCommand#err} printer shall be used.
+ * the {@link CommandRunner} has been built, otherwise the {@link CommandRunner#err} printer shall be used.
*
* @param args The command line arguments, used only for detecting if the {@code --debug} option was present.
*/
Copied: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java (from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java?p2=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java&p1=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -41,7 +41,7 @@ import org.apache.sis.internal.util.X364
* @version 0.7
* @module
*/
-abstract class SubCommand {
+abstract class CommandRunner {
/**
* Special value for {@code arguments[commandIndex]} meaning that this sub-command is created
* for JUnit test purpose.
@@ -122,7 +122,7 @@ abstract class SubCommand {
* Copies the configuration of the given sub-command. This constructor is used
* only when a command needs to delegates part of its work to an other command.
*/
- SubCommand(final SubCommand parent) {
+ CommandRunner(final CommandRunner parent) {
this.validOptions = parent.validOptions;
this.options = parent.options;
this.locale = parent.locale;
@@ -148,7 +148,7 @@ abstract class SubCommand {
* @throws InvalidOptionException If an illegal option has been provided, or the option has an illegal value.
*/
@SuppressWarnings("UseOfSystemOutOrSystemErr")
- protected SubCommand(final int commandIndex, final String[] arguments, final EnumSet<Option> validOptions)
+ protected CommandRunner(final int commandIndex, final String[] arguments, final EnumSet<Option> validOptions)
throws InvalidOptionException
{
boolean isTest = false;
@@ -328,7 +328,7 @@ abstract class SubCommand {
* @param commandName The command name converted to lower cases.
*/
protected void help(final String commandName) {
- new HelpSC(this).help(false, new String[] {commandName}, validOptions);
+ new HelpCommand(this).help(false, new String[] {commandName}, validOptions);
}
/**
Copied: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java (from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java?p2=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java&p1=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/HelpCommand.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -32,7 +32,7 @@ import org.apache.sis.util.resources.Voc
* @version 0.7
* @module
*/
-final class HelpSC extends SubCommand {
+final class HelpCommand extends CommandRunner {
/**
* The commands, in the order to be shown.
*/
@@ -49,14 +49,14 @@ final class HelpSC extends SubCommand {
* Copies the configuration of the given sub-command. This constructor is used
* for printing help about an other command.
*/
- HelpSC(final SubCommand parent) {
+ HelpCommand(final CommandRunner parent) {
super(parent);
}
/**
* Creates the {@code "help"} sub-command.
*/
- HelpSC(final int commandIndex, final String... args) throws InvalidOptionException {
+ HelpCommand(final int commandIndex, final String... args) throws InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING, Option.HELP, Option.DEBUG));
}
@@ -73,7 +73,7 @@ final class HelpSC extends SubCommand {
}
/**
- * Implementation of {@link #run()}, also shared by {@link SubCommand#help(String)}.
+ * Implementation of {@link #run()}, also shared by {@link CommandRunner#help(String)}.
*
* @param showHeader {@code true} for printing the "Apache SIS" header.
* @param commandNames The names of the commands to list.
Copied: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java (from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java?p2=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java&p1=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -54,7 +54,7 @@ import org.apache.sis.xml.XML;
* @version 0.7
* @module
*/
-final class MetadataSC extends SubCommand {
+final class MetadataCommand extends CommandRunner {
/**
* The desired information.
*/
@@ -87,7 +87,7 @@ final class MetadataSC extends SubComman
/**
* Creates the {@code "metadata"}, {@code "crs"} or {@code "identifier"} sub-command.
*/
- MetadataSC(final Info command, final int commandIndex, final String... args) throws InvalidOptionException {
+ MetadataCommand(final Info command, final int commandIndex, final String... args) throws InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.FORMAT, Option.LOCALE, Option.TIMEZONE, Option.ENCODING,
Option.COLORS, Option.HELP, Option.DEBUG));
this.command = command;
Copied: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java (from r1732675, sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java?p2=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java&p1=sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeCommand.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -35,7 +35,7 @@ import java.nio.file.FileSystemNotFoundE
/**
* The "mime-type" subcommand.
* This sub-command reproduces the functionality of the following Unix command,
- * except that {@code MimeTypeSC} uses the SIS detection mechanism instead than the OS one.
+ * except that {@code MimeTypeCommand} uses the SIS detection mechanism instead than the OS one.
*
* {@preformat shell
* file --mime-type <files>
@@ -49,11 +49,11 @@ import java.nio.file.FileSystemNotFoundE
* @see Files#probeContentType(Path)
* @see DataStores#probeContentType(Object)
*/
-final class MimeTypeSC extends SubCommand {
+final class MimeTypeCommand extends CommandRunner {
/**
* Creates the {@code "mime-type"} sub-command.
*/
- MimeTypeSC(final int commandIndex, final String... args) throws InvalidOptionException {
+ MimeTypeCommand(final int commandIndex, final String... args) throws InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.ENCODING, Option.HELP, Option.DEBUG));
}
Copied: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java (from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java?p2=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java&p1=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -27,15 +27,15 @@ import static org.apache.sis.test.TestUt
/**
- * Tests the {@link AboutSC} sub-command.
+ * Tests the {@link AboutCommand} sub-command.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.4
* @module
*/
-@DependsOn(SubCommandTest.class)
-public final strictfp class AboutSCTest extends TestCase {
+@DependsOn(CommandRunnerTest.class)
+public final strictfp class AboutCommandTest extends TestCase {
/**
* Tests the sub-command without option.
*
@@ -43,7 +43,7 @@ public final strictfp class AboutSCTest
*/
@Test
public void testDefault() throws Exception {
- final AboutSC test = new AboutSC(0, SubCommand.TEST);
+ final AboutCommand test = new AboutCommand(0, CommandRunner.TEST);
test.run();
verify(test.outputBuffer.toString());
}
@@ -72,7 +72,7 @@ public final strictfp class AboutSCTest
*/
@Test
public void testBrief() throws Exception {
- final AboutSC test = new AboutSC(0, SubCommand.TEST, "--brief");
+ final AboutCommand test = new AboutCommand(0, CommandRunner.TEST, "--brief");
test.run();
final String result = getSingleton(CharSequences.splitOnEOL(test.outputBuffer.toString().trim())).toString();
assertTrue(result, result.contains(Version.SIS.toString()));
@@ -85,7 +85,7 @@ public final strictfp class AboutSCTest
*/
@Test
public void testVerbose() throws Exception {
- final AboutSC test = new AboutSC(0, SubCommand.TEST, "--verbose");
+ final AboutCommand test = new AboutCommand(0, CommandRunner.TEST, "--verbose");
test.run();
final String result = test.outputBuffer.toString();
verify(result);
@@ -95,15 +95,15 @@ public final strictfp class AboutSCTest
}
/**
- * Tests the {@link AboutSC#toRemoteURL(String)} method.
+ * Tests the {@link AboutCommand#toRemoteURL(String)} method.
*/
@Test
public void testToRemoteURL() {
- assertEquals("service:jmx:rmi:///jndi/rmi://myhost:9999/jmxrmi", AboutSC.toRemoteURL("myhost:9999"));
- assertEquals("service:jmx:rmi:///jndi/rmi://myhost:1099/jmxrmi", AboutSC.toRemoteURL("myhost"));
- assertEquals("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", AboutSC.toRemoteURL("localhost:9999"));
- assertEquals("service:jmx:rmi:///jndi/rmi://:1099/jmxrmi", AboutSC.toRemoteURL("localhost"));
- assertEquals("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", AboutSC.toRemoteURL(":9999"));
- assertEquals("service:jmx:rmi:///jndi/rmi://localhosx:1099/jmxrmi", AboutSC.toRemoteURL("localhosx"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://myhost:9999/jmxrmi", AboutCommand.toRemoteURL("myhost:9999"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://myhost:1099/jmxrmi", AboutCommand.toRemoteURL("myhost"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", AboutCommand.toRemoteURL("localhost:9999"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://:1099/jmxrmi", AboutCommand.toRemoteURL("localhost"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", AboutCommand.toRemoteURL(":9999"));
+ assertEquals("service:jmx:rmi:///jndi/rmi://localhosx:1099/jmxrmi", AboutCommand.toRemoteURL("localhosx"));
}
}
Copied: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java (from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java?p2=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java&p1=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/SubCommandTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/CommandRunnerTest.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -32,18 +32,18 @@ import java.nio.charset.StandardCharsets
/**
- * Tests the {@link SubCommand} base class.
+ * Tests the {@link CommandRunner} base class.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.3
* @module
*/
-public final strictfp class SubCommandTest extends TestCase {
+public final strictfp class CommandRunnerTest extends TestCase {
/**
* A dummy sub-command for testing purpose.
*/
- private static final class Dummy extends SubCommand {
+ private static final class Dummy extends CommandRunner {
/**
* Creates a new sub-command for the given arguments and option values.
*
@@ -70,7 +70,7 @@ public final strictfp class SubCommandTe
*/
@Test
public void testLocale() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--locale", "ja");
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--locale", "ja");
assertEquals(Option.LOCALE, getSingleton(c.options.keySet()));
assertSame("locale", Locale.JAPANESE, c.locale);
assertTrue("files.isEmpty()", c.files.isEmpty());
@@ -83,7 +83,7 @@ public final strictfp class SubCommandTe
*/
@Test
public void testTimeZone() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--timezone", "JST");
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--timezone", "JST");
assertEquals(Option.TIMEZONE, getSingleton(c.options.keySet()));
assertEquals("timezone", TimeZone.getTimeZone("JST"), c.timezone);
assertEquals("rawoffset", TimeUnit.HOURS.toMillis(9), c.timezone.getRawOffset());
@@ -97,7 +97,7 @@ public final strictfp class SubCommandTe
*/
@Test
public void testEncoding() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--encoding", "UTF-16");
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--encoding", "UTF-16");
assertEquals(Option.ENCODING, getSingleton(c.options.keySet()));
assertEquals("encoding", StandardCharsets.UTF_16, c.encoding);
assertTrue("files.isEmpty()", c.files.isEmpty());
@@ -111,7 +111,7 @@ public final strictfp class SubCommandTe
@Test
@DependsOnMethod({"testLocale", "testTimeZone", "testEncoding"})
public void testOptionMix() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST,
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST,
"--brief", "--locale", "ja", "--verbose", "--timezone", "JST");
assertEquals("options", EnumSet.of(
Option.BRIEF, Option.LOCALE, Option.VERBOSE, Option.TIMEZONE), c.options.keySet());
@@ -130,10 +130,10 @@ public final strictfp class SubCommandTe
@Test
@DependsOnMethod("testLocale")
public void testMissingOptionValue() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--brief"); // Should not comply.
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--brief"); // Should not comply.
assertEquals(Option.BRIEF, getSingleton(c.options.keySet()));
try {
- new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--brief", "--locale");
+ new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--brief", "--locale");
fail("Expected InvalidOptionException");
} catch (InvalidOptionException e) {
final String message = e.getMessage();
@@ -149,7 +149,7 @@ public final strictfp class SubCommandTe
@Test
public void testUnexpectedOption() throws InvalidOptionException {
try {
- new Dummy(EnumSet.of(Option.HELP, Option.BRIEF), SubCommand.TEST, "--brief", "--verbose", "--help");
+ new Dummy(EnumSet.of(Option.HELP, Option.BRIEF), CommandRunner.TEST, "--brief", "--verbose", "--help");
fail("Expected InvalidOptionException");
} catch (InvalidOptionException e) {
final String message = e.getMessage();
@@ -158,13 +158,13 @@ public final strictfp class SubCommandTe
}
/**
- * Tests {@link SubCommand#hasContradictoryOptions(Option[])}.
+ * Tests {@link CommandRunner#hasContradictoryOptions(Option[])}.
*
* @throws InvalidOptionException Should never happen.
*/
@Test
public void testHasContradictoryOptions() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "--brief", "--verbose");
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "--brief", "--verbose");
assertTrue(c.hasContradictoryOptions(Option.BRIEF, Option.VERBOSE));
final String message = c.outputBuffer.toString();
assertTrue(message.contains("brief"));
@@ -172,13 +172,13 @@ public final strictfp class SubCommandTe
}
/**
- * Tests {@link SubCommand#hasUnexpectedFileCount(int,int)}.
+ * Tests {@link CommandRunner#hasUnexpectedFileCount(int, int)}.
*
* @throws InvalidOptionException Should never happen.
*/
@Test
public void testHasUnexpectedFileCount() throws InvalidOptionException {
- final SubCommand c = new Dummy(EnumSet.allOf(Option.class), SubCommand.TEST, "MyFile.txt");
+ final CommandRunner c = new Dummy(EnumSet.allOf(Option.class), CommandRunner.TEST, "MyFile.txt");
assertFalse(c.hasUnexpectedFileCount(0, 1));
assertEquals("", c.outputBuffer.toString());
assertFalse(c.hasUnexpectedFileCount(1, 2));
Copied: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java (from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java?p2=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java&p1=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/HelpCommandTest.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -24,15 +24,15 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link HelpSC} sub-command.
+ * Tests the {@link HelpCommand} sub-command.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.3
* @module
*/
-@DependsOn(SubCommandTest.class)
-public final strictfp class HelpSCTest extends TestCase {
+@DependsOn(CommandRunnerTest.class)
+public final strictfp class HelpCommandTest extends TestCase {
/**
* Tests the sub-command without option.
*
@@ -40,7 +40,7 @@ public final strictfp class HelpSCTest e
*/
@Test
public void testDefault() throws InvalidOptionException {
- final HelpSC test = new HelpSC(0, SubCommand.TEST);
+ final HelpCommand test = new HelpCommand(0, CommandRunner.TEST);
test.run();
final String result = test.outputBuffer.toString();
assertTrue("Apache SIS", result.startsWith("Apache SIS"));
@@ -60,7 +60,7 @@ public final strictfp class HelpSCTest e
*/
@Test
public void testHelp() throws InvalidOptionException {
- final HelpSC test = new HelpSC(0, SubCommand.TEST, "--help");
+ final HelpCommand test = new HelpCommand(0, CommandRunner.TEST, "--help");
test.help("help");
final String result = test.outputBuffer.toString();
assertTrue ("help", result.startsWith("help"));
@@ -79,7 +79,7 @@ public final strictfp class HelpSCTest e
*/
@Test
public void testEnglishLocale() throws InvalidOptionException {
- final HelpSC test = new HelpSC(0, SubCommand.TEST, "--help", "--locale", "en");
+ final HelpCommand test = new HelpCommand(0, CommandRunner.TEST, "--help", "--locale", "en");
test.help("help");
final String result = test.outputBuffer.toString();
assertTrue(result, result.contains("Show a help overview."));
@@ -93,7 +93,7 @@ public final strictfp class HelpSCTest e
*/
@Test
public void testFrenchLocale() throws InvalidOptionException {
- final HelpSC test = new HelpSC(0, SubCommand.TEST, "--help", "--locale", "fr");
+ final HelpCommand test = new HelpCommand(0, CommandRunner.TEST, "--help", "--locale", "fr");
test.help("help");
final String result = test.outputBuffer.toString();
assertTrue(result, result.contains("Affiche un écran d’aide."));
Copied: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java (from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java?p2=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java&p1=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataSCTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -27,15 +27,15 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link MetadataSC} sub-command.
+ * Tests the {@link MetadataCommand} sub-command.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
* @version 0.6
* @module
*/
-@DependsOn(SubCommandTest.class)
-public final strictfp class MetadataSCTest extends TestCase {
+@DependsOn(CommandRunnerTest.class)
+public final strictfp class MetadataCommandTest extends TestCase {
/**
* Tests the sub-command on a NetCDF file.
*
@@ -45,7 +45,7 @@ public final strictfp class MetadataSCTe
public void testNetCDF() throws Exception {
final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
assertNotNull(IOTestCase.NCEP, url);
- final MetadataSC test = new MetadataSC(MetadataSC.Info.METADATA, 0, SubCommand.TEST, url.toString());
+ final MetadataCommand test = new MetadataCommand(MetadataCommand.Info.METADATA, 0, CommandRunner.TEST, url.toString());
test.run();
verifyNetCDF("Metadata", test.outputBuffer.toString());
}
@@ -71,8 +71,8 @@ public final strictfp class MetadataSCTe
@DependsOnMethod("testNetCDF")
public void testFormatXML() throws Exception {
final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
- final MetadataSC test = new MetadataSC(MetadataSC.Info.METADATA,
- 0, SubCommand.TEST, url.toString(), "--format", "XML");
+ final MetadataCommand test = new MetadataCommand(MetadataCommand.Info.METADATA,
+ 0, CommandRunner.TEST, url.toString(), "--format", "XML");
test.run();
verifyNetCDF("<?xml", test.outputBuffer.toString());
}
Copied: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java (from r1732675, sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java?p2=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java&p1=sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java&r1=1732675&r2=1732676&rev=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeSCTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -26,15 +26,15 @@ import static org.junit.Assert.*;
/**
- * Tests the {@link MimeTypeSC} sub-command.
+ * Tests the {@link MimeTypeCommand} sub-command.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
* @version 0.4
* @module
*/
-@DependsOn(SubCommandTest.class)
-public final strictfp class MimeTypeSCTest extends TestCase {
+@DependsOn(CommandRunnerTest.class)
+public final strictfp class MimeTypeCommandTest extends TestCase {
/**
* Tests the sub-command on a metadata file.
*
@@ -44,7 +44,7 @@ public final strictfp class MimeTypeSCTe
public void testWithMetadataXML() throws Exception {
final URL url = DefaultExtentTest.getResource("Extent.xml");
assertNotNull("Extent.xml", url);
- final MimeTypeSC test = new MimeTypeSC(0, SubCommand.TEST, url.toString());
+ final MimeTypeCommand test = new MimeTypeCommand(0, CommandRunner.TEST, url.toString());
test.run();
final String output = test.outputBuffer.toString().trim();
assertTrue(output, output.endsWith("org/apache/sis/metadata/iso/extent/Extent.xml: application/vnd.iso.19139+xml"));
Modified: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java?rev=1732676&r1=1732675&r2=1732676&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java [UTF-8] Sat Feb 27 22:21:23 2016
@@ -30,11 +30,11 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
- org.apache.sis.console.SubCommandTest.class,
- org.apache.sis.console.HelpSCTest.class,
- org.apache.sis.console.AboutSCTest.class,
- org.apache.sis.console.MimeTypeSCTest.class,
- org.apache.sis.console.MetadataSCTest.class
+ org.apache.sis.console.CommandRunnerTest.class,
+ org.apache.sis.console.HelpCommandTest.class,
+ org.apache.sis.console.AboutCommandTest.class,
+ org.apache.sis.console.MimeTypeCommandTest.class,
+ org.apache.sis.console.MetadataCommandTest.class
})
public final strictfp class ConsoleTestSuite extends TestSuite {
/**